Index: sandbox/2.5.1-evolucao/phpgwapi/inc/class.db.inc.php
===================================================================
--- sandbox/2.5.1-evolucao/phpgwapi/inc/class.db.inc.php	(revision 1738)
+++ sandbox/2.5.1-evolucao/phpgwapi/inc/class.db.inc.php	(revision 8234)
@@ -209,7 +209,6 @@
 					$GLOBALS[ 'phpgw' ]->ADOdb = NULL;
 				}
-
 				if (!is_object($GLOBALS['phpgw']->ADOdb) ||	// we have no connection so far
-					(is_object($GLOBALS['phpgw']->db) &&	// we connect to a different db, then the global one
+					(isset($GLOBALS['phpgw']->db) && is_object($GLOBALS['phpgw']->db) &&	// we connect to a different db, then the global one
 						($this->Type != $GLOBALS['phpgw']->db->Type ||
 						$this->Database != $GLOBALS['phpgw']->db->Database ||
Index: sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.functions.inc.php
===================================================================
--- sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.functions.inc.php	(revision 8231)
+++ sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.functions.inc.php	(revision 8234)
@@ -48,65 +48,61 @@
 		function check_acl($account_lid, $access)
 		{
-			
-
-			$array_acl =  $this->db_functions->read_acl($account_lid);
-			
+			$array_acl =  $this->db_functions->read_acl($account_lid);		
 			switch($access)
 			{
-				case list_users:
+				case 'list_users':
 					if ($array_acl['acl_add_users'] || $array_acl['acl_edit_users'] || $array_acl['acl_delete_users'] || $array_acl['acl_change_users_password'] || $array_acl['acl_change_users_quote'] || $array_acl['acl_edit_sambausers_attributes'] || $array_acl['acl_view_users'] || $array_acl['acl_manipulate_corporative_information'] || $array_acl['acl_edit_users_phonenumber'] )
 						return true;
 					break;
-				case list_groups:
+				case 'list_groups':
 					if ($array_acl['acl_add_groups'] || $array_acl['acl_edit_groups'] || $array_acl['acl_delete_groups'])
 						return true;
 					break;
-				case list_maillists:
+				case 'list_maillists':
 					if ($array_acl['acl_add_maillists'] || $array_acl['acl_edit_maillists'] || $array_acl['acl_delete_maillists'])
 						return true;
 					break;
-				case list_sectors:
+				case 'list_sectors':
 					if ($array_acl['acl_create_sectors'] || $array_acl['acl_edit_sectors'] || $array_acl['acl_delete_sectors'])
 						return true;
 					break;
-				case list_computers:
+				case 'list_computers':
 					if ($array_acl['acl_create_computers'] || $array_acl['acl_edit_computers'] || $array_acl['acl_delete_computers'])
 						return true;
 					break;
 
-				case display_groups:
+				case 'display_groups':
 					if ( $array_acl['acl_edit_users'] || $array_acl['acl_view_users'] || ($array_acl['acl_edit_sambausers_attributes'] && ($this->current_config['expressoAdmin_samba_support'] == 'true')) )
 						return true;
 					break;
-				case display_emailconfig:
+				case 'display_emailconfig':
 					if ($array_acl['acl_edit_users'] || $array_acl['acl_view_users'])
 						return true;
 					break;
-				case display_applications:
+				case 'display_applications':
 					if ($array_acl['acl_edit_users'] || $array_acl['acl_view_users'])
 						return true;
 					break;
-				case display_emaillists:
+				case 'display_emaillists':
 					if ($array_acl['acl_edit_users'] || $array_acl['acl_view_users'])
 						return true;
 					break;
 
-				case list_institutional_accounts:
+				case 'list_institutional_accounts':
 					if ($array_acl['acl_add_institutional_accounts'] || $array_acl['acl_edit_institutional_accounts'] || $array_acl['acl_delete_institutional_accounts'])
 						return true;
-                                        break;
-                                case list_shared_accounts:
+                    break;
+                case 'list_shared_accounts':
 					if ($array_acl['acl_add_shared_accounts'] || $array_acl['acl_edit_shared_accounts'] || $array_acl['acl_delete_shared_accounts'])
 						return true;
 					break;
-                case configurations:
+                case 'configurations':
 					if ($array_acl['acl_active_blocking_sending_email_to_shared_accounts'] || $array_acl['acl_add_blocking_sending_email_to_shared_accounts_exception'] || $array_acl['acl_edit_and_remove_blocking_sending_email_to_shared_accounts_exception'] || $array_acl['acl_edit_maximum_number_of_recipients_generally'] || $array_acl['acl_add_maximum_number_of_recipients_by_user'] || $array_acl['acl_edit_and_remove_maximum_number_of_recipients_by_user'] || $array_acl['acl_add_maximum_number_of_recipients_by_group'] || $array_acl['acl_edit_and_remove_maximum_number_of_recipients_by_group'])
 						return true;
 					break;
-				case messages_size:
+				case 'messages_size':
 					if($array_acl['acl_add_messages_size_rule'] || $array_acl['acl_edit_messages_size_rule'] || $array_acl['acl_remove_messages_size_rule'])
 						return true;
 					break;
-
 				default:
 					return $array_acl["acl_$access"];
Index: sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.ldap_functions.inc.php
===================================================================
--- sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.ldap_functions.inc.php	(revision 8197)
+++ sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.ldap_functions.inc.php	(revision 8234)
@@ -681,8 +681,8 @@
 		$uid = $params['uid'];
 		$mail = $params['mail'];
-		$mailalternateaddress = $params['mailalternateaddress'];
+		$mailalternateaddress = isset($params['mailalternateaddress']) ? $params['mailalternateaddress'] : '';
 		$cpf = $params['cpf'];
 				
-		if ($_SESSION['phpgw_info']['expresso']['global_denied_users'][$uid])
+		if (isset($_SESSION['phpgw_info']['expresso']['global_denied_users'][$uid]))
 		{
 			$result['status'] = false;
@@ -896,5 +896,5 @@
 				}
 			}
-			else if ($this->current_config['expressoAdmin_cpf_obligation']) 
+			else if (isset($this->current_config['expressoAdmin_cpf_obligation']) && $this->current_config['expressoAdmin_cpf_obligation']) 
 			{
 				$result['status'] = false;
@@ -2175,5 +2175,5 @@
 			$search = ldap_search($this->ldap,$context, $filter, $justthese);
 			$entry = ldap_get_entries($this->ldap, $search);
-			return $entry[0]['associateddomain'][0];
+			return ( ($entry['count'] > 0) ? $entry[0]['associateddomain'][0] : $entry);
         }
 	
