Beispiel #1
0
    } else {
        $err = new ErrorMessage(_("Invalid computer name."));
    }
}
$p = new PageGenerator();
if ($_GET["action"] == "add") {
    $title = _("Add a computer");
} else {
    $title = _("Edit a computer");
    $sidemenu->forceActiveItem("index");
}
$p->setTitle($title);
$p->setSideMenu($sidemenu);
$p->display();
if ($err) {
    $err->display();
}
$formfields = array("computername", "computerdescription");
$f = new ValidatingForm();
$f->push(new Table());
if ($_GET["action"] == "add") {
    if (in_array("pulse2", $_SESSION["modulesList"])) {
        /*
          Be more permissive for Pulse 2 computer name, as it will be checked
          internally.
        */
        $formElt = new InputTpl("computername");
    } else {
        $formElt = new DomainInputTpl("computername");
    }
} else {
Beispiel #2
0
/**
 * Form on user edit page
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _mail_baseEdit($FH, $mode)
{
    $attrs = getMailAttributes();
    $f = new DivForModule(_T("Mail properties", "mail"), "#FFD");
    // Show plugin details by default
    $show = true;
    // User has not mail attributes by default
    $hasMail = false;
    // User is not disabled by default
    $disabledMail = false;
    if ($mode == "edit") {
        // check user actual values
        $uid = $FH->getArrayOrPostValue('uid');
        if (hasMailObjectClass($uid)) {
            $hasMail = true;
        } else {
            $show = false;
        }
        if ($FH->getArrayOrPostValue($attrs['mailenable']) == "NONE") {
            $disabledMail = true;
            // Display an error message on top of the page
            $em = new ErrorMessage(_T("Mail properties", "samba") . ' : ' . _T("Mail delivery is disabled", "samba"));
            $em->display();
        }
    }
    if ($mode == "add" && $FH->getValue('mailaccess') == 'off') {
        $show = false;
    }
    $f->push(new Table());
    $f->add(new TrFormElement(_T("Mail access", "mail"), new CheckboxTpl("mailaccess")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'maildiv\');"'));
    $f->pop();
    $maildiv = new Div(array("id" => "maildiv"));
    $maildiv->setVisibility($show);
    $f->push($maildiv);
    $f->push(new Table());
    $f->add(new TrFormElement(_T("Mail delivery is disabled, if checked", "mail"), new CheckboxTpl("maildisable")), array("value" => $disabledMail ? "checked" : ""));
    $f->add(new TrFormElement(_T("Mail quota (in kB)", "mail"), new QuotaTpl($attrs['mailuserquota'], '/^[0-9]*$/')), array("value" => $FH->getArrayOrPostValue($attrs['mailuserquota'])));
    $f->pop();
    if (hasVDomainSupport()) {
        $m = new MultipleInputTpl("maildrop", _T("Forward to", "mail"));
        /* In virtual domain mode, maildrop must be an email address */
        $m->setRegexp('/^[0-9a-zA-Z_.+\\-]+@[0-9a-zA-Z.\\-]+$/');
    } else {
        $m = new MultipleInputTpl($attrs['maildrop'], _T("Mail drop", "mail"));
        $m->setRegexp('/^([0-9a-zA-Z_.+@\\-])+$/');
    }
    $f->add(new FormElement(_T("Mail drop", "mail"), $m), $FH->getArrayOrPostValue($attrs['maildrop'], 'array'));
    $m = new MultipleInputTpl($attrs['mailalias'], _T("Mail alias", "mail"));
    $m->setRegexp('/^([0-9a-zA-Z@_.+\\-])+$/');
    $f->add(new FormElement(_T("Mail alias", "mail"), $m), $FH->getArrayOrPostValue($attrs['mailalias'], 'array'));
    if (hasVDomainSupport()) {
        $f->push(new DivExpertMode());
        $f->push(new Table());
        $f->add(new TrFormElement(_T("Mail delivery path", "mail"), new InputTpl($attrs['mailbox'])), array("value" => $FH->getArrayOrPostValue($attrs['mailbox'])));
        $f->add(new TrFormElement(_T("Mail server host", "mail"), new IA5InputTpl($attrs['mailhost'])), array("value" => $FH->getArrayOrPostValue($attrs['mailhost'])));
        $f->pop();
        $f->pop();
    }
    if (hasZarafaSupport()) {
        $f->push(new DivForModule(_T("Zarafa properties", "mail"), "#FFD"));
        $f->push(new Table());
        $checked = false;
        if ($FH->getArrayOrPostValue('zarafaAdmin') == "on" || $FH->getArrayOrPostValue('zarafaAdmin') == "1") {
            $checked = true;
        }
        $f->add(new TrFormElement(_T("Administrator of Zarafa", "mail"), new CheckboxTpl("zarafaAdmin")), array("value" => $checked ? "checked" : ""));
        $checked = false;
        if ($FH->getArrayOrPostValue('zarafaSharedStoreOnly') == "on" || $FH->getArrayOrPostValue('zarafaSharedStoreOnly') == "1") {
            $checked = true;
        }
        $f->add(new TrFormElement(_T("Shared store", "mail"), new CheckboxTpl("zarafaSharedStoreOnly")), array("value" => $checked ? "checked" : ""));
        $checked = false;
        if ($FH->getArrayOrPostValue('zarafaAccount') == "on" || $FH->getArrayOrPostValue('zarafaAccount') == "1") {
            $checked = true;
        }
        $f->add(new TrFormElement(_T("Zarafa account", "mail"), new CheckboxTpl("zarafaAccount")), array("value" => $checked == "on" ? "checked" : ""));
        $checked = false;
        if ($FH->getArrayOrPostValue('zarafaHidden') == "on" || $FH->getArrayOrPostValue('zarafaHidden') == "1") {
            $checked = true;
        }
        $f->add(new TrFormElement(_T("Hide from Zarafa address book", "mail"), new CheckboxTpl("zarafaHidden")), array("value" => $checked ? "checked" : ""));
        $f->pop();
        $sendas = new MultipleInputTpl("zarafaSendAsPrivilege", _T("Zarafa send as user list", "mail"));
        $sendas->setRegexp('/^([0-9a-zA-Z@_.\\-])+$/');
        $f->add(new FormElement("", $sendas), $FH->getArrayOrPostValue("zarafaSendAsPrivilege", "array"));
        $f->pop();
    }
    $f->pop();
    if ($mode == 'add' && !hasVDomainSupport()) {
        //suggest only on add user
        ?>
        <script type="text/javascript" language="javascript">
        var autoCreate = function(e) {
            $('maildrop[0]').value = $F('uid').toLowerCase();
        };
        Event.observe(window, 'load', function() {
            $('uid').observe('keyup', autoCreate);
        });
        </script>
        <?php 
    }
    return $f;
}
Beispiel #3
0
/**
 * Form on user edit page
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _ppolicy_baseEdit($FH, $mode)
{
    $f = new DivForModule(_T("Password policy management", "ppolicy"), "#FDF");
    // default values
    $hasPPolicy = false;
    $pwdReset = false;
    $ppolicyName = "";
    $default = getDefaultPPolicyName();
    if ($mode == "edit") {
        $uid = $FH->getArrayOrPostValue('uid');
        if (hasUserPPolicy($uid)) {
            $hasPPolicy = true;
            $ppolicyName = getUserPPolicy($uid);
        }
        if (passwordHasBeenReset($uid)) {
            $pwdReset = true;
        }
    }
    $f->push(new Table());
    if ($mode == "edit") {
        $pwdLock = false;
        if (isAccountLocked($uid) != "0") {
            $pwdLock = true;
            // Display an error message on top of the page
            $em = new ErrorMessage(_T("Password policy management", "ppolicy") . ' : ' . _T("This account is locked by the LDAP directory.", "ppolicy"));
            $em->display();
        }
        $pwdExpired = isPasswordExpired($uid);
        $nbGraceLogins = isAccountInGraceLogin($uid);
        if ($pwdExpired && in_array($nbGraceLogins, array(0, 1))) {
            // Display an error message on top of the page
            $em = new ErrorMessage(_T("Password policy management", "ppolicy") . ' : ' . _T("The password of this account has expired. The user cannot change his password.", "ppolicy"));
            $em->display();
        }
        if ($pwdExpired && ($nbGraceLogins == -1 || $nbGraceLogins > 1)) {
            if ($nbGraceLogins > 1) {
                // Display an error message on top of the page
                $em = new ErrorMessage(_T("Password policy management", "ppolicy") . ' : ' . sprintf(_T("The password of this account has expired. The user has %s login(s) left to change his password.", "ppolicy"), $nbGraceLogins));
            } else {
                // Display an error message on top of the page
                $em = new ErrorMessage(_T("Password policy management", "ppolicy") . ' : ' . _T("The password of this account has expired. The user can change his password.", "ppolicy"));
            }
            $em->display();
        }
        $f->add(new TrFormElement(_T("Lock account", "ppolicy"), new CheckboxTpl("pwdLock"), array("tooltip" => _T("If checked, permanently lock the user account", "ppolicy"))), array("value" => $pwdLock ? "checked" : ""));
    }
    $f->add(new TrFormElement(_T("Password reset flag", "ppolicy"), new CheckboxTpl("pwdReset"), array("tooltip" => _T("If checked, the user must change her password when she first binds to the LDAP directory after password is set or reset by a password administrator", "ppolicy"))), array("value" => $pwdReset ? "checked" : ""));
    $ppolicyList = listPPolicy();
    if (count($ppolicyList) > 1) {
        $ppolicyTpl = new SelectItem("ppolicyname");
        foreach ($ppolicyList as $pp) {
            $name = $pp[1]['cn'][0];
            if (isset($pp[1]['description'][0])) {
                $desc = $pp[1]['description'][0];
            } else {
                $desc = $name;
            }
            if ($name == $default) {
                $name = "";
                $desc = _T($desc, "ppolicy");
            }
            $values[$desc] = $name;
        }
        $ppolicyTpl->setElements(array_keys($values));
        $ppolicyTpl->setElementsVal(array_values($values));
        $f->add(new TrFormElement(_T("Enable a specific password policy for this user", "ppolicy"), $ppolicyTpl, array("tooltip" => _T("If not set the default password policy is enforced.", "ppolicy"))), array("value" => $ppolicyName));
    }
    $f->pop();
    return $f;
}
Beispiel #4
0
/**
 * Form on user edit page
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _samba_baseEdit($FH, $mode)
{
    // default values
    $hasSmb = false;
    $show = true;
    // get smb config info
    $smbInfo = xmlCall("samba.getSmbInfo", null);
    // fetch ldap updated info if we can
    if ($mode == 'edit') {
        $uid = $FH->getArrayOrPostValue("uid");
        if (hasSmbAttr($uid)) {
            $hasSmb = true;
        } else {
            $show = false;
        }
        // show Samba plugin in case of error
        if ($FH->getValue("isSamba") == "on") {
            $show = true;
        }
    } else {
        if ($FH->getValue("isSamba") == "off") {
            $show = false;
        }
    }
    if ($hasSmb && userPasswdHasExpired($uid)) {
        $em = new ErrorMessage(_T("Samba properties", "samba") . ' : ' . _T("The password of this account has expired.", "samba"));
        $em->display();
    }
    if ($hasSmb && isLockedUser($uid)) {
        $em = new ErrorMessage(_T("Samba properties", "samba") . ' : ' . _T("This account is locked.", "samba"));
        $em->display();
    }
    $f = new DivForModule(_T("Samba properties", "samba"), "#EFE");
    $f->push(new Table());
    $f->add(new TrFormElement(_T("Samba access", "samba"), new CheckboxTpl("isSamba")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'smbdiv\');"'));
    $f->pop();
    $smbdiv = new Div(array("id" => "smbdiv"));
    $smbdiv->setVisibility($show);
    $f->push($smbdiv);
    $f->push(new Table());
    $checked = "";
    if ($hasSmb && !isEnabledUser($uid) || $FH->getArrayOrPostValue('isSmbDesactive') == 'on') {
        $checked = "checked";
        // Display an error message on top of the page
        $em = new ErrorMessage(_T("Samba properties", "samba") . ' : ' . _T("This account is disabled", "samba"));
        $em->display();
    }
    $f->add(new TrFormElement(_T("User is disabled, if checked", "samba"), new CheckboxTpl("isSmbDesactive"), array("tooltip" => _T("Disable samba user account", 'samba'))), array("value" => $checked));
    $checked = "";
    if ($hasSmb && isLockedUser($uid) || $FH->getArrayOrPostValue('isSmbLocked') == 'on') {
        $checked = "checked";
    }
    $f->add(new TrFormElement(_T("User is locked, if checked", "samba"), new CheckboxTpl("isSmbLocked"), array("tooltip" => _T("Lock samba user access<p>User can be locked after too many failed log.</p>", 'samba'))), array("value" => $checked));
    # display this options only if we are PDC
    if ($smbInfo["pdc"]) {
        # if no global profile set, we can set a roaming profile for this user
        if (!$smbInfo["logon path"]) {
            $hasProfile = false;
            $checked = "";
            $value = "";
            if ($FH->getArrayOrPostValue("sambaProfilePath")) {
                $hasProfile = true;
                $checked = "checked";
                $value = $FH->getArrayOrPostValue('sambaProfilePath');
            }
            $f->add(new TrFormElement(_T("Use network profile, if checked", "samba"), new CheckboxTpl("hasProfile")), array("value" => $checked, "extraArg" => 'onclick="toggleVisibility(\'pathdiv\')"'));
            $f->pop();
            $pathdiv = new Div(array('id' => 'pathdiv'));
            $pathdiv->setVisibility($hasProfile);
            $f->push($pathdiv);
            $f->push(new Table());
            $f->add(new TrFormElement(_T("Network path for user's profile", "samba"), new InputTpl("sambaProfilePath")), array("value" => $value));
            $f->pop();
            $f->pop();
            $f->push(new Table());
        }
        $checked = "";
        if (($FH->getArrayOrPostValue('sambaPwdMustChange') == "0" || $FH->getArrayOrPostValue('sambaPwdMustChange') == "on") && $FH->getArrayOrPostValue('sambaPwdLastSet') == "0") {
            $checked = "checked";
        }
        $f->add(new TrFormElement(_T("User must change password on next logon, <br/>if checked", "samba"), new CheckboxTpl("sambaPwdMustChange")), array("value" => $checked));
        $value = "";
        if ($FH->getArrayOrPostValue('sambaKickoffTime')) {
            $value = strftime("%Y-%m-%d %H:%M:%S", $FH->getArrayOrPostValue('sambaKickoffTime'));
        }
        $f->add(new TrFormElement(_T("Account expiration", "samba"), new DynamicDateTpl("sambaKickoffTime"), array("tooltip" => _T("Specifies the date when the user will be locked down and cannot login any longer. If this attribute is omitted, then the account will never expire.", 'samba'))), array("value" => $value, "ask_for_never" => 1));
        $f->pop();
        // Expert mode display
        $f->push(new DivExpertMode());
        $f->push(new Table());
        $d = array(_T("Opening script session", "samba") => "sambaLogonScript", _T("Base directory path", "samba") => "sambaHomePath", _T("Connect base directory on network drive", "samba") => "sambaHomeDrive");
        foreach ($d as $description => $field) {
            $f->add(new TrFormElement($description, new InputTpl($field)), array("value" => $FH->getArrayOrPostValue($field)));
        }
        $f->pop();
    }
    $f->pop();
    $f->pop();
    return $f;
}
Beispiel #5
0
            </div>
        </div>';
    } else {
        $objprocess['process'] = $scriptmulticast;
        if (xmlrpc_check_process_multicast($objprocess)) {
            // if /tmp/multicast.sh is running then stoping
            $objprocess['process'] = $scriptmulticast;
            xmlrpc_stop_process_multicast($objprocess);
            $objprocess['process'] = $path . $scriptmulticast;
            xmlrpc_clear_script_multicast($objprocess);
        }
    }
    ?>
    <div class="spacer"></div>

    <h3 class="activity"><?php 
    echo _T('Recent activity', 'imaging');
    ?>
</h3>

    <?php 
    $ajax = new AjaxFilter("modules/imaging/manage/ajaxLogs.php", "container_logs", array(), "Logs");
    //$ajax->setRefresh(10000);
    $ajax->display();
    echo "<br/><br/><br/>";
    $ajax->displayDivToUpdate();
} else {
    $e = new ErrorMessage(_T("Can't connect to the imaging server linked to the selected entity.", "imaging"));
    print $e->display();
}
require "../includes/ajaxcommon_bottom.inc.php";