Ejemplo n.º 1
0
function _userquota_baseGroupEdit($ldapArr, $postArr)
{
    $FH = new FormHandler("editGroupQuota", $postArr);
    $FH->setArr($ldapArr);
    $components = getActiveComponents();
    if ($components["disk"]) {
        $f = new DivForModule(_T("Quota plugin - Filesystem", "userquota"), "#FDD");
        $f->push(new Table());
        $f = addDiskQuotas($f, $FH);
        $f->add(new TrCommentElement(_T("Quota's applied here affect all members of the group", "userquota")));
        $overwrite = new RadioTpl("diskoverwrite");
        $overwrite->setChoices(array(_T("Overwrite all existing quotas", "userquota"), _T("Current quota is smaller than the new quota, or does not exist", "userquota"), _T("Current quota is larger than the new quota, or does not exist", "userquota"), _T("Don't overwrite any existing quotas", "userquota")));
        $overwrite->setValues(array("all", "smaller", "larger", "none"));
        $overwrite->setSelected("none");
        $f->add(new TrFormElement(_T("Overwrite mode for existing quotas", "userquota"), $overwrite));
        $f->pop();
        $f->display();
    }
    if ($components["network"]) {
        $f = new DivForModule(_T("Quota plugin - Network", "userquota"), "#FFD");
        $f->push(new Table());
        $f = addNetworkQuotas($f, $FH);
        $f->add(new TrCommentElement(_T("Quota's applied here affect all members of the group", "userquota")));
        $overwrite = new RadioTpl("networkoverwrite");
        $overwrite->setChoices(array(_T("Overwrite all existing quotas", "userquota"), _T("Current quota is smaller than the new quota, or does not exist", "userquota"), _T("Current quota is larger than the new quota, or does not exist", "userquota"), _T("Don't overwrite any existing quotas", "userquota")));
        $overwrite->setValues(array("all", "smaller", "larger", "none"));
        $overwrite->setSelected("none");
        $f->add(new TrFormElement(_T("Overwrite mode for existing quotas", "userquota"), $overwrite));
        $f->pop();
        $f->display();
    }
}
Ejemplo n.º 2
0
    $FH = new FormHandler("editUserFH", $_POST);
} else {
    $FH = new FormHandler("editUserFH", array());
}
switch ($_GET["action"]) {
    case "add":
        $mode = "add";
        $title = _("Add user");
        $activeItem = "add";
        break;
    case "edit":
        $mode = "edit";
        $title = _("Edit user");
        $activeItem = "index";
        $uid = $_GET["user"];
        $FH->setArr(getDetailedUser($uid));
        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 */
Ejemplo n.º 3
0
$result = "";
// Class managing $_POST array
if ($_POST) {
    $FH = new FormHandler("editAliasFH", $_POST);
} 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");
Ejemplo n.º 4
0
}
function updateFailoverConfig($FH)
{
    global $result;
    global $error;
    setFailoverConfig($FH->getPostValue("primaryIp"), $FH->getPostValue("secondaryIp"), $FH->getPostValue("primaryPort"), $FH->getPostValue("secondaryPort"), $FH->getPostValue("delay"), $FH->getPostValue("update"), $FH->getPostValue("balance"), $FH->getPostValue("mclt"), $FH->getPostValue("split"));
    if (!isXMLRPCError()) {
        $result .= _T("Failover configuration updated.") . "<br />";
        $result .= _T("You must restart DHCP services.") . "<br />";
    } 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 />";
Ejemplo n.º 5
0
$result = "";
// Class managing $_POST array
if ($_POST) {
    $FH = new FormHandler("editPPolicyFH", $_POST);
} else {
    $FH = new FormHandler("editPPolicyFH", array());
}
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)) {