Index: /branches/2.2/expressoAdmin1_2/inc/class.ldap_functions.inc.php
===================================================================
--- /branches/2.2/expressoAdmin1_2/inc/class.ldap_functions.inc.php	(revision 3530)
+++ /branches/2.2/expressoAdmin1_2/inc/class.ldap_functions.inc.php	(revision 4590)
@@ -974,18 +974,11 @@
 	function add_user2maillist($uid, $mail)
 	{
-		if ( !$ldapMasterConnect = $this->ldapMasterConnect() )
-		{
-			$result['status'] = false;
-			$result['msg'] = $this->functions->lang('Ldap connection fail') . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect);
-			return $result;
-		}
-			
 		$filter = "(&(phpgwAccountType=l)(uid=$uid))";
 		$justthese = array("dn");
-		$search = ldap_search($ldapMasterConnect, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese);
-		$entry = ldap_get_entries($ldapMasterConnect, $search);
+		$search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese);
+		$entry = ldap_get_entries($this->ldap, $search);
 		$group_dn = $entry[0]['dn'];
 		$attrs['mailForwardingAddress'] = $mail;
-		$res = @ldap_mod_add($ldapMasterConnect, $group_dn, $attrs);
+		$res = @ldap_mod_add($this->ldap, $group_dn, $attrs);
 		
 		if ($res)
@@ -996,16 +989,16 @@
 		{
 			$result['status'] = false;
-			if (ldap_errno($ldapMasterConnect) == '50')
+			if (ldap_errno($this->ldap) == '50')
 			{
 				$result['msg'] =	$this->functions->lang('Error on the function') . ' ldap_functions->add_user2maillist' . ".\n" .
-									$this->functions->lang('The user used for record on LPDA, must have write access') . ".\n";
+									$this->functions->lang('The user used for record on LDAP, must have write access') . ".\n";
 									$this->functions->lang('The user') . ' ' . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . ' ' . $this->functions->lang('does not have this access') . ".\n";
 									$this->functions->lang('Edit Global Catalog Config, in the admin module, and add an user with write access') . ".\n";
 			}					 
 			else
-				$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->add_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect);
-		}
-		
-		ldap_close($ldapMasterConnect);
+				$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->add_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
+		}
+		
+		ldap_close($this->ldap);
 		return $result;
 	}
@@ -1031,18 +1024,11 @@
 	function remove_user2maillist($uid, $mail)
 	{
-		if ( !$ldapMasterConnect = $this->ldapMasterConnect() )
-		{
-			$result['status'] = false;
-			$result['msg'] = $this->functions->lang('Ldap connection fail') . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect);
-			return $result;
-		}
-		
 		$filter = "(&(phpgwAccountType=l)(uid=$uid))";
 		$justthese = array("dn");
-		$search = ldap_search($ldapMasterConnect, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese);
-		$entry = ldap_get_entries($ldapMasterConnect, $search);
+		$search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese);
+		$entry = ldap_get_entries($this->ldap, $search);
 		$group_dn = $entry[0]['dn'];
 		$attrs['mailForwardingAddress'] = $mail;
-		$res = @ldap_mod_del($ldapMasterConnect, $group_dn, $attrs);
+		$res = @ldap_mod_del($this->ldap, $group_dn, $attrs);
 		
 		if ($res)
@@ -1053,15 +1039,15 @@
 		{
 			$result['status'] = false;
-			if (ldap_errno($ldapMasterConnect) == '50')
+			if (ldap_errno($this->ldap) == '50')
 			{
 				$result['msg'] =	$this->functions->lang('Error on the function') . ' ldap_functions->remove_user2maillist' . ".\n" .
-									$this->functions->lang('The user used for record on LPDA, must have write access') . ".\n";
+									$this->functions->lang('The user used for record on LDAP, must have write access') . ".\n";
 									$this->functions->lang('The user') . ' ' . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . ' ' . $this->functions->lang('does not have this access') . ".\n";
 									$this->functions->lang('Edit Global Catalog Config, in the admin module, and add an user with write access') . ".\n";
 			}					 
 			else
-				$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->remove_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect);
-		}
-		ldap_close($ldapMasterConnect);
+				$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->remove_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
+		}
+		ldap_close($this->ldap);
 		return $result;
 	}
