コード例 #1
0
function reset_all()
{
    BoincUserSubmit::update_aux("logical_start_time=0");
    BoincBatch::update_aux("logical_start_time=0, logical_end_time=0");
    BoincWorkunit::update_aux("priority=0");
    BoincResult::update_aux("priority=0");
}
コード例 #2
0
function authenticate_user($r, $app)
{
    $auth = (string) $r->authenticator;
    if (!$auth) {
        error("no authenticator");
    }
    $user = BoincUser::lookup("authenticator='{$auth}'");
    if (!$user) {
        error("bad authenticator");
    }
    $user_submit = BoincUserSubmit::lookup_userid($user->id);
    if (!$user_submit) {
        error("no submit access");
    }
    if ($app && !$user_submit->submit_all) {
        $usa = BoincUserSubmitApp::lookup("user_id={$user->id} and app_id={$app->id}");
        if (!$usa) {
            error("no submit access");
        }
    }
    return array($user, $user_submit);
}
コード例 #3
0
ファイル: sandbox.php プロジェクト: nicolas17/boincgit-test
    $dir = sandbox_dir($user);
    list($error, $size, $md5) = sandbox_parse_link_file("{$dir}/{$name}");
    if ($error) {
        error_page("no such link file");
    }
    $p = sandbox_physical_path($user, $md5);
    if (!is_file($p)) {
        error_page("no such physical file");
    }
    echo "<pre>\n";
    readfile($p);
    echo "</pre>\n";
}
$user = get_logged_in_user();
//print_r($user);
$user_submit = BoincUserSubmit::lookup_userid($user->id);
if (!$user_submit) {
    error_page("no job submission access");
}
$action = get_str('action', true);
if (!$action) {
    $action = post_str('action', true);
}
switch ($action) {
    case '':
        list_files($user, "");
        break;
    case 'upload_file':
        upload_file($user);
        break;
    case 'delete_file':
コード例 #4
0
function handle_add_action()
{
    $user_id = get_int('user_id');
    $user = BoincUser::lookup_id($user_id);
    if (!$user) {
        error_page("no such user");
    }
    $us = BoincUserSubmit::lookup_userid($user_id);
    if (!$us) {
        if (!BoincUserSubmit::insert("(user_id) values ({$user_id})")) {
            error_page("Insert failed");
        }
    }
    header("Location: manage_project.php?action=edit_form&user_id={$user_id}");
}
コード例 #5
0
ファイル: manage_app.php プロジェクト: CalvinZhu/boinc
    foreach ($batches as $batch) {
        if ($abort_all || get_str("abort_{$batch->id}", true)) {
            abort_batch($batch);
        }
    }
    page_head("Update successful");
    echo "\n        <a href=manage_app.php?app_id={$app->id}>Return to application management page</a>\n    ";
    page_tail();
}
$user = get_logged_in_user();
$app_id = get_int("app_id");
$app = BoincApp::lookup_id($app_id);
if (!$app) {
    error_page("no such app");
}
$bus = BoincUserSubmit::lookup_userid($user->id);
if (!$bus) {
    error_page("no access");
}
if (!$bus->manage_all) {
    $busa = BoincUserSubmitApp::lookup("user_id={$user->id} and app_id={$app_id}");
    if (!$busa || !$busa->manage) {
        error_page("no access");
    }
}
$action = get_str("action", true);
switch ($action) {
    //case "":
    //    main_page($app); break;
    case "app_version_form":
        app_version_form($app);
コード例 #6
0
function eligible_apps()
{
    global $user;
    $apps = BoincApp::enum("deprecated = 0");
    $user_submit = BoincUserSubmit::lookup_userid($user->id);
    if (!$user_submit) {
        return null;
    }
    $a = array();
    foreach ($apps as $app) {
        if ($user_submit->submit_all) {
            $a[] = $app;
        } else {
            if (BoincUserSubmitApp::lookup("user_id={$user->id} and app_id={$app->id}")) {
                $a[] = $app;
            }
        }
    }
    return $a;
}
コード例 #7
0
ファイル: submit.php プロジェクト: CalvinZhu/boinc
function check_access($user, $batch)
{
    if ($user->id == $batch->user_id) {
        return;
    }
    $user_submit = BoincUserSubmit::lookup_userid($user->id);
    if ($user_submit->manage_all) {
        return;
    }
    $usa = BoincUserSubmitApp::lookup("user_id={$user->id} and app_id={$batch->app_id}");
    if ($usa->manage) {
        return;
    }
    error_page("no access");
}
コード例 #8
0
ファイル: manage.php プロジェクト: CalvinZhu/boinc
$bus = BoincUserSubmit::lookup_userid($user->id);
if (!$bus) {
    die("no access");
}
if ($bus->manage_all) {
    page_head("Management functions");
    echo "\n        <a href=manage_project.php>Project-wide management</a>\n    ";
    $apps = BoincApp::enum(null);
    echo "\n        <p>Application-specific management:\n        <ul>\n    ";
    foreach ($apps as $app) {
        echo "\n            <li><a href=manage_app.php?app_id={$app->id}>{$app->name}</a>\n        ";
    }
    echo "</ul>\n";
    page_tail();
    exit;
}
$apps = BoincUserSubmit::enum("user_id={$user->id} and manage<>1");
switch (count($apps)) {
    case 0:
        error_page("Nothing to manage");
    case 1:
        $app = $apps[0];
        Header("Location: manage_app.php?app_id={$app->id}");
        exit;
    default:
        page_head("Management functions");
        foreach ($apps as $app) {
            echo "\n            <p><a href=manage_app.php?app_id={$app->id}>Manage {$app->name}</a>\n        ";
        }
        page_tail();
}