Esempio n. 1
0
File: edit.php Progetto: psyray/mmc
function _parseEditMachineForm()
{
    $FH = new FormHandler("editMachineFH", $_POST);
    $name = $FH->getPostValue("name");
    $description = $FH->getPostValue("description");
    $enabled = $FH->getPostValue("shareEnabled") == "on" ? True : "";
    return array($name, $description, $enabled);
}
Esempio n. 2
0
        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 */
        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 />";
                    }
Esempio n. 3
0
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 {
                $error .= _T(sprintf("Failed to set %s as the secondary DHCP server.", $FH->getValue("secondary"))) . "<br />";
            }
        } else {
            if ($FH->isUpdated("secondaryIp") or $FH->isUpdated("primaryIp") or $FH->isUpdated("primaryPort") or $FH->isUpdated("secondaryPort") or $FH->isUpdated("delay") or $FH->isUpdated("update") or $FH->isUpdated("balance") or $FH->isUpdated("mclt") or $FH->isUpdated("split")) {
                updateFailoverConfig($FH);
            }
        }
    }
    // prepare the result popup
Esempio n. 4
0
File: edit.php Progetto: psyray/mmc
function _parseForm()
{
    $FH = new FormHandler("editSambaShareFH", $_POST);
    $shareName = $FH->getPostValue("shareName");
    $sharePath = $FH->getPostValue("sharePath");
    $shareDescription = $FH->getPostValue("shareDescription");
    $shareEnabled = $FH->getPostValue("shareEnabled") == "on" ? True : "";
    $shareGuest = $FH->getPostValue("shareGuest") == "on" ? True : "";
    $shareGroup = $FH->getPostValue($_POST["groupgroupsselected"]);
    $shareUser = $FH->getPostValue($_POST["userusersselected"]);
    if (!$shareGroup) {
        $shareGroup = array();
    } else {
        if ($shareGroup and !is_array($shareGroup)) {
            $shareGroup = array($shareGroup);
        }
    }
    if (!$shareUser) {
        $shareUser = array();
    } else {
        if ($shareUser and !is_array($shareUser)) {
            $shareUser = array($shareUser);
        }
    }
    return array($shareName, $sharePath, $shareDescription, $shareEnabled, $shareGuest, $shareGroup, $shareUser);
}
Esempio n. 5
0
$p->setSideMenu($sidemenu);
$p->display();
$f = new ValidatingForm();
$f->push(new Table());
$f->add(new TrFormElement(_T("Alias name"), new MailInputTpl("mailalias")), array("value" => $FH->getArrayOrPostValue("mailalias"), "required" => true));
$checked = "checked";
if ($FH->getArrayOrPostValue("mailenable") != 'on' && $FH->getArrayOrPostValue("mailenable") != 'OK') {
    $checked = "";
}
$f->add(new TrFormElement(_T("Enabled", "mail"), new CheckboxTpl("mailenable")), array("value" => $checked));
/* LDAP Users */
$users = get_users();
$usersTpl = new MembersTpl("users");
$usersTpl->setTitle(_T("Alias users", "mail"), _T("All users", "mail"));
// get the alias users
if ($FH->getPostValue("users")) {
    $alias_users = $FH->getPostValue("users");
} else {
    if ($mode == 'edit') {
        $alias_users = getVAliasUsers($alias);
    } else {
        $alias_users = array();
    }
}
$member = array();
foreach ($alias_users as $user) {
    $member[$user] = $user;
}
// get all users
$available = array();
foreach ($users as $user) {
Esempio n. 6
0
    $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)) {
            addPPolicy($name, $desc);
            if (!isXMLRPCError()) {
                $result .= _T(sprintf("Password policy %s created.", $name), "ppolicy") . "<br />";