Fix addDomain method

This commit is contained in:
Victor LABORIE 2017-12-14 00:32:58 +01:00
parent 8c91f6ff2a
commit 458685d42f

View file

@ -67,7 +67,7 @@ class LdapServer {
return $this->domains; return $this->domains;
} }
public function addDomain($name,$active=false) { public function addDomain($name,$active='FALSE') {
global $conf; global $conf;
$info["cn"]=$name; $info["cn"]=$name;
$info["objectclass"][0] = ($conf['evoadmin']['version'] == 1) ? 'ldapDomain' : 'postfixDomain'; $info["objectclass"][0] = ($conf['evoadmin']['version'] == 1) ? 'ldapDomain' : 'postfixDomain';
@ -76,10 +76,9 @@ class LdapServer {
$info["isActive"] = $active; $info["isActive"] = $active;
$info["gidNumber"]= getfreegid(); $info["gidNumber"]= getfreegid();
if (ldap_add($this->conn, "cn=".$name.",".LDAP_BASE, $info)) { if (!@ldap_add($this->conn, "cn=".$name.",".LDAP_BASE, $info)) {
return true; $error = ldap_error($this->conn);
} else { throw new Exception("Erreur dans l'ajout du domaine : $error");
return false;
} }
} }