Index: /trunk/phpgwapi/inc/class.applications.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.applications.inc.php	(revision 2)
+++ /trunk/phpgwapi/inc/class.applications.inc.php	(revision 370)
@@ -275,25 +275,29 @@
 		function read_installed_apps()
 		{
-			$this->db->query('select * from phpgw_applications where app_enabled != 0 order by app_order asc',__LINE__,__FILE__);
-			if($this->db->num_rows())
-			{
-				while ($this->db->next_record())
-				{
-					$title = $app_name = $this->db->f('app_name');
-
-					if (@is_array($GLOBALS['phpgw_info']['user']['preferences']) &&
-					    ($t = lang($app_name)) != $app_name.'*')
+			//jakjr: so vai ao banco, caso o array de apps esteja vazio.
+			if (empty($GLOBALS['phpgw_info']['apps']))
+			{
+				$this->db->query('select * from phpgw_applications where app_enabled != 0 order by app_order asc',__LINE__,__FILE__);
+				if($this->db->num_rows())
+				{
+					while ($this->db->next_record())
 					{
-						$title = $t;
+						$title = $app_name = $this->db->f('app_name');
+
+						if (@is_array($GLOBALS['phpgw_info']['user']['preferences']) &&
+						    ($t = lang($app_name)) != $app_name.'*')
+						{
+							$title = $t;
+						}
+						$GLOBALS['phpgw_info']['apps'][$this->db->f('app_name')] = Array(
+							'title'   => $title,
+							'name'    => $this->db->f('app_name'),
+							'enabled' => True,
+							'status'  => $this->db->f('app_enabled'),
+							'id'      => (int)$this->db->f('app_id'),
+							'order'   => (int)$this->db->f('app_order'),
+							'version' => $this->db->f('app_version')
+						);
 					}
-					$GLOBALS['phpgw_info']['apps'][$this->db->f('app_name')] = Array(
-						'title'   => $title,
-						'name'    => $this->db->f('app_name'),
-						'enabled' => True,
-						'status'  => $this->db->f('app_enabled'),
-						'id'      => (int)$this->db->f('app_id'),
-						'order'   => (int)$this->db->f('app_order'),
-						'version' => $this->db->f('app_version')
-					);
 				}
 			}
Index: /trunk/phpgwapi/inc/class.sessions.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.sessions.inc.php	(revision 2)
+++ /trunk/phpgwapi/inc/class.sessions.inc.php	(revision 370)
@@ -186,4 +186,7 @@
 				$save_rep = True;
 			}
+			
+			// jakjr: ? usando o hardcode, para evitar sempre 2 chamadas ao banco.
+			/*
 			if ($save_rep)
 			{
@@ -199,5 +202,5 @@
 				$config->save_repository();
 				unset($config);
-			}
+			}*/
 		}
 
@@ -493,5 +496,8 @@
 
 			$this->clean_sessions();
-			sessions_::split_login_domain($login,$this->account_lid,$this->account_domain);
+			//sessions_::split_login_domain($login,$this->account_lid,$this->account_domain);
+			// jakjr: allow uid with (@);
+			$this->account_lid = $login;
+			$this->account_domain = 'default';
 
 			$now = time();
@@ -514,8 +520,10 @@
 			}
 
+			/* jakjr: Expresso does not use auto-create account.
 			if (!$this->account_id && $GLOBALS['phpgw_info']['server']['auto_create_acct'] == True)
 			{
 				$this->account_id = $GLOBALS['phpgw']->accounts->auto_add($this->account_lid, $passwd);
 			}
+			*/
 
 			$GLOBALS['phpgw_info']['user']['account_id'] = $this->account_id;
@@ -618,4 +626,5 @@
 					. $sessionid . "'",__LINE__,__FILE__);
 			}
+			/* jakjr: Clean phpgw_access_log with a crontab event.
 			if ($GLOBALS['phpgw_info']['server']['max_access_log_age'])
 			{
@@ -623,5 +632,5 @@
 
 				$GLOBALS['phpgw']->db->query("DELETE FROM phpgw_access_log WHERE li < $max_age");
-			}
+			}*/
 		}
 
@@ -635,4 +644,6 @@
 		function login_blocked($login,$ip)
 		{
+			/*jakjr: Disable this protection. When block an proxy server ip, all the sub-network will be blocking.*/
+			return false;
 			$blocked = False;
 			$block_time = time() - $GLOBALS['phpgw_info']['server']['block_time'] * 60;
Index: /trunk/phpgwapi/inc/class.errorlog.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.errorlog.inc.php	(revision 189)
+++ /trunk/phpgwapi/inc/class.errorlog.inc.php	(revision 370)
@@ -104,4 +104,6 @@
 		function commit()
 		{
+			// jakjr: where I disable the log event.
+			return true;
 			$db = $GLOBALS['phpgw']->db;
 //			$db->lock('phpgw_log');
Index: /trunk/phpgwapi/inc/class.config.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.config.inc.php	(revision 2)
+++ /trunk/phpgwapi/inc/class.config.inc.php	(revision 370)
@@ -74,8 +74,9 @@
 			{
 				$this->db->lock(array('phpgw_config','phpgw_app_sessions'));
+				/*jakjr: ExpressoLivre does not use this.
 				if($this->appname == 'phpgwapi')
 				{
 					$this->db->query("delete from phpgw_app_sessions where sessionid = '0' and loginid = '0' and app = '".$this->appname."' and location = 'config'",__LINE__,__FILE__);
-				}
+				}*/
 				foreach($this->config_data as $name => $value)
 				{
Index: /trunk/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php
===================================================================
--- /trunk/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php	(revision 34)
+++ /trunk/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php	(revision 370)
@@ -679,4 +679,7 @@
 		}
 		if ($this->_connectionID === false) return false;
+		$this->_nestedSQL = true;
+		
+		/* jakjr: I really do not know why this is executed.
 		$this->Execute("set datestyle='ISO'");
 		
@@ -686,4 +689,5 @@
 			$this->_nestedSQL = true;
 		}
+		*/
 		return true;
 	}
Index: /trunk/phpgwapi/inc/functions.inc.php
===================================================================
--- /trunk/phpgwapi/inc/functions.inc.php	(revision 266)
+++ /trunk/phpgwapi/inc/functions.inc.php	(revision 370)
@@ -162,4 +162,6 @@
 	}
 	$GLOBALS['phpgw']->db->Halt_On_Error = 'no';
+	/* jakjr: ExpressoLivre: We do not count the config table. */
+	if (!
 	$GLOBALS['phpgw']->db->connect(
 		$GLOBALS['phpgw_info']['server']['db_name'],
@@ -169,10 +171,11 @@
 		$GLOBALS['phpgw_info']['server']['db_pass'],
 		$GLOBALS['phpgw_info']['server']['db_type']
-	);
-	@$GLOBALS['phpgw']->db->query("SELECT COUNT(config_name) FROM phpgw_config");
-	if(!@$GLOBALS['phpgw']->db->next_record())
-	{
-		$setup_dir = str_replace($_SERVER['PHP_SELF'],'index.php','setup/');
+	) )
+	//@$GLOBALS['phpgw']->db->query("SELECT COUNT(config_name) FROM phpgw_config");
+	//if(!@$GLOBALS['phpgw']->db->next_record())
+	{
+		
 		/* BEGIN - CELEPAR - jakjr - 05/06/2006 */
+		/* $setup_dir = str_replace($_SERVER['PHP_SELF'],'index.php','setup/'); */
 		/*echo '<center><b>Fatal Error:</b> It appears that you have not created the database tables for '
 			.'eGroupWare.  Click <a href="' . $setup_dir . '">here</a> to run setup.</center>';*/
@@ -185,4 +188,6 @@
 	/* Fill phpgw_info["server"] array */
 	// An Attempt to speed things up using cache premise
+	/* jakjr: ExpressoLivre does not use cache. */
+	/*
 	$GLOBALS['phpgw']->db->query("select config_value from phpgw_config WHERE config_app='phpgwapi' and config_name='cache_phpgw_info'",__LINE__,__FILE__);
 	if ($GLOBALS['phpgw']->db->num_rows())
@@ -190,6 +195,8 @@
 		$GLOBALS['phpgw']->db->next_record();
 		$GLOBALS['phpgw_info']['server']['cache_phpgw_info'] = stripslashes($GLOBALS['phpgw']->db->f('config_value'));
-	}
-
+	}*/
+
+	/* jakjr: ExpressoLivre does not use cache. */
+	/*	
 	$cache_query = "select content from phpgw_app_sessions where"
 		." sessionid = '0' and loginid = '0' and app = 'phpgwapi' and location = 'config'";
@@ -197,5 +204,6 @@
 	$GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__);
 	$server_info_cache = $GLOBALS['phpgw']->db->num_rows();
-
+	*/
+	/*
 	if(@$GLOBALS['phpgw_info']['server']['cache_phpgw_info'] && $server_info_cache)
 	{
@@ -204,6 +212,6 @@
 	}
 	else
-	{
-		$GLOBALS['phpgw']->db->query("select * from phpgw_config WHERE config_app='phpgwapi'",__LINE__,__FILE__);
+	{*/
+		$GLOBALS['phpgw']->db->query("SELECT * from phpgw_config WHERE config_app='phpgwapi'",__LINE__,__FILE__);
 		while ($GLOBALS['phpgw']->db->next_record())
 		{
@@ -211,4 +219,5 @@
 		}
 
+		/*
 		if(@isset($GLOBALS['phpgw_info']['server']['cache_phpgw_info']))
 		{
@@ -221,6 +230,6 @@
 				. "'0','0','phpgwapi','config','".addslashes(serialize($GLOBALS['phpgw_info']['server']))."')";
 			$GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__);
-		}
-	}
+		}*/
+	//}
 	unset($cache_query);
 	unset($server_info_cache);
Index: /trunk/phpgwapi/inc/class.hooks.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.hooks.inc.php	(revision 2)
+++ /trunk/phpgwapi/inc/class.hooks.inc.php	(revision 370)
@@ -41,12 +41,16 @@
 			$this->db = $db ? $db : $GLOBALS['phpgw']->db;	// this is to allow setup to set the db
 
-			$this->db->query("SELECT hook_appname, hook_location, hook_filename FROM phpgw_hooks",__LINE__,__FILE__);
-			while( $this->db->next_record() )
-			{
-				$this->found_hooks[$this->db->f('hook_appname')][$this->db->f('hook_location')] = $this->db->f('hook_filename');
-			}
-			//echo '<pre>';
-			//print_r($this->found_hooks);
-			//echo '</pre>';
+			//jakjr: Go search in DB, only if the array is empty.
+			if (empty($this->found_hooks))
+			{
+				$this->db->query("SELECT hook_appname, hook_location, hook_filename FROM phpgw_hooks",__LINE__,__FILE__);
+				while( $this->db->next_record() )
+				{
+					$this->found_hooks[$this->db->f('hook_appname')][$this->db->f('hook_location')] = $this->db->f('hook_filename');
+				}
+				//echo '<pre>';
+				//print_r($this->found_hooks);
+				//echo '</pre>';
+			}
 		}
 		
