示例#1
0
function add_app()
{
    $name = BoincDb::escape_string(post_str('add_name'));
    $user_friendly_name = BoincDb::escape_string(post_str('add_user_friendly_name'));
    if (empty($name) || empty($user_friendly_name)) {
        admin_error_page("To add a new application please supply both a brief name and a longer 'user-friendly' name.</font></p>");
    }
    $now = time();
    $id = BoincApp::insert("(name,user_friendly_name,create_time) VALUES ('{$name}', '{$user_friendly_name}', {$now})");
    if (!$id) {
        admin_error_page("insert failed");
    }
    echo "Application added.\n        <p>\n        You must restart the project for this to take effect.\n    ";
}
示例#2
0
function update()
{
    $id = post_int("id");
    $av = BoincAppVersion::lookup_id($id);
    if (!$av) {
        admin_error_page("no such app version");
    }
    $n = post_str("beta", true) ? 1 : 0;
    $av->update("beta={$n}");
    $n = post_str("deprecated", true) ? 1 : 0;
    $av->update("deprecated={$n}");
    $n = post_int("min_core_version");
    $av->update("min_core_version={$n}");
    $n = post_int("max_core_version");
    $av->update("max_core_version={$n}");
    $n = post_str("plan_class");
    $av->update("plan_class='{$n}'");
    echo "<b>Updated app version {$id}.  This change will take effect when you restart the project.</b><p>";
}
示例#3
0
function handle_suspend($user)
{
    global $g_logged_in_user;
    $dt = post_int('suspend_for', true);
    $reason = $_POST['suspend_reason'];
    if ($dt > 0 && empty($reason)) {
        admin_error_page("You must supply a reason for a suspension.\n            <p><a href=manage_user.php?userid={$user->id}>Try again</a>");
    } else {
        if (is_numeric($dt)) {
            $t = $dt > 0 ? time() + $dt : 0;
            $q = "UPDATE forum_preferences SET banished_until={$t} WHERE userid={$user->id}";
            _mysql_query($q);
            // put a timestamp in wiki to trigger re-validation of credentials
            if (function_exists('touch_wiki_user')) {
                touch_wiki_user($user);
            }
            // Send suspension e-mail to user and administrators
            if ($dt > 0) {
                $subject = PROJECT . " posting privileges suspended for " . $user->name;
                $body = "\nForum posting privileges for the " . PROJECT . " user \"" . $user->name . "\"\nhave been suspended for " . time_diff($dt) . " by " . $g_logged_in_user->name . ". \nThe reason given was:\n\n{$reason}\n\nThe suspension will end at " . time_str($t) . "\n";
            } else {
                $subject = PROJECT . " user " . $user->name . " unsuspended";
                $body = "\nForum posting privileges for the " . PROJECT . " user \"" . $user->name . "\"\nhave been restored by " . $g_logged_in_user->name . "\n";
                if ($reason) {
                    $body .= "The reason given was:\n\n   {$reason}\n";
                }
            }
            send_email($user, $subject, $body);
            $emails = explode(",", POST_REPORT_EMAILS);
            foreach ($emails as $email) {
                $admin->email_addr = $email;
                send_email($admin, $subject, $body);
            }
        }
    }
}
示例#4
0
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
// show details of an app
require_once '../inc/util_ops.inc';
$appid = get_int("appid");
$app = BoincApp::lookup_id($appid);
if (!$app) {
    admin_error_page("no such app");
}
admin_page_head("Details for {$app->name} ({$app->user_friendly_name})");
start_table();
row2("Min average efficiency", $app->min_avg_pfc);
echo "\n    <p>\n    In the list below, 'Credit scale factor' should\n    be roughly 1 for CPU versions, 0.1 for GPU versions.\n    If values are far outside this range,\n    you may have bad FLOPs estimates.\n    In this case, you may want to\n    <ol>\n    <li> <a href=job_times.php?appid={$appid}>Get a better FLOPs estimate</a>\n    <li> <a href=app_reset.php?appid={$appid}>reset credit statistics for this application</a>.\n    </ol>\n";
end_table();
echo "<h2>App versions</h2>\n";
$avs = BoincAppVersion::enum("appid={$appid}");
$avs = current_versions($avs);
foreach ($avs as $av) {
    $platform = BoincPlatform::lookup_id($av->platformid);
    start_table();
    row2("ID", $av->id);
    row2("Platform", $platform->name);
    row2("Plan class", $av->plan_class);
示例#5
0
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
// cancel a WU:
// - mark unsent results as OVER, outcome DIDNT_NEED
// - set CANCELLED bit in WU error mask
//
require_once "../inc/db.inc";
require_once "../inc/util_ops.inc";
db_init();
$wuid1 = get_int('wuid1');
$wuid2 = get_int('wuid2');
$unsent_only = get_str('unsent_only', true);
if ($wuid1 < 1 || $wuid2 < $wuid1) {
    admin_error_page("<h2>Workunit IDs fail to satisfy the conditions:<p> 0 < ID1 <= ID2");
}
if ($unsent_only) {
    cancel_wus_if_unsent($wuid1, $wuid2);
} else {
    cancel_wus($wuid1, $wuid2);
}
admin_page_head("Cancel jobs");
echo " canceled jobs with {$wuid1} <= workunit ID <= {$wuid2}</h2>";
admin_page_tail();
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
示例#6
0
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/util_ops.inc";
require_once "../inc/db_ops.inc";
db_init();
$detail = null;
$show_aggregate = false;
$nresults = get_int("nresults", true);
$entries_to_show = get_int("entries_to_show", true);
$last_pos = get_int("last_pos", true);
$table = get_str("table", true);
$detail = get_str("detail", true);
$clauses = get_str("clauses", true);
if (strstr($clauses, ";")) {
    admin_error_page("bad clause");
}
$q = new SqlQueryString();
$q->process_form_items();
if (isset($nresults)) {
    $entries_to_show = $nresults;
} else {
    $entries_to_show = 20;
}
$page_entries_to_show = $entries_to_show;
if (isset($last_pos)) {
    $start_at = $last_pos;
} else {
    $start_at = 0;
}
$title = table_title($table);
示例#7
0
<?php

// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/util_ops.inc";
$hostid = get_int("hostid");
$host = BoincHost::lookup_id($hostid);
if (!$host) {
    admin_error_page("no such host\n");
}
$host->update("rpc_time=0");
echo "Host RPC time cleared for host ID: {$hostid}\n";
admin_page_tail();
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
示例#8
0
function delete_badge()
{
    $id = post_int("id");
    $badge = BoincBadge::lookup_id($id);
    if (!$badge) {
        admin_error_page("no such badge");
    }
    BoincBadgeUser::delete("badge_id={$id}");
    BoincBadgeTeam::delete("badge_id={$id}");
    $badge->delete();
}
示例#9
0
    $build_time = intval($_POST['buildtime']);
    $required = trim($_POST['required']);
    $required_level = intval($_POST['required_level']);
    $build_pic = trim($_POST['buildpic']);
    $b_option = trim($_POST['build_option']);
    $description = trim($_POST['descr']);
    $sol_type = intval($_POST['sol_type']);
    $kurz = get_soldiers_tabless_name($b_option);
    $update = $db->query("UPDATE cc" . $n . "_soldiers set tabless='' and race='' where tabless='{$b_option}' and race='{$rasse}'");
    $update = $db->query("insert Into cc" . $n . "_soldiers (sol_type,description,tabless,required_level,points,solpic,name,res1,res2,res3,res4,stime,race,traveltime,AP,VP,required)VALUES ('{$sol_type}','{$description}','{$kurz}','{$required_level}','{$point}','{$build_pic}','{$name}','{$gold}','{$stone}','{$oil}','{$exp}','{$build_time}','{$rasse}','{$reisezeit}','{$ap}','{$vp}','{$required}') ");
    $ret = if_spalte_exist($kurz, "cc" . $n . "_countries");
    if ($ret == 0) {
        $update = $db->query("ALTER TABLE cc" . $n . "_countries ADD " . $kurz . " INT( 10 ) NOT NULL DEFAULT '0'");
    }
    header("LOCATION: edit_units.php");
}
if ($action == "del") {
    $del_id = intval($_GET['del_id']);
    if ($del_id <= 0) {
        admin_error_page("{$ln_error_20}");
        exit;
    }
    // search for old
    $result = $db->query("SELECT tabless,sid FROM cc" . $n . "_soldiers WHERE sid='" . $del_id . "'");
    $row = $db->fetch_array($result);
    $old_kurz = $row['tabless'];
    if ($old_kurz != '') {
        $update = $db->query("delete from cc" . $n . "_soldiers where sid='" . $del_id . "'");
    }
    header("LOCATION: edit_units.php");
}
示例#10
0
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
$skip_auth_ops = true;
require_once "../inc/boinc_db.inc";
require_once "../inc/util_ops.inc";
require_once "../inc/email.inc";
require_once "../inc/user.inc";
// check for email/password case
//
$email_addr = strtolower(post_str("email_addr", true));
$passwd = stripslashes(post_str("passwd", true));
if ($email_addr && $passwd) {
    $user = BoincUser::lookup_email_addr($email_addr);
    if (!$user) {
        admin_error_page("No account found with email address {$email_addr}");
    }
    $passwd_hash = md5($passwd . $email_addr);
    if ($passwd_hash != $user->passwd_hash) {
        admin_error_page("Login failed");
    }
    $authenticator = $user->authenticator;
    $next_url = $_POST["next_url"];
    if (strlen($next_url) == 0) {
        $next_url = "index.php";
    }
    $perm = $_POST['stay_logged_in'];
    send_cookie('auth', $authenticator, $perm, true);
    Header("Location: {$next_url}");
}
示例#11
0
<?php

require_once "../inc/util_ops.inc";
$user = get_logged_in_user_ops();
if ($user) {
    clear_cookie('auth', true);
    admin_page_head("Logged out");
    admin_page_tail();
} else {
    admin_error_page("not logged in");
}
示例#12
0
<?php

require_once "../inc/util_ops.inc";
$user = get_logged_in_user_ops();
if ($user) {
    admin_error_page("already logged in");
}
admin_page_head("Log in");
$next_url = sanitize_local_url(get_str('next_url', true));
if (strlen($next_url) == 0) {
    $next_url = "index.php";
}
print_login_form_ops($next_url);
admin_page_tail();