Пример #1
0
            break;
        case 'sat-denied':
        case 'unsat-denied':
            echo _('You are not allowed to request access to this stage.');
            break;
        case 'sat-available':
            if ($stage->after_satisfying_minima == 'REQ-AUTO') {
                $userSettings =& Settings::get_Settings($pguser);
                $userSettings->set_true("{$stage_id}.access");
                log_access_change($pguser, 'AUTO-GRANTED', $stage_id, 'grant');
                echo _('Access has been granted!');
            } elseif ($stage->after_satisfying_minima == 'REQ-HUMAN') {
                $body = sprintf(_("User '%s' has requested access to stage '%s'"), $pguser, $stage_id);
                maybe_mail($email_addr, $title, $body);
                $userSettings =& Settings::get_Settings($pguser);
                $userSettings->set_value("{$stage_id}.access", "requested");
                log_access_change($pguser, 'n/a', $stage_id, 'request');
                echo _('Your request has been submitted and logged.');
            } else {
                die("unexpected value for after_satisfying_minima: '{$stage->after_satisfying_minima}'");
            }
            break;
        default:
            die("bad request_status value: '{$uao->request_status}'");
    }
}
echo "</p>\n";
echo "<p>";
printf(_("Back to <a href='%s'>Activity Hub</a>"), "{$code_url}/activity_hub.php");
echo "</p>\n";
// vim: sw=4 ts=4 expandtab
Пример #2
0
    // (Don't execute any actions unless they're all valid.)
    $actions[$activity_id] = $action_type;
}
if (count($actions) == 0) {
    die("Warning: you did not specify any modifications");
}
echo "<br>\n";
echo "Those modifications appear to be valid.<br>\n";
echo "Performing them now...<br>\n";
foreach ($actions as $activity_id => $action_type) {
    echo "<br>\n";
    echo "{$action_type} {$activity_id} ...<br>\n";
    $yesno = $action_type == 'grant' ? 'yes' : 'no';
    $userSettings =& Settings::get_Settings($subject_username);
    $userSettings->set_value("{$activity_id}.access", $yesno);
    log_access_change($subject_username, $pguser, $activity_id, $action_type);
}
echo "<br>\n";
echo "Done<br>\n<br>\n";
if ($notify_user) {
    echo "Notifying user... " . notify_user($subject_username, $actions) . "<br>\n<br>\n";
}
echo "Hit 'Back' to return to user's detail page. (And you may need to reload.)<br>\n";
// -----------------------------------------------------------------------------
function notify_user($username, $actions)
{
    global $site_name, $site_signoff;
    $user = new User($username);
    if (count($actions) == 1 && array_search('grant', $actions) !== false) {
        // Special case: If the user has been granted access to
        // a single round, send a congratulations! email.