break; default: $mode = false; break; } $redirect = false; // if data is sent if ($_POST) { $uid = $FH->getPostValue('uid'); /* Check sent data */ $ret = callPluginFunction("verifInfo", array($FH, $mode)); if (!$error && !isXMLRPCError()) { /* Add or edit user attributes */ $ret = callPluginFunction("changeUser", array($FH, $mode)); /* Primary group management */ if ($FH->isUpdated("primary")) { $primaryGroup = getUserPrimaryGroup($uid); if ($FH->getValue("primary") != $primaryGroup) { /* Update the primary group */ $ret = callPluginFunction("changeUserPrimaryGroup", array($uid, $FH->getValue("primary"), $primaryGroup)); foreach ($ret as $plugin => $err) { if ($err != 0 && $err != NULL) { $result .= sprintf(_("Failed to change primary group in %s plugin"), $plugin) . "<br />"; } } } } /* Secondary groups management */ if ($FH->isUpdated("secondary")) { $old = getUserSecondaryGroups($uid); $new = $FH->getValue('secondary');
} else { $FH = new FormHandler("editAliasFH", array()); } if ($_GET["action"] == "add") { $mode = "add"; $title = _T("Add a virtual alias", "mail"); } else { $mode = "edit"; $title = _T("Edit virtual alias", "mail"); $sidemenu->forceActiveItem("index"); $alias = $_GET['alias']; $FH->setArr(getVAlias($alias)); } if ($_POST) { if ($mode == "add") { if ($FH->isUpdated("mailalias")) { addVAlias($FH->getValue("mailalias")); $alias = $FH->getValue("mailalias"); $result .= _T("The virtual alias has been created.", "mail") . "<br />"; } else { $error .= _T("The alias name is required.", "mail"); setFormError("mailalias"); } } else { if ($FH->isUpdated("mailalias")) { changeVAliasName($alias, $FH->getValue("mailalias")); $alias = $FH->getValue("mailalias"); $result .= _T("Virtual alias name updated.", "mail") . "<br />"; } } if (!$error && !isXMLRPCError()) {
} else { $error .= _T("Failed to update the failover configuration.") . "<br />"; } } // get current configuration $failoverConfig = getFailoverConfig(); $FH->setArr($failoverConfig); // default values $show = false; if (isset($failoverConfig['secondary'])) { $show = true; } if ($_POST) { $result = ""; $error = ""; if ($FH->isUpdated("dhcp_failover") and $FH->getValue("dhcp_failover") == "off") { delFailoverConfig(); delSecondaryServer(); if (!isXMLRPCError()) { $result .= _T("Failover configuration disabled.") . "<br />"; } else { $error .= _T("Failed to disable the failover configuration.") . "<br />"; } } if ($FH->getPostValue("dhcp_failover") == "on") { if ($FH->isUpdated("secondary")) { updateSecondaryServer($FH->getValue("secondary")); if (!isXMLRPCError()) { $result .= _T(sprintf("%s set as the secondary DHCP server.", $FH->getValue("secondary"))) . "<br />"; updateFailoverConfig($FH); } else {
} if ($_GET["action"] == "addppolicy") { $mode = "add"; $title = _T("Add a password policy", "ppolicy"); } else { $mode = "edit"; $title = _T("Edit password policy", "ppolicy"); $sidemenu->forceActiveItem("indexppolicy"); $ppolicy = $_GET['ppolicy']; $FH->setArr(getAllPPolicyAttributes($ppolicy)); } if ($_POST) { $name = $FH->getPostValue("cn"); $desc = $FH->getPostValue("description"); // Some sanity checks... if ($FH->isUpdated("pwdMaxAge") or $FH->isUpdated("pwdMinAge")) { $max = $FH->getPostValue("pwdMaxAge"); $min = $FH->getPostValue("pwdMinAge"); if ($min && $max && $min > $max) { $error .= _T('"Maximum age" must be greater than "Minimum age".', 'ppolicy') . "<br />"; setFormError("pwdMinAge"); } } if ($mode == "add") { if (!checkPPolicy($name)) { addPPolicy($name, $desc); if (!isXMLRPCError()) { $result .= _T(sprintf("Password policy %s created.", $name), "ppolicy") . "<br />"; } else { $error .= _T(sprintf("Failed to create %s password policy.", $name), "ppolicy") . "<br />"; }