conn = $domain->conn; $this->domain = $domain->getName(); $this->uid = $uid; if ($sr = @ldap_search($this->conn, "uid=".$uid.",cn=".$this->domain.",".LDAP_BASE, "(ObjectClass=mailAccount)")) { $objects = ldap_get_entries($this->conn, $sr); $object = $objects[0]; $this->name = $object['cn'][0]; $this->active = ($object['isactive'][0] == 'TRUE') ? true : false; $this->admin = ($object['isadmin'][0] == 'TRUE') ? true : false; $this->courier = ($object['courieractive'][0] == 'TRUE') ? true : false; $this->authsmtp = ($object['authsmtpactive'][0] == 'TRUE') ? true : false; //$this->quota = getquota($this->domain,'user'); } else { throw new Exception("Ce compte n'existe pas !"); } } public function update($name=NULL,$password=NULL,$active=NULL,$admin=NULL,$accountactive=NULL,$courieractive=NULL,$webmailactive=NULL,$authsmtpactive=NULL,$amavisBypassSpamChecks=NULL) { $info["cn"] = (!empty($name)) ? $name : $this->name; if (!empty($password)) { $info["userPassword"] = $password; } $info["isActive"] = ($active) ? 'TRUE' : 'FALSE'; $info["isAdmin"] = ($admin) ? 'TRUE' : 'FALSE'; $info["accountActive"] = ($accountactive) ? 'TRUE' : 'FALSE'; $info["courierActive"] = ($courieractive) ? 'TRUE' : 'FALSE'; $info["webmailActive"] = ($webmailactive) ? 'TRUE' : 'FALSE'; $info["authsmtpActive"] = ($authsmtpactive) ? 'TRUE' : 'FALSE'; #$info["amavisBypassSpamChecks"] = ($amavisBypassSpamChecks) ? 'TRUE' : 'FALSE'; if (!ldap_mod_replace($this->conn, "uid=".$this->uid.",cn=".$this->domain.",".LDAP_BASE, $info)) { $error = ldap_error($this->conn); throw new Exception("Erreur pendant la modification du compte : $error"); } } public function isActive() { return $this->active; } public function isAdmin() { return $this->admin; } public function getUid() { return $this->uid; } public function getName() { return $this->name; } public function getAliases() { return array(); } public function getRedirections() { return array(); } public function isCourier() { return $this->courier; } public function isAuthSmtp() { return $this->authsmtp; } public function __destruct() { return true; } }