Exemplo n.º 1
0
function select_profile($cmd)
{
    // Request for a random profile.
    //
    if ($cmd == "rand") {
        $profiles = array();
        $pic = get_int('pic');
        if ($pic == 0) {
            $profiles = BoincProfile::enum("has_picture=0", "limit 1000");
        } else {
            if ($pic == 1) {
                $profiles = BoincProfile::enum("has_picture=1", "limit 1000");
            } else {
                if ($pic == -1) {
                    $profiles = BoincProfile::enum(null, "limit 1000");
                }
            }
        }
        if (count($profiles) == 0) {
            page_head(tra("No profiles"));
            echo tra("No profiles matched your query.");
            page_tail();
            exit;
        }
        shuffle($profiles);
        $userid = $profiles[0]->userid;
        header("Location: " . URL_BASE . "view_profile.php?userid={$userid}");
        exit;
    }
}
Exemplo n.º 2
0
 public function includeNominations(Beatmapset $beatmapset, ParamBag $params = null)
 {
     if ($beatmapset->isPending()) {
         if ($params !== null) {
             $userId = get_int($params->get('user_id')[0] ?? null);
         }
         $nominations = $beatmapset->recentEvents()->get();
         foreach ($nominations as $nomination) {
             if ($nomination->type === BeatmapsetEvent::DISQUALIFY) {
                 $disqualifyEvent = $nomination;
             }
             if (isset($userId) && $nomination->user_id === $userId && $nomination->type === BeatmapsetEvent::NOMINATE) {
                 $alreadyNominated = true;
             }
         }
         $result = ['required' => $beatmapset->requiredNominationCount(), 'current' => $beatmapset->currentNominationCount()];
         if (isset($disqualifyEvent)) {
             $result['disqualification'] = ['reason' => $disqualifyEvent->comment, 'created_at' => json_time($disqualifyEvent->created_at)];
         }
         if (isset($userId)) {
             $result['nominated'] = $alreadyNominated ?? false;
         }
         return $this->item($beatmapset, function ($beatmapset) use($result) {
             return $result;
         });
     } elseif ($beatmapset->qualified()) {
         $eta = $beatmapset->rankingETA();
         $result = ['ranking_eta' => json_time($eta)];
         return $this->item($beatmapset, function ($beatmapset) use($result) {
             return $result;
         });
     } else {
         return;
     }
 }
Exemplo n.º 3
0
function update_info()
{
    global $user;
    $sex = get_int('sex');
    $birth_year = get_int('birth_year');
    $user->bolt->update("sex={$sex}, birth_year={$birth_year}");
}
Exemplo n.º 4
0
function remove_admin($team)
{
    $userid = get_int('userid');
    $ret = BoincTeamAdmin::delete("teamid={$team->id} and userid={$userid}");
    if (!$ret) {
        error_page(tra("failed to remove admin"));
    }
}
Exemplo n.º 5
0
 public function show($id)
 {
     $postStartId = Request::input('start');
     $postEndId = get_int(Request::input('end'));
     $nthPost = get_int(Request::input('n'));
     $skipLayout = Request::input('skip_layout') === '1';
     $jumpTo = null;
     $topic = Topic::with('forum.cover')->findOrFail($id);
     $this->authorizeView($topic->forum);
     $posts = $topic->posts();
     if ($postStartId === 'unread') {
         $postStartId = Post::lastUnreadByUser($topic, Auth::user());
     } else {
         $postStartId = get_int($postStartId);
     }
     if ($nthPost !== null) {
         $post = $topic->nthPost($nthPost);
         if ($post) {
             $postStartId = $post->post_id;
         }
     }
     if (!$skipLayout) {
         foreach ([$postStartId, $postEndId, 0] as $jumpPoint) {
             if ($jumpPoint === null) {
                 continue;
             }
             $jumpTo = $jumpPoint;
             break;
         }
     }
     if ($postStartId !== null && !$skipLayout) {
         // move starting post up by ten to avoid hitting
         // page autoloader right after loading the page.
         $postPosition = $topic->postPosition($postStartId);
         $post = $topic->nthPost($postPosition - 10);
         $postStartId = $post->post_id;
     }
     if ($postStartId !== null) {
         $posts = $posts->where('post_id', '>=', $postStartId);
     } elseif ($postEndId !== null) {
         $posts = $posts->where('post_id', '<=', $postEndId)->orderBy('post_id', 'desc');
     }
     $posts = $posts->take(20)->with('user.rank')->with('user.country')->with('user.supports')->get()->sortBy(function ($p) {
         return $p->post_id;
     });
     if ($posts->count() === 0) {
         abort($skipLayout ? 204 : 404);
     }
     $postsPosition = $topic->postsPosition($posts);
     Event::fire(new TopicWasViewed($topic, $posts->last(), Auth::user()));
     $template = $skipLayout ? '_posts' : 'show';
     $cover = fractal_item_array($topic->cover()->firstOrNew([]), new TopicCoverTransformer());
     return view("forum.topics.{$template}", compact('topic', 'posts', 'postsPosition', 'jumpTo', 'cover'));
 }
Exemplo n.º 6
0
function IdQuery($query, $id)
{
    global $app, $db;
    $cleanID = get_int($id);
    // bad request
    if ($cleanID == null) {
        $app->halt(400);
    }
    // execute query
    $result = $db->query(str_replace("_ID_", $cleanID, $query));
    return $result;
}
Exemplo n.º 7
0
function handle_add($job, $inst)
{
    $f = null;
    $f->x = get_int('pic_x');
    $f->y = get_int('pic_y');
    $f->type = sanitize_tags(get_str('type'));
    $c = sanitize_tags(get_str('comment', true));
    if (strstr($c, "(optional)")) {
        $c = "";
    }
    $f->comment = $c;
    $output = $inst->get_opaque_data();
    $output->features[] = $f;
    $inst->set_opaque_data($output);
    header("location: bossa_example4.php?bji={$inst->id}");
}
Exemplo n.º 8
0
 public function discussion($id)
 {
     $returnJson = Request::input('format') === 'json';
     $lastUpdated = get_int(Request::input('last_updated'));
     $beatmapset = Beatmapset::findOrFail($id);
     $discussion = $beatmapset->beatmapsetDiscussion()->firstOrFail();
     if ($returnJson && $lastUpdated !== null && $lastUpdated >= $discussion->updated_at->timestamp) {
         return ['updated' => false];
     }
     $initialData = ['beatmapset' => $beatmapset->defaultJson(), 'beatmapsetDiscussion' => $discussion->defaultJson()];
     if ($returnJson) {
         return $initialData;
     } else {
         return view('beatmapsets.discussion', compact('beatmapset', 'initialData'));
     }
 }
Exemplo n.º 9
0
function show_batch($user)
{
    $batch_id = get_int('batch_id');
    $batch = BoincBatch::lookup_id($batch_id);
    if (!$batch || $batch->user_id != $user->id) {
        error_page("no batch");
    }
    page_head("Batch {$batch->id}");
    $results = BoincResult::enum("batch={$batch->id} order by workunitid");
    $i = 0;
    result_table_start(true, true, null);
    foreach ($results as $result) {
        show_result_row($result, true, true, true, $i++);
    }
    end_table();
    page_tail();
}
Exemplo n.º 10
0
function get_batch_output_files($auth_str)
{
    $batch_id = get_int('batch_id', true);
    if ($batch_id) {
        $batch = BoincBatch::lookup_id($batch_id);
        if (!$batch) {
            die("no batch {$batch_id}");
        }
    } else {
        $batch_name = get_int('batch_name');
        $batch_name = BoincDb::escape_string($batch_name);
        $batch = BoincBatch::lookup("name='{$batch_name}'");
        if (!$batch) {
            die("no batch {$batch_name}");
        }
    }
    $user = BoincUser::lookup_id($batch->user_id);
    if (!$user) {
        die("no user {$batch->user_id}");
    }
    $x = md5($user->authenticator . $batch->id);
    if ($x != $auth_str) {
        die("bad auth str");
    }
    $zip_basename = tempnam("../cache", "boinc_batch_");
    $zip_filename = $zip_basename . ".zip";
    $fanout = parse_config(get_config(), "<uldl_dir_fanout>");
    $upload_dir = parse_config(get_config(), "<upload_dir>");
    $wus = BoincWorkunit::enum("batch={$batch->id}");
    foreach ($wus as $wu) {
        if (!$wu->canonical_resultid) {
            continue;
        }
        $result = BoincResult::lookup_id($wu->canonical_resultid);
        $names = get_outfile_names($result);
        foreach ($names as $name) {
            $path = dir_hier_path($name, $upload_dir, $fanout);
            if (is_file($path)) {
                system(" nice -9 zip -jq {$zip_basename} {$path}");
            }
        }
    }
    do_download($zip_filename);
    unlink($zip_filename);
}
Exemplo n.º 11
0
function print_cart()
{
    global $in_cart;
    if (array_key_exists('игрушка детская велосипед', $in_cart)) {
        if (get_available($in_cart['игрушка детская велосипед']['количество заказано'], $in_cart['игрушка детская велосипед']['осталось на складе']) >= 3) {
            echo '<p>Поздравляем вас с участием в акции, вы купили товар "игрушка детская велосипед" в количестве более 3 штук, и получаете скидку в 30%</p>';
            $in_cart['игрушка детская велосипед']['diskont'] = 'diskont3';
        } else {
            echo 'Купив товар "игрушка детская велосипед" количеством более 3 штук вы получите скидку 30%!';
        }
        $action_profit = get_profit($in_cart['игрушка детская велосипед']['количество заказано'], $in_cart['игрушка детская велосипед']['осталось на складе'], $in_cart['игрушка детская велосипед']['цена']);
    }
    $cart = '<table border="1"><tr>';
    $cart .= '<td>№</td>' . '<td><b>Наименование</b></td>' . '<td><b>Цена</b></td>' . '<td><b>Скидка</b></td>';
    $cart .= '<td><b>В заказе</b></td>' . '<td><b>На складе</b></td>' . '<td><b>Итого со скидкой</b></td></tr>';
    static $total_goods = 0;
    static $total_cost = 0;
    static $count = 0;
    static $total_profit = 0;
    foreach ($in_cart as $key => $val) {
        $item_price = $val['цена'];
        $in_order = $val['количество заказано'];
        $in_stock = $val['осталось на складе'];
        $diskont = get_int($val['diskont']);
        $show_diskont = $diskont > 0 ? $diskont . '0%' : '0%';
        //красивое число скидки в таблице
        $price = get_price($item_price, $diskont, $in_order, $key, $in_stock);
        $cart .= '<tr><td>' . ++$count . '</td>';
        $cart .= '<td>' . $key . '</td>';
        $cart .= '<td>' . $item_price . '</td>';
        $cart .= '<td>' . $show_diskont . '</td>';
        $cart .= '<td>' . $in_order . '</td>';
        $cart .= '<td>' . $in_stock . '</td>';
        $cart .= '<td>' . $price[0] . '</td>';
        $cart .= '</tr>';
        $total_goods += get_available($in_order, $in_stock);
        $total_cost += $price[0];
        $total_profit += $price[1] - $price[0];
    }
    $cart .= '</table>';
    $cart .= $action_profit;
    $cart .= '<table style="border:1px solid gray;background:lightgray"><tr><td>ИТОГО в заказе:</td><td> - ' . $count . ' наименования,<br/>';
    $cart .= '- ' . $total_goods . ' товаров,<br/> - ' . $total_cost . ' сумма к оплате,<br/> - ' . $total_profit . ' сэкономлено на скидках</td></tr></table>';
    return $cart;
}
Exemplo n.º 12
0
function validate()
{
    $x = get_str("x");
    $u = get_int("u");
    $user = lookup_user_id($u);
    if (!$user) {
        error_page(tra("No such user."));
    }
    $x2 = $user->signature;
    if ($x2 != $x) {
        error_page(tra("Error in URL data - can't validate email address"));
    }
    $result = $user->update("email_validated=1");
    if (!$result) {
        error_page(tra("Database update failed - please try again later."));
    }
    page_head(tra("Validate email address"));
    echo tra("The email address of your account has been validated.");
    page_tail();
}
 public function includeCurrentUserAttributes(BeatmapDiscussion $discussion, ParamBag $params = null)
 {
     if ($params === null) {
         return;
     }
     $userId = get_int($params->get('user_id')[0] ?? null);
     if ($userId === null) {
         return;
     }
     $score = 0;
     // This assumes beatmapDiscussionVotes are already preloaded and
     // thus will save one query.
     foreach ($discussion->beatmapDiscussionVotes as $vote) {
         if ($vote->user_id === $userId) {
             $score = $vote->score;
             break;
         }
     }
     return $this->item($discussion, function ($discussion) use($score) {
         return ['vote_score' => $score];
     });
 }
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
if (DISABLE_PROFILES) {
    error_page("Profiles are disabled");
}
check_get_args(array("search_string", "offset"));
function show_profile_link2($profile, $n)
{
    $user = BoincUser::lookup_id($profile->userid);
    echo "<tr><td>" . user_links($user) . "</td><td>" . date_str($user->create_time) . "</td><td>{$user->country}</td><td>" . (int) $user->total_credit . "</td><td>" . (int) $user->expavg_credit . "</td></tr>\n";
}
$search_string = get_str('search_string');
$search_string = sanitize_tags($search_string);
$search_string = BoincDb::escape_string($search_string);
$offset = get_int('offset', true);
if (!$offset) {
    $offset = 0;
}
$count = 10;
page_head(tra("Profiles containing '%1'", $search_string));
$profiles = BoincProfile::enum("match(response1, response2) against ('{$search_string}') limit {$offset},{$count}");
start_table();
echo "\n    <tr><th>" . tra("User name") . "</th>\n    <th>" . tra("Joined project") . "</th>\n    <th>" . tra("Country") . "</th>\n    <th>" . tra("Total credit") . "</th>\n    <th>" . tra("Recent credit") . "</th></tr>\n";
$n = 0;
foreach ($profiles as $profile) {
    show_profile_link2($profile, $n + $offset + 1);
    $n += 1;
}
end_table();
if ($offset == 0 && $n == 0) {
Exemplo n.º 15
0
    if ($passwd_hash != $user->passwd_hash) {
        page_head("Password incorrect");
        echo "The password you entered is incorrect. Please try again.\n";
        print_login_form_aux($next_url, null, $email_addr);
        page_tail();
        exit;
    }
    $authenticator = $user->authenticator;
    Header("Location: {$next_url}");
    $perm = $_POST['stay_logged_in'];
    send_cookie('auth', $authenticator, $perm);
    exit;
}
// check for time/id/hash case.
$id = get_int('id', true);
$t = get_int('t', true);
$h = get_str('h', true);
if ($id && $t && $h) {
    $user = BoincUser::lookup_id($id);
    if (!$user) {
        error_page("Invalid user ID.\r\n\t\t\tPlease make sure you visited the complete URL;\r\n\t\t\tit may have been split across lines by your email reader.");
    }
    $x = $id . $user->authenticator . $t;
    $x = md5($x);
    $x = substr($x, 0, 16);
    if ($x != $h) {
        error_page("Invalid authenticator.\r\n\t\t\tPlease make sure you visited the complete URL;\r\n\t\t\tit may have been split across lines by your email reader.");
    }
    if (time() - $t > 86400) {
        error_page("Link has expired;\r\n\t\t\tgo <a href=get_passwd.php>here</a> to\r\n\t\t\tget a new login link by email.");
    }
Exemplo n.º 16
0
// 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/>.
//
// This file was modified by contributors of "BOINC Web Tweak" project.
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, ";")) {
    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)) {
Exemplo n.º 17
0
//
// 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/>.
// 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();
Exemplo n.º 18
0
{
    return $a->time < $b->time;
}
function notices_rss_start()
{
    $t = gmdate('D, d M Y H:i:s', time()) . " GMT";
    header("Expires: {$t}");
    header("Last-Modified: {$t}");
    header("Content-Type: application/xml");
    echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n        <rss version=\"2.0\">\n        <channel>\n        <title>" . PROJECT . " notices</title>\n        <link>" . URL_BASE . "</link>\n        <description>Notices</description>\n        <lastBuildDate>{$t}</lastBuildDate>\n    ";
}
function notices_rss_end()
{
    echo "\n        </channel>\n        </rss>\n    ";
}
$userid = get_int('userid');
$auth = get_str('auth');
$since_time = time() - 30 * 86400;
$user = BoincUser::lookup_id($userid);
if (!$user) {
    xml_error();
}
// the auth in the URL includes "userid_"
//
$x = $user->id . "_" . notify_rss_auth($user);
if ($x != $auth) {
    xml_error(-155, 'Invalid authenticator');
}
$since_clause = "and create_time > {$since_time}";
$notifies = BoincNotify::enum("userid = {$userid} {$since_clause}");
$forum = news_forum();
Exemplo n.º 19
0
// 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/>.
// This file allows people to subscribe to threads.
// Whenever someone posts to the thread
// the subscribers will receive a notification email
require_once '../inc/forum.inc';
if (DISABLE_FORUMS) {
    error_page("Forums are disabled");
}
check_get_args(array("action", "thread", "tnow", "ttok"));
$action = get_str('action');
$threadid = get_int('thread');
$thread = BoincThread::lookup_id($threadid);
$forum = BoincForum::lookup_id($thread->forum);
function show_title($forum, $thread)
{
    switch ($forum->parent_type) {
        case 0:
            $category = BoincCategory::lookup_id($forum->category);
            show_forum_title($category, $forum, $thread);
            break;
        case 1:
            show_team_forum_title($forum, $thread);
            break;
    }
}
function subscribe($forum, $thread, $user)
Exemplo n.º 20
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/>.
require_once "../inc/cache.inc";
require_once "../inc/util.inc";
require_once "../inc/boinc_db.inc";
require_once "../inc/team.inc";
check_get_args(array("teamid"));
$teamid = get_int("teamid");
$team = BoincTeam::lookup_id($teamid);
$get_from_db = false;
$user = get_logged_in_user(false);
// always show fresh copy to admins; they might be editing info
//
if (is_team_admin($user, $team)) {
    $get_from_db = true;
}
if ($user->id == $team->ping_user) {
    $get_from_db = true;
}
// Cache the team record, its forum record, its new members,
// its admins, and its member counts
$cache_args = "teamid={$teamid}";
if (!$get_from_db) {
Exemplo n.º 21
0
// 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/>.
include_once "../inc/util.inc";
include_once "../inc/prefs.inc";
include_once "../inc/prefs_project.inc";
check_get_args(array("subset", "venue", "confirmed", "cols", "tnow", "ttok"));
$user = get_logged_in_user();
check_tokens($user->authenticator);
$subset = get_str("subset");
$venue = get_str("venue");
$confirmed = get_str("confirmed", true);
$columns = get_int("cols", true);
$c = $columns ? "&cols={$columns}" : "";
if ($confirmed) {
    if ($subset == "global") {
        $main_prefs = prefs_parse_global($user->global_prefs);
        $main_prefs->{$venue} = null;
        global_prefs_update($user, $main_prefs);
    } else {
        $main_prefs = prefs_parse_project($user->project_prefs);
        $main_prefs->{$venue} = null;
        project_prefs_update($user, $main_prefs);
    }
    Header("Location: prefs.php?subset={$subset}{$c}");
} else {
    page_head(tra("Confirm delete preferences"));
    $tokens = url_tokens($user->authenticator);
Exemplo n.º 22
0
// If output as xml the user may optionally
// also get a list of hosts in case the user provides his/her authenticator.
// Object-caching and full-file caching is used to speed up queries
// for data from this page.
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
require_once "../inc/cache.inc";
require_once "../inc/util.inc";
require_once "../inc/xml.inc";
require_once "../inc/boinc_db.inc";
require_once "../inc/user.inc";
require_once "../inc/forum.inc";
require_once "../project/project.inc";
$auth = get_str("auth", true);
if (!$auth) {
    $id = get_int("userid");
}
$format = get_str("format", true);
if ($format == "xml") {
    // don't do caching for XML
    xml_header();
    $retval = db_init_xml();
    if ($retval) {
        xml_error($retval);
    }
    if ($auth) {
        $user = lookup_user_auth($auth);
        $show_hosts = true;
    } else {
        $user = lookup_user_id($id);
        $show_hosts = false;
Exemplo n.º 23
0
<?php

// osu config~
return ['bbcode' => ['uid' => '1337'], 'beatmaps' => ['max' => 50, 'max-scores' => 50], 'beatmap_processor' => ['mirrors_to_use' => array_map('intval', explode(' ', env('BM_PROCESSOR_MIRRORS', '1'))), 'thumbnailer' => env('BM_PROCESSOR_THUMBNAILER', 'http://*****:*****@ppy.sh'], 'forum' => ['admin_forum_id' => intval(env('ADMIN_FORUM_ID', 28)), 'help_forum_ids' => array_map('intval', explode(' ', env('HELP_FORUM_IDS', '4 5 29 30 101'))), 'double_post_time' => ['normal' => 72, 'author' => 24], 'feature_forum_id' => get_int(env('FEATURE_FORUM_ID')), 'slack_watch' => ['forum_ids' => array_map('intval', explode(' ', env('SLACK_WATCH_FORUM_IDS', '5 29 101 4 30 2'))), 'topic_ids' => array_map('intval', explode(' ', env('SLACK_WATCH_TOPIC_IDS', '259747')))]], 'mp-history' => ['event-count' => 500], 'legacy' => ['shared_cookie_secret' => env('SHARED_COOKIE_SECRET', '')], 'store' => ['delayed_shipping_order_threshold' => env('DELAYED_SHIPPING_ORDER_THRESHOLD', 100), 'delayed_shipping_order_message' => env('DELAYED_SHIPPING_ORDER_MESSAGE'), 'notice' => presence(str_replace('\\n', "\n", env('STORE_NOTICE')))], 'twitch_client_id' => env('TWITCH_CLIENT_ID'), 'urls' => ['base' => 'https://osu.ppy.sh', 'smilies' => '/forum/images/smilies', 'support-the-game' => '/p/support#transactionarea', 'legal' => ['dmca' => '/p/copyright', 'tos' => '/p/terms'], 'social' => ['facebook' => 'https://facebook.com/osugame', 'twitter' => '/p/twitter'], 'status' => ['osustatus' => 'https://twitter.com/osustatus', 'server' => 'http://stat.ppy.sh/'], 'user' => ['kudosu' => '/wiki/Kudosu', 'recover' => '/p/forgot-email', 'rules' => '/wiki/Osu!:Rules', 'signup' => '/p/register'], 'ranking' => ['overall' => '/p/pp', 'charts' => '/p/chart', 'country' => '/p/countryranking', 'mapper' => '/p/kudosu'], 'home' => ['changelog' => '/p/changelog', 'download' => '/p/download'], 'help' => ['wiki' => '/wiki/Main_Page', 'faq' => '/wiki/FAQ', 'support' => 'http://help.ppy.sh/']], 'user' => ['user_page_forum_id' => intval(env('USER_PAGE_FORUM_ID', 70)), 'verification_key_length_hex' => 8, 'verification_key_tries_limit' => 8]];
Exemplo n.º 24
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}");
}
Exemplo n.º 25
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/>.
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
require_once "../inc/team.inc";
if (DISABLE_TEAMS) {
    error_page("Teams are disabled");
}
check_get_args(array("format", "team_id", "team_ids", "team_name"));
$format = get_str("format", true);
$team_id = get_int("team_id", true);
$team_ids = get_str("team_ids", true);
BoincDb::get(true);
if ($team_id || $team_ids || $format == 'xml') {
    require_once '../inc/xml.inc';
    xml_header();
    $retval = db_init_xml();
    if ($retval) {
        xml_error($retval);
    }
}
if ($team_id) {
    $team = BoincTeam::lookup_id($team_id);
    if ($team) {
        show_team_xml($team);
    } else {
Exemplo n.º 26
0
    $host_content .= "\n    Swap Space: {$y} MB";
    $x = $host->d_total / (1024 * 1024 * 1024);
    $y = round($x, 2);
    $host_content .= "\n    Total Disk Space: {$y} GB";
    $x = $host->d_free / (1024 * 1024 * 1024);
    $y = round($x, 2);
    $host_content .= "\n    Free Disk Space: {$y} GB\n    Avg network bandwidth (upstream): {$host->n_bwup} bytes/sec\n    Avg network bandwidth (downstream): {$host->n_bwdown} bytes/sec";
    $x = $host->avg_turnaround / 86400;
    $host_content .= "\n    Average turnaround: " . round($x, 2) . " days\n    Number of RPCs: {$host->rpc_seqno}\n    Last RPC: " . time_str($host->rpc_time) . "\n    % of time client on: " . 100 * $host->on_frac . " %\n    % of time host connected: " . 100 * $host->connected_frac . " %\n    % of time user active: " . 100 * $host->active_frac . " %\n    # of results today: " . $host->nresults_today;
    $subject = PROJECT . " notice for {$user->name}";
    $body = PROJECT . " notification:\n\nDear {$user->name}\nYour machine (host # {$host->id}) described below appears to have a misconfigured BOINC\ninstallation.  Could you please have a look at it?\n\nSincerely,\n        The " . PROJECT . " team\n";
    $body .= "\n\nThis is the content of our database:\n" . $host_content . "\n\nFor further information and assistance with " . PROJECT . " go to {$master_url}";
    echo nl2br($body) . "<br><br>";
    return send_email($user, $subject, $body);
}
$hostid = get_int("hostid", true);
if (!$hostid) {
    admin_page_head("Misconfigured Host");
    echo "This script sends an email to the owner of the supplied host which says that something gone wrong with his configuration.<br>";
    echo "<br><form method=\"get\" action=\"problem_host.php\">\n    Host ID: \n    <input type=\"text\" size=\"5\" name=\"hostid\">\n    <input class=\"btn btn-default\" type=\"submit\" value=\"Send Email\">\n    </form>\n    ";
} else {
    $host = BoincHost::lookup_id($hostid);
    if (!$host) {
        echo "<h2>No host with that ID</h2>\n\t \t<center>Please <a href=\"problem_host.php\">try again</a></center>";
    } else {
        $user = BoincUser::lookup_id($host->userid);
        echo "<a href=\"problem_host.php\">Do another?</a><br><br>";
        send_problem_email($user, $host);
        echo "Email to " . $user->email_addr . " has been sent.<br>";
    }
}
Exemplo n.º 27
0
        echo "<post>\n";
        echo "    <id>{$post->id}</id>\n";
        echo "    <threadid>{$post->thread}</threadid>\n";
        echo "    <threadtitle><![CDATA[" . $thread->title . "]]></threadtitle>\n";
        echo "    <timestamp>{$post->timestamp}</timestamp>\n";
        if ($length > 0) {
            echo "    <content><![CDATA[" . substr($post->content, 0, $length) . "]]></content>\n";
        } else {
            echo "    <content><![CDATA[" . $post->content . "]]></content>\n";
        }
        echo "</post>\n";
    }
    echo "</posts>\n";
    echo "</rpc_response>\n";
} elseif ($method == "user_threads") {
    $count = get_int("count", true);
    if (!$count || $count <= 0 || $count > 50) {
        $count = 10;
    }
    $threads = BoincThread::enum("owner={$userid} ORDER BY timestamp DESC LIMIT {$count}");
    $count = count($threads);
    echo "<rpc_response>\n";
    echo "<count>{$count}</count>\n";
    echo "<threads>\n";
    foreach ($threads as $thread) {
        echo "<thread>\n";
        echo "    <id>{$thread->id}</id>\n";
        echo "    <forumid>{$thread->forum}</forumid>\n";
        echo "    <replies>{$thread->replies}</replies>\n";
        echo "    <views>{$thread->views}</views>\n";
        echo "    <timestamp>{$thread->timestamp}</timestamp>\n";
Exemplo n.º 28
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/>.
// limit a given host to 1 job per day
// TODO: document; use new DB interface
include_once "../inc/db.inc";
include_once "../inc/util.inc";
include_once "../inc/db_ops.inc";
include_once "../inc/util_ops.inc";
include_once "../inc/prefs.inc";
db_init();
if (get_int('hostid')) {
    $hostid = get_int('hostid');
} else {
    error_page("no hostid");
}
$timestr = time_str(time(0));
$title = "host " . $hostid . " max_results_day set to 1 at " . $timestr;
admin_page_head($title);
if ($hostid > 0) {
    $result = _mysql_query("UPDATE host SET max_results_day=1 WHERE id=" . $hostid);
}
echo $title;
admin_page_tail();
Exemplo n.º 29
0
function get_host($hostid, $user)
{
    $host = BoincHost::lookup_id($hostid);
    if (!$host || $host->userid != $user->id) {
        fail("We have no record of that computer");
    }
    return $host;
}
$user = get_logged_in_user();
page_head("Merge computer records");
$nhosts = get_int("nhosts");
$hostid = get_int("id_0");
$latest_host = get_host($hostid, $user);
for ($i = 1; $i < $nhosts; $i++) {
    $var = "id_{$i}";
    $hostid = get_int($var, true);
    if (!$hostid) {
        continue;
    }
    $host = get_host($hostid, $user);
    if ($host->create_time > $latest_host->create_time) {
        $error = merge_hosts($latest_host, $host);
        if ($error) {
            echo "<br />{$error}\n";
            continue;
        }
        $latest_host = $host;
    } else {
        merge_hosts($host, $latest_host);
    }
    // reread latest_host from database since we just
Exemplo n.º 30
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) {
    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