Index: inc/class.contacts_sql.inc.php
===================================================================
RCS file: /var/cvs/phpgroupware/phpgwapi/inc/class.contacts_sql.inc.php,v
retrieving revision 1.17.2.2.2.71
diff -u -r1.17.2.2.2.71 class.contacts_sql.inc.php
--- inc/class.contacts_sql.inc.php	16 Nov 2004 21:35:21 -0000	1.17.2.2.2.71
+++ inc/class.contacts_sql.inc.php	22 Nov 2004 14:30:06 -0000
@@ -1095,7 +1095,7 @@
 			$this->total_records = $this->db->num_rows();
 			while ($this->db->next_record())
 			{
-				$persons[] = $this->db->Record;
+				$persons[] = $this->db->resultSet->fetchRow();
 			}
 			return $persons;
 		}
@@ -1220,7 +1220,7 @@
 			$this->total_records = $this->db->num_rows();
 			while ($this->db->next_record())
 			{
-				$orgs[] = $this->db->Record;
+				$orgs[] = $this->db->resultSet->fetchRow();
 			}
 			
 			return $orgs;
@@ -1845,7 +1845,7 @@
 
 			while ($this->db->next_record())
 			{
-				$record = $this->db->Record;
+				$record = $this->db->resultSet->fetchRow();
 				$contact['contact_id']		= $record['contact_id'];
 				$contact['access']		= $record['access'];
 				$contact['owner']		= $record['owner'];
@@ -2944,7 +2944,7 @@
 			$this->execute_query($this->get_sql(),$line,$file);
 			while ($this->db->next_record())
 			{
-				$record[] = $this->db->Record;
+				$record[] = $this->db->resultSet->fetchRow();
 			}
 			return $record;
 		}
@@ -3028,7 +3028,7 @@
 			$this->db->query($sql, __LINE__, __FILE__);
 			while ($this->db->next_record())
 			{
-				$orgs = &$this->db->Record;
+				$orgs = &$this->db->resultSet->fetchRow();
 			}
 			return $orgs;
 		}
@@ -3073,7 +3073,7 @@
 			$this->db->query($this->get_sql(), __LINE__, __FILE__);
 			while ($this->db->next_record())
 			{
-				$cats[] = $this->db->Record;
+				$cats[] = $this->db->resultSet->fetchRow();
 			}
 
 			return $cats;
@@ -3368,7 +3368,7 @@
 			$this->db->query($query,__LINE__, __FILE__);
 			while($this->db->next_record())
 			{
-				$contact = $this->db->Record;
+				$contact = $this->db->resultSet->fetchRow();
 				$contact['account_id'] = $GLOBALS['phpgw']->accounts->search_person($contact['contact_id']);
 				$contacts[] = $contact;
 			}
@@ -4420,13 +4420,13 @@
 				$ret['contact_id'] = $cid;
 				
 				$this->edit_contact($cid, $contact, PHPGW_SQL_RUN_SQL);
-				if ($GLOBALS['phpgw']->db->Error)
+				if ($GLOBALS['phpgw']->db->adodb->ErrorMsg())
 					$ret['edit_contact'] = false;
 				else
 					$ret['edit_contact'] = true;
 
 				$this->edit_person($cid, $contact, PHPGW_SQL_RUN_SQL);
-				if ($GLOBALS['phpgw']->db->Error)
+				if ($GLOBALS['phpgw']->db->adodb->ErrorMsg())
 					$ret['edit_person'] = false;
 				else
 					$ret['edit_person'] = true;
@@ -4454,7 +4454,7 @@
 								{
 									// replace old comm data
 									$this->edit_comms($key_comm_id, $comm, PHPGW_SQL_RUN_SQL);
-									if ($GLOBALS['phpgw']->db->Error)
+									if ($GLOBALS['phpgw']->db->adodb->ErrorMsg())
 										$ret_comm['edit_comms'][$key_comm_id] = false;
 									else
 										$ret_comm['edit_comms'][$key_comm_id] = true;
@@ -4470,7 +4470,7 @@
 							{
 								// delete old comm data
 								$this->delete_specified_comm($key_comm_id, PHPGW_SQL_RUN_SQL);
-								if ($GLOBALS['phpgw']->db->Error)
+								if ($GLOBALS['phpgw']->db->adodb->ErrorMsg())
 									$ret_comm[$key_comm_id]['delete_specified_comm'] = false;
 								else
 									$ret_comm[$key_comm_id]['delete_specified_comm'] = true;
@@ -4482,7 +4482,7 @@
 					{
 						$this->add_communication_media($comm, $cid, PHPGW_SQL_RUN_SQL);
 						$this->unlock_table();
-						if ($GLOBALS['phpgw']->db->Error)
+						if ($GLOBALS['phpgw']->db->adodb->ErrorMsg())
 							$ret_comm['add_communication_media'][] = false;
 						else
 							$ret_comm['add_communication_media'][] = true;
@@ -4497,7 +4497,7 @@
 				{
 					// 1. delete old locs
 					$this->delete_locations($cid, PHPGW_SQL_RUN_SQL);
-					if ($GLOBALS['phpgw']->db->Error)
+					if ($GLOBALS['phpgw']->db->adodb->ErrorMsg())
 						$ret_loc['delete_locations'] = false;
 					else
 						$ret_loc['delete_locations'] = true;
@@ -4509,7 +4509,7 @@
 					{
 						$this->add_location($loc, $cid, PHPGW_SQL_RUN_SQL);
 						$this->unlock_table();
-						if ($GLOBALS['phpgw']->db->Error)
+						if ($GLOBALS['phpgw']->db->adodb->ErrorMsg())
 							$ret_loc['add_location'][] = false;
 						else
 							$ret_loc['add_location'][] = true;
@@ -4541,7 +4541,7 @@
 					$ret['other'] = $old_others;
 					// 1. delete old others
 					$this->delete_others($cid, PHPGW_SQL_RUN_SQL);
-					if ($GLOBALS['phpgw']->db->Error)
+					if ($GLOBALS['phpgw']->db->adodb->ErrorMsg())
 						$ret_other['delete_others'] = false;
 					else
 						$ret_other['delete_others'] = true;
@@ -4553,7 +4553,7 @@
 					{
 						$this->add_others($other, $cid, PHPGW_SQL_RUN_SQL);
 						$this->unlock_table();
-						if ($GLOBALS['phpgw']->db->Error)
+						if ($GLOBALS['phpgw']->db->adodb->ErrorMsg())
 							$ret_other['add_other'][] = false;
 						else
 							$ret_other['add_other'][] = true;
Index: inc/class.db.inc.php
===================================================================
RCS file: /var/cvs/phpgroupware/phpgwapi/inc/class.db.inc.php,v
retrieving revision 1.6.4.5
diff -u -r1.6.4.5 class.db.inc.php
--- inc/class.db.inc.php	10 Feb 2004 13:51:17 -0000	1.6.4.5
+++ inc/class.db.inc.php	22 Nov 2004 14:30:06 -0000
@@ -19,8 +19,7 @@
 	/**
 	* Include concrete database implementation
 	*/
-	include(PHPGW_API_INC.'/class.db_'.$GLOBALS['phpgw_info']['server']['db_type'].'.inc.php');
-
+	include(PHPGW_API_INC.'/adodb/adodb.inc.php');
 
 	/**
 	* Database abstraction class to allow phpGroupWare to use multiple database backends
@@ -29,91 +28,29 @@
 	* @subpackage database
 	* @abstract
 	*/
-	class db_
+	class db
 	{
-		/**
-		* @var string $Host database host to connect to
-		*/
-		var $Host     = '';
-		
-		/**
-		* @var string $Database name of database to use
-		*/
-		var $Database = '';
-		
-		/**
-		* @var string $User name of database user
-		*/
-		var $User     = '';
-		
-		/**
-		* @var string $Password password for database user
-		*/
-		var $Password = '';
 
-		/**
-		* @var bool $auto_stripslashes automatically remove slashes when returning field values - default False
-		*/
-		var $auto_stripslashes = False;
-		
-		/**
-		* @var int $Auto_Free automatically free results - 0 no, 1 yes
-		*/
-		var $Auto_Free     = 0;
-		
-		/**
-		* @var int $Debug enable debuging - 0 no, 1 yes
-		*/
-		var $Debug         = 0;
-
-		/**
-		* @var string $Halt_On_Error "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning)
-		*/
-		var $Halt_On_Error = 'yes';
-		
-		/**
-		* @var string $Seq_Table table for storing sequences ????
-		*/
-		var $Seq_Table     = 'db_sequence';
-
-		/**
-		* @var array $Record current record
-		*/
-		var $Record   = array();
-		
-		/**
-		* @var int row number for current record
-		*/
-		var $Row;
-
-		/**
-		* @var int $Errno internal rdms error number for last error 
-		*/
-		var $Errno    = 0;
-        
-		/** 
-		* @var string descriptive text from last error
-		*/
-		var $Error    = '';
-
-		/** 
-		* @var boolean XMLRPC available
-		* @access  private
-		*/
-		var $xmlrpc = False;
-		/** 
-		* @var boolean SOAP available
-		* @access  private
-		*/
-		var $soap   = False;
+		var $Host;
+		var $Type;
+		var $Database;
+		var $User;
+		var $Password;
+		var $debug = 0;
+		var $Halt_On_Error = 'yes'; // should be true or false
 
 		/**
 		* Constructor
 		* @param string $query query to be executed (optional)
 		*/
-		function db_($query = '')
+		function db($query = '')
 		{
-			$this->query($query);
+			$this->adodb = NewADOConnection($GLOBALS['phpgw_info']['server']['db_type']);
+			if($query != '')
+			{
+				echo "wtf: db";
+				$this->query($query);
+			}
 		}
 
 		/**
@@ -122,7 +59,12 @@
 		*/
 		function link_id()
 		{
-			return $this->Link_ID;
+			//echo "link_id: depricated";
+			if(!$this->adodb->isConnected())
+			{
+				$this->connect();
+			}
+			return $this->adodb->_connectionID;
 		}
 
 		/**
@@ -131,6 +73,8 @@
 		*/
 		function query_id()
 		{
+			echo "query_id: depricated";
+			die('you really need this method?');
 			return $this->Query_ID;
 		}
 
@@ -143,13 +87,23 @@
 		* @param string $Password password for database user (optional)
 		*/
 		function connect($Database = '', $Host = '', $User = '', $Password = '')
-		{}
+		{
+			if($debug) /* $GLOBALS['phpgw']->log */ echo "depricated: connect";
+			$this->Database = $Database != '' ? $Database : $this->Database;
+			$this->Host = $Host != '' ? $Host : $this->Host;
+			$this->User = $User != '' ? $User : $this->User;
+			$this->Password = $Password != '' ? $Password : $this->Password;
+			return $this->adodb->connect($this->Host, $this->User, $this->Password, $this->Database);
+		}
 
 		/**
 		* Close a connection to a database - only needed for persistent connections
 		*/
 		function disconnect()
-		{}
+		{
+			if($debug) /* $GLOBALS['phpgw']->log */ echo "disconnect: depricated";
+			$this->adodb->close();
+		}
 
 		/**
 		* Escape strings before sending them to the database
@@ -159,12 +113,12 @@
 		*/
 		function db_addslashes($str)
 		{
-			if (!isset($str) || $str == '')
+			if($debug) /* $GLOBALS['phpgw']->log */ echo "to_timestanp: db_addsl";
+			if(!$this->adodb)  //workaround
 			{
-				return '';
+				return addslashes($str);
 			}
-
-			return addslashes($str);
+			return substr($this->adodb->qstr($str, get_magic_quotes_gpc()), 1, -1);
 		}
 
 		/**
@@ -174,7 +128,10 @@
 		* @return string rdms specific timestamp
 		*/
 		function to_timestamp($epoch)
-		{}
+		{
+			if($debug) /* $GLOBALS['phpgw']->log */ echo "to_timestanp: depricated";
+			return substr($this->adodb->DBTimeStamp($epoch), 1, -1);
+		}
 
 		/**
 		* Convert a rdms specific timestamp to a unix timestamp 
@@ -183,7 +140,10 @@
 		* @return int unix timestamp
 		*/
 		function from_timestamp($timestamp)
-		{}
+		{
+			if($debug) /* $GLOBALS['phpgw']->log */ echo "from_timestanp: depricated";
+			return $this->adodb->UnixTimeStamp($timestamp);
+		}
 
 		/**
 		* Execute a query with limited result set
@@ -192,13 +152,20 @@
 		* @see limit_query()
 		*/
 		function limit($start)
-		{}
+		{
+			if($debug) /* $GLOBALS['phpgw']->log */ echo "depricated: limit";
+			die('where is the sql string?');
+		}
 
 		/**
 		* Discard the current query result
 		*/
 		function free()
-		{}
+		{
+			if($this->debug) /* $GLOBALS['phpgw']->log */ echo "depricated: limit";
+			unset($this->resultSet);
+			return true;
+		}
 
 		/**
 		* Execute a query
@@ -209,7 +176,26 @@
 		* @return integer current query id if sucesful and null if fails
 		*/
 		function query($Query_String, $line = '', $file = '')
-		{}
+		{
+			if($this->debug) /* $GLOBALS['phpgw']->log */ echo "query: depricated: $Query_String <br>";
+			if(!$this->adodb->isConnected())
+			{
+				$this->connect();
+			}
+			$this->resultSet = $this->adodb->Execute($Query_String);
+			if(!$this->resultSet && $this->Halt_On_Error == 'yes')
+			{
+				echo $Query_String.'<br>';
+				echo $this->adodb->ErrorMsg();
+				_debug_array(debug_backtrace());
+				die();
+			}
+			else
+			{
+				$this->delayPointer = true;
+				return true;
+			}
+		}
 
 		/**
 		* Execute a query with limited result set
@@ -221,8 +207,27 @@
 		* @param integer $num_rows number of rows to return (optional), if unset will use $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
 		* @return integer current query id if sucesful and null if fails
 		*/
-		function limit_query($Query_String, $offset, $line = '', $file = '', $num_rows = '')
-		{}
+		function limit_query($Query_String, $offset = -1, $line = '', $file = '', $num_rows = -1)
+		{
+			if($this->debug) /* $GLOBALS['phpgw']->log */ echo "depricated: limit_query";
+			if(!$this->adodb->isConnected())
+			{
+				$this->connect();
+			}
+			$this->resultSet = $this->adodb->SelectLimit($Query_String, $num_rows, $offset);
+			if(!$this->resultSet && $this->Halt_On_Error == 'yes')
+			{
+				echo "$Query_String<br>";
+				print $this->adodb->ErrorMsg();
+				_debug_array(debug_backtrace());
+				die();
+			}
+			else
+			{
+				$this->delayPointer = true;
+				return true;
+			}
+		}
 		
 		/**
 		* Move to the next row in the results set
@@ -230,7 +235,23 @@
 		* @return bool was another row found?
 		*/
 		function next_record()
-		{}
+		{
+			if($this->debug) /* $GLOBALS['phpgw']->log */ echo "depricated: next_record<br>";
+			if($this->resultSet && $this->resultSet->RecordCount())
+			{
+				if($this->delayPointer)
+				{
+					$this->delayPointer = false;
+					return true;
+				}
+	
+				if(!$this->resultSet->EOF)
+				{
+					return $this->resultSet->MoveNext();
+				}
+			}
+			return false;
+		}
 
 		/**
 		* Move to position in result set
@@ -239,7 +260,14 @@
 		* @return int 1 if sucessful or 0 if not found
 		*/
 		function seek($pos = 0)
-		{}
+		{
+			if($this->debug) /* $GLOBALS['phpgw']->log */ echo "depricated: seek";
+			if($this->resultSet)
+			{
+				return $this->resultSet->Move($pos);
+			}
+			return false;
+		}
 
 		/**
 		* Begin transaction
@@ -248,7 +276,8 @@
 		*/
 		function transaction_begin()
 		{
-			return True;
+			if($this->debug) /* $GLOBALS['phpgw']->log */ echo 'depricated';
+			return $this->adodb->BeginTrans();
 		}
 		
 		/**
@@ -258,7 +287,8 @@
 		*/ 
 		function transaction_commit()
 		{
-			return True;
+			if($this->debug) /* $GLOBALS['phpgw']->log */ echo "depricated: transaction_commit";
+			return $this->adodb->CommitTrans();
 		}
 		
 		/**
@@ -267,7 +297,7 @@
 		* @return boolean True if sucessful, False if fails
 		*/
 		function transaction_abort()
-		{
+		{echo "depricated: transaction_abort";
 			return True;
 		}
 
@@ -279,7 +309,10 @@
 		* @return integer the id, -1 if fails
 		*/
 		function get_last_insert_id($table, $field)
-		{}
+		{
+			//echo "depricated: get_last_insert_id";
+			return $this->adodb->Insert_ID();
+		}
 
 		/**
 		* Lock a table
@@ -289,7 +322,10 @@
 		* @return boolean True if sucessful, False if fails
 		*/
 		function lock($table, $mode='write')
-		{}
+		{
+			//echo "depricated: lock";
+			//$this->adodb->BeginTrans();
+		}
 		
 		
 		/**
@@ -298,7 +334,10 @@
 		* @return boolean True if sucessful, False if fails
 		*/
 		function unlock()
-		{}
+		{
+			//echo "depricated: unlock";
+			//$this->adodb->CommitTrans();
+		}
 
 		/**
 		* Get the number of rows affected by last update
@@ -306,7 +345,10 @@
 		* @return integer number of rows
 		*/
 		function affected_rows()
-		{}
+		{
+			//echo "depricated: affected_rows";
+			return $this->adodb->Affected_Rows();
+		}
 		
 		/**
 		* Number of rows in current result set
@@ -314,7 +356,14 @@
 		* @return integer number of rows
 		*/
 		function num_rows()
-		{}
+		{
+			//echo "depricated: num_rows";
+			if($this->resultSet)
+			{
+				return $this->resultSet->RecordCount();
+			}
+			return 0;
+		}
 
 		/**
 		* Number of fields in current row
@@ -323,7 +372,7 @@
 		*/
 		
 		function num_fields()
-		{}
+		{echo "depricated: num_fields";}
 
 		/**
 		* Short hand for num_rows()
@@ -331,7 +380,7 @@
 		* @see num_rows()
 		*/
 		function nf()
-		{
+		{echo "depricated: nf";
 			return $this->num_rows();
 		}
 
@@ -339,7 +388,7 @@
 		* Short hand for print @see num_rows
 		*/
 		function np()
-		{
+		{echo "depricated: np";
 			print $this->num_rows();
 		}
 
@@ -350,15 +399,19 @@
 		* @param boolean $strip_slashes string escape chars from field(optional), default false
 		* @return string the field value
 		*/
-		function f($Name, $strip_slashes = False)
+		function f($name, $strip_slashes = False)
 		{
-			if ($strip_slashes || ($this->auto_stripslashes && ! $strip_slashes))
+			if($this->resultSet && get_class($this->resultSet) != 'adorecordset_empty')
 			{
-				return stripslashes($this->Record[$Name]);
-			}
-			else
-			{
-				return $this->Record[$Name];
+				//echo "depricated: f";
+				if ($strip_slashes || ($this->auto_stripslashes && ! $strip_slashes))
+				{
+					return stripslashes($this->resultSet->Fields($name));
+				}
+				else
+				{
+					return $this->resultSet->Fields($name);
+				}
 			}
 		}
 
@@ -370,6 +423,7 @@
 		*/
 		function p($Name, $strip_slashes = True)
 		{
+						echo "depi: p";
 			print $this->f($Name, $strip_slashes);
 		}
 
@@ -380,7 +434,7 @@
 		* @return integer sequence id
 		*/
 		function nextid($seq_name)
-		{}
+		{			echo "depi: nextid";}
 
 		/**
 		* Get description of a table
@@ -391,6 +445,7 @@
 		*/  
 		function metadata($table = '',$full = false)
 		{
+						echo "depi: metadata";
 			/*
 			 * Due to compatibility problems with Table we changed the behavior
 			 * of metadata();
@@ -426,7 +481,7 @@
 		* @param string $file file of calling method/function (optional)
 		*/
 		function halt($msg, $line = '', $file = '')
-		{}
+		{			echo "depi: halt";}
 
        	/**
 		* Get a list of table names in the current database
@@ -434,7 +489,11 @@
 		* @return array list of the tables
 		*/
 		function table_names()
-		{}
+		{
+			//echo "depi: table_names";
+			//_debug_array(debug_backtrace());
+			return $this->adodb->MetaTables('TABLES');
+		}
 
 		/**
 		* Return a list of indexes in current database
@@ -443,6 +502,7 @@
 		*/
 		function index_names()
 		{
+						echo "depi: index_names";
 			return array();
 		}
 		
@@ -453,7 +513,7 @@
 		* @param string $adminpasswd Password for the database administrator user (optional)
 		*/
 		function create_database($adminname = '', $adminpasswd = '')
-		{}
+		{			echo "depi: create_database";}
      
                 
      	/**
@@ -465,6 +525,7 @@
 		 */
 		function prepare_sql_statement($query)
 		{
+						echo "depi";
 		  if (($query == '') || (!$this->connect()))
 	  	   {
 			return(FALSE);
@@ -488,6 +549,6 @@
 		   }
 		  return(FALSE);
          }  
-                
+           
 	}
 ?>
Index: inc/class.sessions_db.inc.php
===================================================================
RCS file: /var/cvs/phpgroupware/phpgwapi/inc/class.sessions_db.inc.php,v
retrieving revision 1.2.2.10.2.12
diff -u -r1.2.2.10.2.12 class.sessions_db.inc.php
--- inc/class.sessions_db.inc.php	6 Jun 2004 23:01:43 -0000	1.2.2.10.2.12
+++ inc/class.sessions_db.inc.php	22 Nov 2004 14:30:06 -0000
@@ -28,7 +28,7 @@
 			$this->db->query("SELECT * FROM phpgw_sessions WHERE session_id='" . $this->sessionid . "'",__LINE__,__FILE__);
 			$this->db->next_record();
 			
-			return $this->db->Record;
+			return $this->db->resultSet->fetchRow();
 		}
 
 		// This will remove stale sessions out of the database
Index: inc/class.setup_detection.inc.php
===================================================================
RCS file: /var/cvs/phpgroupware/phpgwapi/inc/class.setup_detection.inc.php,v
retrieving revision 1.6.2.10
diff -u -r1.6.2.10 class.setup_detection.inc.php
--- inc/class.setup_detection.inc.php	6 Nov 2004 15:34:26 -0000	1.6.2.10
+++ inc/class.setup_detection.inc.php	22 Nov 2004 14:30:06 -0000
@@ -47,7 +47,7 @@
 			$tables = $GLOBALS['phpgw_setup']->db->table_names();
 			foreach($tables as $key => $val)
 			{
-				$tname[] = $val['table_name'];
+				$tname[] = $val;
 			}
 			$newapps = in_array('phpgw_applications',$tname);
 			$oldapps = in_array('applications',$tname);
@@ -285,7 +285,7 @@
 				/* no tables, so checking if we can create them */
 				$GLOBALS['phpgw_setup']->db->query('CREATE TABLE phpgw_testrights ( testfield varchar(5) NOT NULL )',__LINE__,__FILE__);
 				ob_end_clean();//dump the output
-				if($GLOBALS['phpgw_setup']->db->Link_ID && !$GLOBALS['phpgw_setup']->db->Errno)
+				if($GLOBALS['phpgw_setup']->db->link_id() && !$GLOBALS['phpgw_setup']->db->Errno)
 				{
 					$GLOBALS['phpgw_setup']->db->query('DROP TABLE phpgw_testrights',__LINE__,__FILE__);
 					$GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage 3 (Install Applications)';
Index: inc/class.translation_sql.inc.php
===================================================================
RCS file: /var/cvs/phpgroupware/phpgwapi/inc/class.translation_sql.inc.php,v
retrieving revision 1.8.4.6
diff -u -r1.8.4.6 class.translation_sql.inc.php
--- inc/class.translation_sql.inc.php	8 Mar 2004 23:11:23 -0000	1.8.4.6
+++ inc/class.translation_sql.inc.php	22 Nov 2004 14:30:06 -0000
@@ -59,14 +59,10 @@
 					$sql .= ' order by app_name desc';
 				}
         
-        $db = $GLOBALS['phpgw']->db;				
-        $db->query($sql,__LINE__,__FILE__);
-        while ($db->next_record())
+        $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+        while ($GLOBALS['phpgw']->db->next_record())
         {
-          // directly access of the Record is not the best design, but improves
-          // speed of the whole function by 25% 
-          $GLOBALS['lang'][strtolower($db->Record['message_id'])] = $db->Record['content'];
-          // $GLOBALS['lang'][strtolower($db->f('message_id'))] = $db->f('content');        
+          $GLOBALS['lang'][strtolower($GLOBALS['phpgw']->db->resultSet->fields('message_id'))] = $GLOBALS['phpgw']->db->resultSet->fields('content');
 				}
 			}
 			$ret = $key.'*';	// save key if we dont find a translation
Index: inc/functions.inc.php
===================================================================
RCS file: /var/cvs/phpgroupware/phpgwapi/inc/functions.inc.php,v
retrieving revision 1.121.2.13.2.22
diff -u -r1.121.2.13.2.22 functions.inc.php
--- inc/functions.inc.php	6 Nov 2004 15:34:26 -0000	1.121.2.13.2.22
+++ inc/functions.inc.php	22 Nov 2004 14:30:06 -0000
@@ -124,24 +124,32 @@
 	 /************************************************************************\
 	 * Load up the main instance of the db class.                             *
 	 \************************************************************************/
-	$GLOBALS['phpgw']->db           = CreateObject('phpgwapi.db');
-	$GLOBALS['phpgw']->db->Host     = $GLOBALS['phpgw_info']['server']['db_host'];
-	$GLOBALS['phpgw']->db->Type     = $GLOBALS['phpgw_info']['server']['db_type'];
-	$GLOBALS['phpgw']->db->Database = $GLOBALS['phpgw_info']['server']['db_name'];
-	$GLOBALS['phpgw']->db->User     = $GLOBALS['phpgw_info']['server']['db_user'];
-	$GLOBALS['phpgw']->db->Password = $GLOBALS['phpgw_info']['server']['db_pass'];
-	if ($GLOBALS['phpgw']->debug)
+	$GLOBALS['phpgw']->db                = CreateObject('phpgwapi.db');
+	$GLOBALS['phpgw']->db->Debug         = $GLOBALS['phpgw']->debug ? 1 : 0;
+	$GLOBALS['phpgw']->db->Halt_On_Error = 'no';
+	$GLOBALS['phpgw']->adodb             =& $GLOBALS['phpgw']->db->adodb; //Reference
+	
+	@$GLOBALS['phpgw']->adodb->connect($GLOBALS['phpgw_info']['server']['db_host'],
+	                                   $GLOBALS['phpgw_info']['server']['db_user'],
+	                                   $GLOBALS['phpgw_info']['server']['db_pass'],
+	                                   $GLOBALS['phpgw_info']['server']['db_name']
+	                                  );
+	if(!$GLOBALS['phpgw']->adodb->ErrorMsg())
 	{
-		$GLOBALS['phpgw']->db->Debug = 1;
+		$GLOBALS['phpgw']->adodb->query('select count(config_name) from phpgw_config');
+		if($GLOBALS['phpgw']->adodb->ErrorMsg())
+		{
+			$setup_dir = ereg_replace($_SERVER['PHP_SELF'],'index.php','setup/');
+			echo '<center><b>Fatal Error:</b> It appears that you have not created the database tables for '
+			.'phpGroupWare.  Click <a href="' . $setup_dir . '">here</a> to run setup.</center>';
+			exit;
+		}
 	}
-
-	$GLOBALS['phpgw']->db->Halt_On_Error = 'no';
-	@$GLOBALS['phpgw']->db->query("select count(config_name) from phpgw_config");
-	if (! @$GLOBALS['phpgw']->db->next_record())
+	else
 	{
 		$setup_dir = ereg_replace($_SERVER['PHP_SELF'],'index.php','setup/');
-		echo '<center><b>Fatal Error:</b> It appears that you have not created the database tables for '
-		.'phpGroupWare.  Click <a href="' . $setup_dir . '">here</a> to run setup.</center>';
+		echo '<center><b>Fatal Error:</b> Unable to connect to database server '
+		.'Click <a href="' . $setup_dir . '">here</a> to run setup.</center>';
 		exit;
 	}
 	$GLOBALS['phpgw']->db->Halt_On_Error = 'yes';
Index: setup/default_records.inc.php
===================================================================
RCS file: /var/cvs/phpgroupware/phpgwapi/setup/default_records.inc.php,v
retrieving revision 1.4.2.6.2.10
diff -u -r1.4.2.6.2.10 default_records.inc.php
--- setup/default_records.inc.php	24 Feb 2004 22:10:57 -0000	1.4.2.6.2.10
+++ setup/default_records.inc.php	22 Nov 2004 14:30:07 -0000
@@ -179,112 +179,119 @@
 	$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_note_type (description) VALUES ('vcard')");
 	$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_note_type (description) VALUES ('system')");
 
-	$db1 = $oProc;
-	$GLOBALS['phpgw_setup']->oProc->query("SELECT comm_type_id FROM phpgw_contact_comm_type WHERE type='email'"); 
-	while ($GLOBALS['phpgw_setup']->oProc->next_record())
+	$GLOBALS['phpgw_setup']->oProc->query("SELECT comm_type_id FROM phpgw_contact_comm_type WHERE type='email'");
+	$comm_type_ids = $GLOBALS['phpgw_setup']->oProc->m_odb->resultSet->getArray();
+	for($i = 0; $i < count($comm_type_ids); $i++)
 	{
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id']
 			. ",'home email'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'work email'" 
 			.  ")");
 	}
+
 	$GLOBALS['phpgw_setup']->oProc->query("SELECT comm_type_id FROM phpgw_contact_comm_type WHERE type='phone'"); 
-	while ($GLOBALS['phpgw_setup']->oProc->next_record())
+	$comm_type_ids = $GLOBALS['phpgw_setup']->oProc->m_odb->resultSet->getArray();
+	for($i = 0; $i < count($comm_type_ids); $i++)
 	{
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'home phone'"
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'work phone'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'voice phone'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'msg phone'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES ("
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES ("
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'pager'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'bbs'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'modem'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'isdn'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'video'" 
 			.  ")");
 	}
 	$GLOBALS['phpgw_setup']->oProc->query("SELECT comm_type_id FROM phpgw_contact_comm_type WHERE type='fax'"); 
-	while ($GLOBALS['phpgw_setup']->oProc->next_record())
+	$comm_type_ids = $GLOBALS['phpgw_setup']->oProc->m_odb->resultSet->getArray();
+	for($i = 0; $i < count($comm_type_ids); $i++)
 	{
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'home fax'"
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'work fax'" 
 			.  ")");
 	}
 	$GLOBALS['phpgw_setup']->oProc->query("SELECT comm_type_id FROM phpgw_contact_comm_type WHERE type='mobile phone'"); 
-	while ($GLOBALS['phpgw_setup']->oProc->next_record())
+	$comm_type_ids = $GLOBALS['phpgw_setup']->oProc->m_odb->resultSet->getArray();
+	for($i = 0; $i < count($comm_type_ids); $i++)
 	{
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'mobile (cell) phone'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'car phone'" 
 			.  ")");
 	}
 	$GLOBALS['phpgw_setup']->oProc->query("SELECT comm_type_id FROM phpgw_contact_comm_type WHERE type='instant messaging'"); 
-	while ($GLOBALS['phpgw_setup']->oProc->next_record())
+	$comm_type_ids = $GLOBALS['phpgw_setup']->oProc->m_odb->resultSet->getArray();
+	for($i = 0; $i < count($comm_type_ids); $i++)
 	{
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'msn'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'aim'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'yahoo'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'icq'" 
 			.  ")");
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES ("
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES ("
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'jabber'" 
 			.  ")");				
 	}
 	$GLOBALS['phpgw_setup']->oProc->query("SELECT comm_type_id FROM phpgw_contact_comm_type WHERE type='url'"); 
-	while ($GLOBALS['phpgw_setup']->oProc->next_record())
+	$comm_type_ids = $GLOBALS['phpgw_setup']->oProc->m_odb->resultSet->getArray();
+	for($i = 0; $i < count($comm_type_ids); $i++)
 	{
-		$db1->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
-			. $GLOBALS['phpgw_setup']->oProc->f('comm_type_id') 
+		$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_contact_comm_descr (comm_type_id,descr) VALUES (" 
+			. $comm_type_ids[$i]['comm_type_id'] 
 			. ",'website'" 
 			.  ")");
 	}