Index: /sandbox/2.5.1-evolucao/phpgwapi/inc/class.db.inc.php
===================================================================
--- /sandbox/2.5.1-evolucao/phpgwapi/inc/class.db.inc.php	(revision 8235)
+++ /sandbox/2.5.1-evolucao/phpgwapi/inc/class.db.inc.php	(revision 8237)
@@ -1008,5 +1008,5 @@
 			if (!$column_definitions)
 			{
-				$column_definitions = $this->column_definitions;
+				$column_definitions = isset($this->column_definitions) ? $this->column_definitions : NULL;
 			}
 			if ($this->Debug) echo "<p>db::column_data_implode('$glue',".print_r($array,True).",'$use_key',".print_r($only,True).",<pre>".print_r($column_definitions,True)."</pre>\n";
@@ -1077,5 +1077,5 @@
 			if (!$app)
 			{
-				$app = $this->app ? $this->app : $GLOBALS['phpgw_info']['flags']['currentapp'];
+				$app = isset($this->app) && $this->app  ? $this->app : $GLOBALS['phpgw_info']['flags']['currentapp'];
 			}
 			if (isset($GLOBALS['phpgw_info']['apps']))	// dont set it, if it does not exist!!!
Index: /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.db_functions.inc.php
===================================================================
--- /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.db_functions.inc.php	(revision 8236)
+++ /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.db_functions.inc.php	(revision 8237)
@@ -350,5 +350,5 @@
 					$user_app[] = $this->db->row();
 					
-				if (count($user_app) == 0)
+				if (isset($user_app) && count($user_app) == 0)
 				{
 					$sql = "INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) "
@@ -411,4 +411,5 @@
 	function get_user_info($uidnumber)
 	{
+		$user_app = array();
 		// Groups
 		$query = "SELECT acl_location FROM phpgw_acl WHERE acl_appname = 'phpgw_group' AND acl_account = '".$uidnumber."'";
@@ -424,7 +425,8 @@
 		$query = "SELECT acl_rights FROM phpgw_acl WHERE acl_appname = 'preferences' AND acl_location = 'changepassword' AND acl_account = '".$uidnumber."'";
 		$this->db->query($query);
+		$changepassword = array();
 		while($this->db->next_record())
 			$changepassword[] = $this->db->row();
-		$return['changepassword'] = $changepassword[0]['acl_rights'];
+		$return['changepassword'] = isset($changepassword[0]) ? $changepassword[0]['acl_rights'] : '';
 		
 		// Apps
@@ -434,5 +436,5 @@
 			$user_apps[] = $this->db->row();
 			
-		if ($user_apps)
+		if (isset($user_apps) && $user_apps)
 		{			
 			foreach ($user_apps as $app)
@@ -538,4 +540,5 @@
 	function delete_user($user_info)
 	{
+		$ids = array();
 		// AGENDA
 		$this->db->query('SELECT calendar_id FROM calendar_signature WHERE user_uidnumber ='.$user_info['uidnumber'] . ' AND is_owner = 1' );
@@ -723,5 +726,5 @@
 		while($this->db->next_record())
 			$result[] = $this->db->row();
-		if (count($result) > 0)
+		if (isset($result) && count($result) > 0)
 			return true;
 		else
@@ -839,5 +842,5 @@
                 $this->db->select('phpgw_acl', $colunas, $where, null, null);
 
-                $return;
+                $return = array();
 
                 include_once 'class.ldap_functions.inc.php';
Index: /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.user.inc.php
===================================================================
--- /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.user.inc.php	(revision 8236)
+++ /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.user.inc.php	(revision 8237)
@@ -941,5 +941,5 @@
 				return false;
 			$user_info_db1 = $this->db_functions->get_user_info($uidnumber);
-			$user_info_db2 = $this->ldap_functions->gidnumbers2cn($user_info_db1['groups']);
+			$user_info_db2 = $this->ldap_functions->gidnumbers2cn(isset($user_info_db1['groups'])?$user_info_db1['groups']:'');
 			$user_info_imap = $this->imap_functions->get_user_info($user_info_ldap['uid']);
 			$user_info = array_merge($user_info_ldap, $user_info_db1, $user_info_db2, $user_info_imap);
@@ -991,4 +991,5 @@
 		function delete($params)
 		{
+			$return['msg'] = '';
 			$return['status'] = true;
 			$this->db_functions->write_log('delete user: start', $params['uid']);
Index: /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.somessages_size.inc.php
===================================================================
--- /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.somessages_size.inc.php	(revision 7655)
+++ /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.somessages_size.inc.php	(revision 8237)
@@ -10,6 +10,6 @@
 	\***********************************************************************************/
 
-define('PHPGW_INCLUDE_ROOT','../');	
-define('PHPGW_API_INC','../phpgwapi/inc');
+if (!defined('PHPGW_INCLUDE_ROOT')) define('PHPGW_INCLUDE_ROOT','../'); 
+if (!defined('PHPGW_API_INC')) define('PHPGW_API_INC','../phpgwapi/inc');
 include_once(PHPGW_API_INC.'/class.db.inc.php');
 
Index: /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.shared_accounts.inc.php
===================================================================
--- /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.shared_accounts.inc.php	(revision 7934)
+++ /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.shared_accounts.inc.php	(revision 8237)
@@ -123,5 +123,5 @@
                         $return = $this->ldap_functions->get_shared_account_data($params);
                         $owners_acl = $this->imap_functions->getaclfrombox($params);
-			$uid = $params['uid'];
+			            $uid = $params['uid'];
                         $quota = $this->imap_functions->get_user_info($params['uid']);
                         $owner = $this->ldap_functions->uid2uidnumber($params['uid']);
@@ -142,9 +142,12 @@
 					if( $uid )
 					    $cn .= '(' . $key . ')';
-
-			                $return['owners_options'] .= '<option value='. $key .'>' . $cn . '</option>';
+                            if (!isset($return['owners_options'])) $return['owners_options'] = '';
+                            if (!isset($return['owners'][$i])) $return['owners'][$i] = '';
+                            if (!isset($return['owners_acl'][$i])) $return['owners_acl'][$i] = '';
+                            if (!isset($return['owners_calendar_acl'][$i])) $return['owners_calendar_acl'][$i] = '';
+                            $return['owners_options'] .= '<option value='. $key .'>' . $cn . '</option>';
 	                                $return['owners'][$i] .= $key;
 	                                $return['owners_acl'][$i] .= $value;
-                                        $return['owners_calendar_acl'][$i] .= $calendarAcls[$key];
+                                        $return['owners_calendar_acl'][$i] .= isset($calendarAcls[$key]) ? $calendarAcls[$key] : '';
 	                                ++$i;
 	                        }
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 8236)
+++ /sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.ldap_functions.inc.php	(revision 8237)
@@ -315,15 +315,15 @@
 		$info['mail']				= $params['mail'];
 		
-		if ($params['accountStatus'] == 'on')
+		if (isset($params['accountStatus']) && $params['accountStatus'] == 'on')
 			$info['accountStatus'] = 'active';
 		else
 			$info['accountStatus'] = array();
 		
-		if ($params['phpgwAccountVisible'] == 'on')
+		if (isset($params['phpgwAccountVisible']) && $params['phpgwAccountVisible'] == 'on')
 			$info['phpgwAccountVisible'] = '-1';
 		else
 			$info['phpgwAccountVisible'] = array();
 		
-		if ($params['desc'] != '')
+		if (isset($params['desc']) && $params['desc'] != '')
 			$info['description'] = utf8_encode($params['desc']);
 		else
@@ -439,5 +439,5 @@
 		$del = array();
 
-		if( $params['mailalternateaddress'] )
+		if( isset($params['mailalternateaddress']) && $params['mailalternateaddress'] )
 			$info['mailalternateaddress'] = $params['mailalternateaddress'];
 		else
@@ -449,5 +449,5 @@
 			$info['accountStatus'] = array();
 		
-		if ($params['phpgwAccountVisible'] == 'on')
+		if (isset($params['phpgwAccountVisible']) && $params['phpgwAccountVisible'] == 'on')
 			$info['phpgwAccountVisible'] = '-1';
 		else
@@ -1612,4 +1612,5 @@
 				$sector_dn_array = explode(",", $entry[0]['dn']);
                 $sector_dn_array_count = count($sector_dn_array);
+				$sector_dn = '';
 				for($i=1; $i<$sector_dn_array_count; ++$i)
 					$sector_dn .= $sector_dn_array[$i] . ',';
@@ -1621,7 +1622,136 @@
 				$result['uidnumber']			= $entry[0]['uidnumber'][0];
 				$result['gidnumber']			= $entry[0]['gidnumber'][0];
+				$result['departmentnumber']		= isset($entry[0]['departmentnumber']) ? $entry[0]['departmentnumber'][0] : '';
+				$result['givenname']			= $entry[0]['givenname'][0];
+				$result['sn']					= utf8_decode($entry[0]['sn'][0]);
+				$result['telephonenumber']		= isset($entry[0]['telephonenumber']) ? $entry[0]['telephonenumber'][0] : '';
+				$result['passwd_expired']		= isset($entry[0]['phpgwlastpasswdchange']) ? $entry[0]['phpgwlastpasswdchange'][0] : '';
+				$result['phpgwaccountstatus']	= $entry[0]['phpgwaccountstatus'][0];
+				$result['phpgwaccountvisible']	= isset($entry[0]['phpgwaccountvisible']) ? $entry[0]['phpgwaccountvisible'][0] : '';
+				$result['accountstatus']		= $entry[0]['accountstatus'][0];
+				$result['mail']					= $entry[0]['mail'][0];
+				$result['mailalternateaddress']	= isset($entry[0]['mailalternateaddress']) ? $entry[0]['mailalternateaddress'] : '';
+				$result['mailforwardingaddress']= isset($entry[0]['mailforwardingaddress']) ? $entry[0]['mailforwardingaddress'] : '';
+				$result['deliverymode']			= isset($entry[0]['deliverymode']) ? $entry[0]['deliverymode'][0] : '';
+				$result['userPasswordRFC2617']	= isset($entry[0]['userpasswordrfc2617']) ? $entry[0]['userpasswordrfc2617'][0] : '';
+
+				//Photo
+				if (isset($entry[0]['jpegphoto']) && $entry[0]['jpegphoto']['count'] == 1)
+					$result['photo_exist'] = 'true';
+		
+				// Samba
+				for ($i=0; $i<$entry[0]['objectclass']['count']; ++$i)
+				{
+					if ($entry[0]['objectclass'][$i] == 'sambaSamAccount')
+						$result['sambaUser'] = true;
+				}
+				if (($this->current_config['expressoAdmin_samba_support'] == 'true') && ($result['sambaUser']))
+				{
+					$result['sambaaccflags'] = $entry[0]['sambaacctflags'][0];
+					$result['sambalogonscript'] = $entry[0]['sambalogonscript'][0];
+					$result['homedirectory'] = $entry[0]['homedirectory'][0];
+					$a_tmp = explode("-", $entry[0]['sambasid'][0]);
+					array_pop($a_tmp);
+					$result['sambasid'] = implode("-", $a_tmp);
+				}
+
+				// Verifica o acesso do gerente aos atributos corporativos
+				if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information'))
+				{
+					$result['corporative_information_employeenumber']= isset($entry[0]['employeenumber']) ? $entry[0]['employeenumber'][0] : '';
+					$result['corporative_information_cpf']			= isset($entry[0]['cpf']) ? $entry[0]['cpf'][0] : '';
+					$result['corporative_information_rg']			= isset($entry[0]['rg']) ? $entry[0]['rg'][0] : '';
+					$result['corporative_information_rguf']			= isset($entry[0]['rguf']) ? $entry[0]['rguf'][0] : '';
+					$result['corporative_information_description']	= isset($entry[0]['description']) ? utf8_decode($entry[0]['description'][0]) : '';
+				}
+				
+				// MailLists
+				$result['maillists_info'] = $this->get_user_maillists($result['mail']);
+				if($result['maillists_info'])
+				{
+					foreach ($result['maillists_info'] as $maillist)
+					{
+						$result['maillists'][] = $maillist['uid'];
+					}
+				}
+				
+				// Groups
+				$justthese = array("gidnumber","cn");
+				$filter="(&(phpgwAccountType=g)(memberuid=".$result['uid']."))";
+				$search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese);
+    			ldap_sort($this->ldap, $search, "cn");
+    			$entries = ldap_get_entries($this->ldap, $search);
+    			for ($i=0; $i<$entries['count']; ++$i)
+	    		{
+    				$result['groups_ldap'][ $entries[$i]['gidnumber'][0] ] = utf8_decode($entries[$i]['cn'][0]);
+    			}
+			}
+		}
+		if (is_array($result))
+			return $result;
+		else
+			return false;
+	}
+
+
+        function get_user_cn_by_uid($uid)
+	{
+            foreach ($this->manager_contexts as $index=>$context)
+            {
+
+                    $justthese = array("cn");
+                    $filter="(&(phpgwAccountType=u)(uid=".$uid."))";
+                    $search = ldap_search($this->ldap, $context, $filter, $justthese);
+                    $entry = ldap_get_entries($this->ldap, $search);
+                    if($entry)
+                        return utf8_decode($entry[0]['cn'][0]);
+            }
+            return null;
+	}
+
+        function get_group_cn_by_gidnumber($gidnumber)
+	{
+            foreach ($this->manager_contexts as $index=>$context)
+		{
+		
+                    $justthese = array("cn");
+                    $filter="(&(phpgwAccountType=g)(gidNumber=".$gidnumber."))";
+                    $search = ldap_search($this->ldap, $context, $filter, $justthese);
+                    $entry = ldap_get_entries($this->ldap, $search);
+                    if($entry)
+                        return utf8_decode($entry[0]['cn'][0]);
+			}
+            return null;
+		}
+		
+	
+        function get_user_info_by_uid($uid)
+	{
+		foreach ($this->manager_contexts as $index=>$context)
+		{
+			$filter="(&(phpgwAccountType=u)(uid=".$uid."))";
+                        $justthese = array("cn");
+			$search = ldap_search($this->ldap, $context, $filter);
+			$entry = ldap_get_entries($this->ldap, $search);
+			
+			if ($entry['count'])
+			{
+				//Pega o dn do setor do usuario.
+				$entry[0]['dn'] = strtolower($entry[0]['dn']);
+				$sector_dn_array = explode(",", $entry[0]['dn']);
+                $sector_dn_array_count = count($sector_dn_array);
+				for($i=1; $i<$sector_dn_array_count; ++$i)
+					$sector_dn .= $sector_dn_array[$i] . ',';
+				//Retira ultimo pipe.
+				$sector_dn = substr($sector_dn,0,(strlen($sector_dn) - 1));
+		
+				$result['context']				= $sector_dn;
+				$result['uid']					= $entry[0]['uid'][0];
+                                $result['cn']					= utf8_decode($entry[0]['cn'][0]);
+				$result['uidnumber']			= $entry[0]['uidnumber'][0];
+				$result['gidnumber']			= $entry[0]['gidnumber'][0];
 				$result['departmentnumber']		= $entry[0]['departmentnumber'][0];
 				$result['givenname']			= $entry[0]['givenname'][0];
-				$result['sn']					= utf8_decode($entry[0]['sn'][0]);
+				$result['sn']					= $entry[0]['sn'][0];
 				$result['telephonenumber']		= $entry[0]['telephonenumber'][0];
 				$result['passwd_expired']		= $entry[0]['phpgwlastpasswdchange'][0];
@@ -1692,133 +1822,4 @@
 			return false;
 	}
-
-
-        function get_user_cn_by_uid($uid)
-	{
-            foreach ($this->manager_contexts as $index=>$context)
-            {
-
-                    $justthese = array("cn");
-                    $filter="(&(phpgwAccountType=u)(uid=".$uid."))";
-                    $search = ldap_search($this->ldap, $context, $filter, $justthese);
-                    $entry = ldap_get_entries($this->ldap, $search);
-                    if($entry)
-                        return utf8_decode($entry[0]['cn'][0]);
-            }
-            return null;
-	}
-
-        function get_group_cn_by_gidnumber($gidnumber)
-	{
-            foreach ($this->manager_contexts as $index=>$context)
-		{
-		
-                    $justthese = array("cn");
-                    $filter="(&(phpgwAccountType=g)(gidNumber=".$gidnumber."))";
-                    $search = ldap_search($this->ldap, $context, $filter, $justthese);
-                    $entry = ldap_get_entries($this->ldap, $search);
-                    if($entry)
-                        return utf8_decode($entry[0]['cn'][0]);
-			}
-            return null;
-		}
-		
-	
-        function get_user_info_by_uid($uid)
-	{
-		foreach ($this->manager_contexts as $index=>$context)
-		{
-			$filter="(&(phpgwAccountType=u)(uid=".$uid."))";
-                        $justthese = array("cn");
-			$search = ldap_search($this->ldap, $context, $filter);
-			$entry = ldap_get_entries($this->ldap, $search);
-			
-			if ($entry['count'])
-			{
-				//Pega o dn do setor do usuario.
-				$entry[0]['dn'] = strtolower($entry[0]['dn']);
-				$sector_dn_array = explode(",", $entry[0]['dn']);
-                $sector_dn_array_count = count($sector_dn_array);
-				for($i=1; $i<$sector_dn_array_count; ++$i)
-					$sector_dn .= $sector_dn_array[$i] . ',';
-				//Retira ultimo pipe.
-				$sector_dn = substr($sector_dn,0,(strlen($sector_dn) - 1));
-		
-				$result['context']				= $sector_dn;
-				$result['uid']					= $entry[0]['uid'][0];
-                                $result['cn']					= utf8_decode($entry[0]['cn'][0]);
-				$result['uidnumber']			= $entry[0]['uidnumber'][0];
-				$result['gidnumber']			= $entry[0]['gidnumber'][0];
-				$result['departmentnumber']		= $entry[0]['departmentnumber'][0];
-				$result['givenname']			= $entry[0]['givenname'][0];
-				$result['sn']					= $entry[0]['sn'][0];
-				$result['telephonenumber']		= $entry[0]['telephonenumber'][0];
-				$result['passwd_expired']		= $entry[0]['phpgwlastpasswdchange'][0];
-				$result['phpgwaccountstatus']	= $entry[0]['phpgwaccountstatus'][0];
-				$result['phpgwaccountvisible']	= $entry[0]['phpgwaccountvisible'][0];
-				$result['accountstatus']		= $entry[0]['accountstatus'][0];
-				$result['mail']					= $entry[0]['mail'][0];
-				$result['mailalternateaddress']	= $entry[0]['mailalternateaddress'];
-				$result['mailforwardingaddress']= $entry[0]['mailforwardingaddress'];
-				$result['deliverymode']			= $entry[0]['deliverymode'][0];
-				$result['userPasswordRFC2617']	= $entry[0]['userpasswordrfc2617'][0];
-
-				//Photo
-				if ($entry[0]['jpegphoto']['count'] == 1)
-					$result['photo_exist'] = 'true';
-		
-				// Samba
-				for ($i=0; $i<$entry[0]['objectclass']['count']; ++$i)
-				{
-					if ($entry[0]['objectclass'][$i] == 'sambaSamAccount')
-						$result['sambaUser'] = true;
-				}
-				if (($this->current_config['expressoAdmin_samba_support'] == 'true') && ($result['sambaUser']))
-				{
-					$result['sambaaccflags'] = $entry[0]['sambaacctflags'][0];
-					$result['sambalogonscript'] = $entry[0]['sambalogonscript'][0];
-					$result['homedirectory'] = $entry[0]['homedirectory'][0];
-					$a_tmp = explode("-", $entry[0]['sambasid'][0]);
-					array_pop($a_tmp);
-					$result['sambasid'] = implode("-", $a_tmp);
-				}
-
-				// Verifica o acesso do gerente aos atributos corporativos
-				if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information'))
-				{
-					$result['corporative_information_employeenumber']= $entry[0]['employeenumber'][0];
-					$result['corporative_information_cpf']			= $entry[0]['cpf'][0];
-					$result['corporative_information_rg']			= $entry[0]['rg'][0];
-					$result['corporative_information_rguf']			= $entry[0]['rguf'][0];
-					$result['corporative_information_description']	= utf8_decode($entry[0]['description'][0]);
-				}
-				
-				// MailLists
-				$result['maillists_info'] = $this->get_user_maillists($result['mail']);
-				if($result['maillists_info'])
-				{
-					foreach ($result['maillists_info'] as $maillist)
-					{
-						$result['maillists'][] = $maillist['uid'];
-					}
-				}
-				
-				// Groups
-				$justthese = array("gidnumber","cn");
-				$filter="(&(phpgwAccountType=g)(memberuid=".$result['uid']."))";
-				$search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese);
-    			ldap_sort($this->ldap, $search, "cn");
-    			$entries = ldap_get_entries($this->ldap, $search);
-    			for ($i=0; $i<$entries['count']; ++$i)
-	    		{
-    				$result['groups_ldap'][ $entries[$i]['gidnumber'][0] ] = utf8_decode($entries[$i]['cn'][0]);
-    			}
-			}
-		}
-		if (is_array($result))
-			return $result;
-		else
-			return false;
-	}
 		
 	function get_user_maillists($mail)
@@ -1847,5 +1848,5 @@
 		}
     	
-    	if($a_tmp) {
+    	if(isset($a_tmp) && $a_tmp) {
     		natcasesort($a_tmp);
     	
@@ -1857,5 +1858,5 @@
     	}
     	ldap_close($ldapMasterConnect);
-		return $return;
+		return (isset($return) ? $return : array());
 	}
 	
@@ -2107,11 +2108,11 @@
 				
 				$entry = ldap_get_entries($this->ldap, $search);
-				if ($entry['count'] == 0)
+				if (isset($entry) && $entry['count'] == 0)
 					$result['groups_info'][$i]['cn'] = '_' . $this->functions->lang('group only exist on DB, but does not exist on ldap');
 					
 				else
 				{
-					$result['groups_info'][$i]['uid'] = $entry[0]['uid'][0];
-					$result['groups_info'][$i]['cn'] = $entry[0]['cn'][0];
+					$result['groups_info'][$i]['uid'] = isset($entry[0]['uid']) ? $entry[0]['uid'][0] : '';
+					$result['groups_info'][$i]['cn'] = isset($entry[0]['cn']) ? $entry[0]['cn'][0] : '';
 				}
 				$result['groups_info'][$i]['gidnumber'] = $gidnumber;
@@ -2273,5 +2274,5 @@
 		$attrs['memberuid'] = $user_info['uid'];
 		
-		if (count($user_info['groups_info']))
+		if (isset($user_info['groups_info']) && count($user_info['groups_info']))
 		{
 			foreach ($user_info['groups_info'] as $group_info)
@@ -2374,6 +2375,8 @@
 		for ($i=0; $i<=$entry['count']; ++$i)
 	    {
-			$dn = $entry[$i]['dn'];
-	    	@ldap_mod_del ( $this->ldap, $dn,  $attrs);
+			if (isset($entry[$i])){
+				$dn = $entry[$i]['dn'];
+		    	@ldap_mod_del ( $this->ldap, $dn,  $attrs);
+		    }	
 	    }
 		
@@ -2816,10 +2819,10 @@
 			$return['accountStatus']		= $entrie[0]['accountstatus'][0];
 
-			$return['phpgwAccountVisible']	= $entrie[0]['phpgwaccountvisible'][0];
+			$return['phpgwAccountVisible']	= isset($entrie[0]['phpgwaccountvisible']) ? $entrie[0]['phpgwaccountvisible'][0] : '';
 			$return['cn']			= utf8_decode($entrie[0]['cn'][0]);
 			$return['mail']					= $entrie[0]['mail'][0];
 			$return['description']			= utf8_decode($entrie[0]['description'][0]);
 			$return['dn']			= utf8_decode($entrie[0]['dn']);
-			$return['mailalternateaddress']	= $entrie[0]['mailalternateaddress'];
+			$return['mailalternateaddress']	= isset($entrie[0]['mailalternateaddress']) ? $entrie[0]['mailalternateaddress'] : '';
 		}
 		
