Fix alias update
This commit is contained in:
parent
a962f20bec
commit
76a18d5bc4
|
@ -12,7 +12,7 @@ include('inc/haut.php');
|
|||
include('inc/debut.php');
|
||||
|
||||
if (!empty($_POST['cn'])) {
|
||||
$cn = Html::clean(Html::purgeaccents(utf8_decode($_POST['cn'])));
|
||||
$cn = (!empty($_GET['alias'])) ? $alias->getName() : Html::clean(Html::purgeaccents(utf8_decode($_POST['cn'])));
|
||||
$actif = (!empty($_POST['isactive'])) ? true : false;
|
||||
$mailaccept = array_filter($_POST['mailaccept'], function($value) {
|
||||
if (!empty($value)) {
|
||||
|
@ -54,7 +54,9 @@ if (isset($_GET['alias'])) {
|
|||
print "<center>";
|
||||
print '<h4>Modification de l\'alias '.$alias->getName().'</h4>';
|
||||
|
||||
print '<form name="add" action="alias.php?domain='.$domain->getName().'&alias='.$alias->getName().'&modif=yes" method="post">';
|
||||
print '<form name="add" action="alias.php?domain='.$domain->getName().'&alias='.$alias->getName().'" method="post">';
|
||||
|
||||
print '<input type="hidden" name="cn" value="'.$alias->getName().'"/>';
|
||||
|
||||
print "<table>";
|
||||
|
||||
|
|
|
@ -23,6 +23,19 @@ class LdapAlias extends LdapDomain {
|
|||
public function isActive() {
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function update($active=false,$mailaccept=array(),$maildrop=array()) {
|
||||
$info["isActive"] = ($active) ? 'TRUE' : 'FALSE';
|
||||
$info["mailacceptinggeneralid"] = $mailaccept;
|
||||
$info["maildrop"] = array_filter($maildrop, function($value) {
|
||||
return filter_var($value, FILTER_VALIDATE_EMAIL);
|
||||
});
|
||||
|
||||
if (!@ldap_mod_replace($this->conn, "cn=".$this->getName().",cn=".$this->domain.",".LDAP_BASE, $info)) {
|
||||
$error = ldap_error($this->conn);
|
||||
throw new Exception("Erreur pendant la modification de l'alias : $error");
|
||||
}
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
|
|
Loading…
Reference in a new issue