예제 #1
0
function intAssignSelectedPermVals(&$smarty)
{
    if (isInRequest("selected")) {
        $has_perm = hasPerm($_REQUEST["selected"], $_REQUEST["admin_username"]);
        $smarty->assign("selected", $_REQUEST["selected"]);
        $smarty->assign("has_selected_perm", $has_perm);
        $smarty->assign("selected_value", requestVal("value"));
        if ($has_perm) {
            $perm_val_req = new AdminPermValue($_REQUEST["selected"], $_REQUEST["admin_username"]);
            list($success, $cur_val) = $perm_val_req->send();
            if ($success) {
                $smarty->assign("cur_val", $cur_val);
            } else {
                $smarty->assign("cur_val", "ERR");
                smartySetPageErr($smarty, $cur_val->getErrorMsgs());
            }
        }
    } else {
        $smarty->assign("selected", "");
    }
}
예제 #2
0
function permValueRestricted($perm_name, $admin_name)
{
    /* return True if value of "$perm_name" of "$admin_name" is restricted
        Also return True if an error has been occured 
    */
    if (amIGod()) {
        return False;
    }
    $req = new AdminPermValue($perm_name, $admin_name);
    $resp = $req->sendAndRecv();
    if ($resp->isSuccessful()) {
        if ($resp->getResult() == "Restricted") {
            return True;
        } else {
            return False;
        }
    } else {
        return True;
    }
}