Example #1
0
function getAllValidUsers()
{
    if (!$GLOBALS["usersByName"]) {
        $byEmail = $byName = array();
        foreach (getSQLusers(True) as $uid => $row) {
            $byEmail[$row["email"]] = array("gecos" => $row["gecos"], "uid" => $uid);
        }
        foreach (getLocalUsers(True) as $uid => $row) {
            $byEmail[$row["email"]] = array("gecos" => $row["gecos"], "uid" => $uid);
        }
        foreach ($byEmail as $id => $row) {
            $login = eregi_replace("@.*", "", $id);
            if (eregi("@nordita", $id) && posix_getpwnam($login)) {
                $id = $login;
            }
            $byName[$row["gecos"]] = array("uid" => $row["uid"], "username" => $id);
        }
        ksort($byName);
        $GLOBALS["usersByName"] = $byName;
    }
    return $GLOBALS["usersByName"];
}
Example #2
0
        $_GET["show"] = $tab;
    }
    if (!$links["default"]) {
        $links["default"] = $links[$tab];
    }
}
$tabs = new tabs();
$tabs->show($links);
if ($_GET["show"] == adduser) {
    add_SQLuser();
} elseif ($_GET["show"] == localUsers) {
    print x("h3", $tabs->active);
    $t = new table("cellpadding=2", "<div id='preprints' class='select_users'>");
    $t->tr("", "colspan='6'", "The local users (those who have local computing accounts) are managed by the computing administrator.<br>" . "The owners of the active local accounts are authorized to write to the Preprints database, <br>" . "the expired accounts are not authorized.");
    $t->tro();
    foreach (getLocalUsers() as $uid => $row) {
        $t->td("", "<img src='pic/" . ($row["status"] ? "b_ok.gif" : "b_drop.png") . "' border='0'>");
        $t->td("", $row["gecos"] . "<br>" . $row["email"]);
        if (++$counter % 5 == 0) {
            $t->trc();
            $t->tro();
        }
    }
    $t->trc();
    $t->close("</div>");
} else {
    /* workarond... Should not be needed in the future */
    $q = $dbClass->query("SELECT * FROM accounts WHERE Status = 0");
    $toSetACL = $dbClass->num_rows($q) == 0;
    /* <input type=checkbox> does not report the unchecked boxes,
     * hereis a workaround */