Add method for enable/disable a domain
This commit is contained in:
parent
73b1e5e1e1
commit
47b616ee8a
|
@ -38,11 +38,28 @@ if (!empty($_POST['delete'])) {
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($_POST['isactive'])) {
|
||||||
|
$active = ($_POST['isactive'] == "TRUE") ? true : false;
|
||||||
|
try {
|
||||||
|
$domain->update($active);
|
||||||
|
header('Location: admin.php?domain='.$domain->getName());
|
||||||
|
} catch (Exception $e) {
|
||||||
|
print '<div class="alert alert-danger" role="alert">'.$e->getMessage().'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<a href="compte.php?domain=<?php print $domain->getName() ?>"><button class="btn btn-primary">Ajouter un nouveau compte</button></a>
|
<?php
|
||||||
|
print '<form name="update" method="post" action="admin.php?domain='.$domain->getName().'">';
|
||||||
|
if (!$domain->isactive()) {
|
||||||
|
print '<button type="submit" name="isactive" value="TRUE" class="btn btn-primary">Activer le domaine</button> ';
|
||||||
|
} else {
|
||||||
|
print '<button type="submit" name="isactive" value="FALSE" class="btn btn-primary">Désactiver le domaine</button> ';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<a href="compte.php?domain=<?php print $domain->getName() ?>"><button type="button" class="btn btn-primary">Ajouter un nouveau compte</button></a>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// only for mail mode
|
// only for mail mode
|
||||||
|
@ -52,7 +69,8 @@ if (!empty($_POST['delete'])) {
|
||||||
$viewonly2= ( (isset($_GET['viewonly'])) && ($_GET['viewonly']==2) ) ? "selected='selected'" : "";
|
$viewonly2= ( (isset($_GET['viewonly'])) && ($_GET['viewonly']==2) ) ? "selected='selected'" : "";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<a href="alias.php?domain=<?php print $domain->getName() ?>"><button class="btn btn-primary">Ajouter un nouvel alias/groupe de diffusion</button></a>
|
<a href="alias.php?domain=<?php print $domain->getName() ?>"><button type="button" class="btn btn-primary">Ajouter un nouvel alias/groupe de diffusion</button></a>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<form class='center' action='admin.php' method='GET' name='listing'>
|
<form class='center' action='admin.php' method='GET' name='listing'>
|
||||||
|
|
|
@ -128,6 +128,14 @@ class LdapDomain extends LdapServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function update($active=false) {
|
||||||
|
$info["isActive"] = ($active) ? 'TRUE' : 'FALSE';
|
||||||
|
if (!ldap_mod_replace($this->conn, "cn=".$this->getName().",".LDAP_BASE, $info)) {
|
||||||
|
$error = ldap_error($this->conn);
|
||||||
|
throw new Exception("Erreur pendant la modification du domaine : $error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getName() {
|
public function getName() {
|
||||||
return $this->domain;
|
return $this->domain;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue