Exemple #1
0
function show_user_wap($userid)
{
    wap_begin();
    $user = BoincUser::lookup_id($userid);
    if (!$user) {
        echo "<br/>" . tra("User not found!") . "<br/>";
        wap_end();
        return;
    }
    if ($user->teamid) {
        $team = BoincTeam::lookup_id($user->teamid);
    }
    $wapstr = PROJECT . "<br/>" . tra("Account Data<br/>for %1<br/>Time:", $user->name) . " " . wap_timestamp();
    $wapstr .= show_credit_wap($user);
    if ($user->teamid && $team) {
        $wapstr .= "<br/>" . tra("Team:") . " " . $team->name . "<br/>";
        $wapstr .= tra("Team TotCred:") . " " . format_credit($team->total_credit) . "<br/>";
        $wapstr .= tra("Team AvgCred:") . " " . format_credit($team->expavg_credit) . "<br/>";
    } else {
        $wapstr .= "<br/>" . tra("Team: None") . "<br/>";
    }
    // don't want to send more than 1KB (WAP limit)
    //
    if (strlen($wapstr) > 1024) {
        $wapstr = substr($wapstr, 0, 1024);
    }
    echo $wapstr;
    wap_end();
}
Exemple #2
0
function show_row($x, $y, $mode, $i)
{
    $class = $i % 2 ? "row0" : "row1";
    echo "<tr class={$class}><td>";
    switch ($mode) {
        case 'host':
            echo "<a href=show_host_detail.php?hostid={$x}>{$x}</a>";
            break;
        case 'user':
            $user = BoincUser::lookup_id($x);
            echo "<a href=show_user.php?userid={$x}>{$user->name}</a>";
            break;
        case 'team':
            $team = BoincTeam::lookup_id($x);
            if ($team) {
                echo "<a href=team_display.php?teamid={$x}>{$team->name}</a>";
            } else {
                echo "(no team)";
            }
            break;
        case 'model':
            echo $x;
            break;
        case 'day':
            echo $x;
            break;
    }
    echo "</td><td align=right>" . format_credit_large($y->credit), "</td><td align=right>{$y->nresults}</td></tr>\n";
}
function export($is_user, $dir)
{
    $n = 0;
    $filename = $is_user ? "{$dir}/user_work" : "{$dir}/team_work";
    $f = fopen($filename, "w");
    if (!$f) {
        die("fopen");
    }
    $is_user ? fprintf($f, "<users>\n") : fprintf($f, "<teams>\n");
    $maxid = $is_user ? BoincUser::max("id") : BoincTeam::max("id");
    while ($n <= $maxid) {
        $m = $n + 1000;
        if ($is_user) {
            $items = BoincUser::enum_fields("id", "id>={$n} and id<{$m} and total_credit>0");
        } else {
            $items = BoincTeam::enum_fields("id", "id>={$n} and id<{$m} and total_credit>0");
        }
        foreach ($items as $item) {
            export_item($item, $is_user, $f);
        }
        $n = $m;
    }
    $is_user ? fprintf($f, "</users>\n") : fprintf($f, "</teams>\n");
    fclose($f);
    system("gzip -f {$filename}");
}
Exemple #4
0
function send_notify_email($userid, $message)
{
    $user = BoincUser::lookup_id($userid);
    $subject = "Daily notification summary from " . PROJECT;
    $body = "The following events occurred in the past day at " . PROJECT . ".\nFor details, visit your Account page at\n" . secure_url_base() . "home.php\n\n{$message}\n---------------\nTo change your email preferences for " . PROJECT . ", visit:\n" . secure_url_base() . "edit_forum_preferences_form.php\n\nDo not reply to this email.\n";
    send_email($user, $subject, $body);
    echo "sending to {$user->email_addr}\n";
}
Exemple #5
0
function project_flops()
{
    $x = BoincUser::sum("expavg_credit");
    if ($x == 0) {
        $x = 200;
    }
    $y = 1000000000.0 * $x / 200;
    return $y;
}
Exemple #6
0
function update_user_posts()
{
    $users = BoincUser::enum();
    foreach ($users as $user) {
        $num = BoincPost::count("user={$user->id}");
        if ($num != $user->posts) {
            echo "user {$user->id}: {$user->posts} {$num}\n";
            $user->update("posts={$num}");
        }
    }
}
Exemple #7
0
function get_top_participants($offset, $sort_by)
{
    global $users_per_page;
    $db = BoincDb::get(true);
    if ($sort_by == "total_credit") {
        $sort_order = "total_credit desc";
    } else {
        $sort_order = "expavg_credit desc";
    }
    return BoincUser::enum(null, "order by {$sort_order} limit {$offset},{$users_per_page}");
}
function send_founder_transfer_email($team, $user)
{
    $founder = BoincUser::lookup_id($team->userid);
    // send founder a private message for good measure
    $subject = "Team founder transfer request";
    $body = "Team member " . $user->name . " has asked that you\ntransfer foundership of {$team->name}.\nPlease go [url=" . URL_BASE . "team_change_founder_form.php?teamid={$team->id}]here[/url] to grant or decline the request.\n    \nIf you do not respond within 60 days, " . $user->name . " will\nbe allowed to become the team founder.\n";
    pm_send($user, $founder, $subject, $body, false);
    $subject = PROJECT . " team founder transfer";
    $body = "Team member " . $user->name . " has asked that you\ntransfer foundership of {$team->name} in " . PROJECT . ".\nPlease visit\n" . URL_BASE . "team_change_founder_form.php?teamid=" . $team->id . "\nto grant or decline the request.\n    \nIf you do not respond within 60 days, " . $user->name . " will\nbe allowed to become the team founder.\n    \nPlease do not respond to this email.\nThe mailbox is not monitored and the email\nwas sent using an automated system.";
    return send_email($founder, $subject, $body);
}
function show_delta($delta)
{
    global $xml;
    $user = BoincUser::lookup_id($delta->userid);
    $when = time_str($delta->timestamp);
    $what = $delta->joining ? "joined" : "quit";
    if ($xml) {
        echo "    <action>\n        <id>{$user->id}</id>\n        <name>{$user->name}</name>\n        <action>{$what}</action>\n        <total_credit>{$delta->total_credit}</total_credit>\n        <when>{$when}</when>\n    </action>\n";
    } else {
        echo "<tr>\n           <td>{$when}</td>\n           <td>", user_links($user), " (ID {$user->id})</td>\n           <td>{$what}</td>\n           <td>{$delta->total_credit}</td>\n           </tr>\n        ";
    }
}
Exemple #10
0
function show_admin_page($user, $team)
{
    page_head(tra("Team administration for %1", $team->name));
    echo "\n        <ul>\n        <li><a href=team_edit_form.php?teamid={$team->id}>" . tra("Edit team info") . "</a>\n            <br><p class=\"text-muted\">" . tra("Change team name, URL, description, type, or country") . "</p>\n        <li>\n            " . tra("Member list:") . "\n        <a href=team_email_list.php?teamid={$team->id}>" . tra("HTML") . "</a>\n        &middot; <a href=team_email_list.php?teamid={$team->id}&plain=1>" . tra("text") . "</a>\n            <br><p class=\"text-muted\">" . tra("View member names and email addresses") . "</p>\n        <li>" . tra("View change history:") . "\n            <a href=team_delta.php?teamid={$team->id}>" . tra("HTML") . "</a>\n            &middot; <a href=team_delta.php?teamid={$team->id}&xml=1>" . tra("XML") . "</a>\n            <br><p class=\"text-muted\">" . tra("See when members joined or quit this team") . "</p>\n    ";
    // founder-only stuff follows
    //
    if ($team->userid == $user->id) {
        $tokens = url_tokens($user->authenticator);
        if ($team->ping_user > 0) {
            $user2 = BoincUser::lookup_id($team->ping_user);
            $deadline = date_str(transfer_ok_time($team));
            echo "<li>\n                <a href=team_change_founder_form.php?teamid={$team->id}><font color=red><strong>" . tra("Respond to foundership request.") . "</strong></font></a>  " . tra("If you don't respond by %1, %2 may assume foundership of this team.", $deadline, $user2->name);
        }
        echo "\n            <li><a href=team_remove_inactive_form.php?teamid={$team->id}>" . tra("Remove members") . "</a>\n                <br><p class=\"text-muted\">" . tra("Remove inactive or unwanted members from this team") . "</p>\n            <li><a href=team_change_founder_form.php?teamid={$team->id}>" . tra("Change founder") . "</a>\n                <br><p class=\"text-muted\">" . tra("Transfer foundership to another member") . "</p>\n            <li><a href=team_admins.php?teamid={$team->id}>" . tra("Add/remove Team Admins") . "</a>\n                <br><p class=\"text-muted\">" . tra("Give selected team members Team Admin privileges") . "</p>\n\n            <li><a href=team_manage.php?teamid={$team->id}&action=delete&{$tokens}>" . tra("Remove team") . "</a>\n                <br><p class=\"text-muted\">" . tra("Allowed only if team has no members") . "</p>\n            <li><a href=team_forum.php?teamid={$team->id}&cmd=manage>" . tra("Message board") . "</a>\n                <br><p class=\"text-muted\">" . tra("Create or manage a team message board") . "</p>\n        ";
    }
    echo "\n\n        <p>\n        <li>\n            " . tra("To have this team created on all BOINC projects (current and future) you can make it into a %1BOINC-wide team%2.", "<a href=http://boinc.berkeley.edu/teams/>", "</a>") . "\n        <li>\n            " . tra("Team admins are encouraged to join and participate in the Google %1boinc-team-founders%2 group.", "<a href=http://groups.google.com/group/boinc-team-founders>", "</a>") . "\n    </ul>\n    ";
    page_tail();
}
Exemple #11
0
function handle_team($team, $f)
{
    $user = BoincUser::lookup_id($team->userid);
    if (!$user) {
        echo "no user for team {$team->id}\n";
        exit(1);
    }
    if ($user->teamid != $team->id) {
        echo "Founder is not member of {$team->name}\n";
        return;
    }
    if (!$user->email_validated) {
        echo "the founder of {$team->name}, {$user->email_addr}, is not validated\n";
        return;
    }
    $user_email_munged = str_rot13($user->email_addr);
    fwrite($f, "<team>\n   <name>" . htmlspecialchars($team->name) . "</name>\n   <url>" . htmlspecialchars($team->url) . "</url>\n   <type>{$team->type}</type>\n   <name_html>" . htmlspecialchars($team->name_html) . "</name_html>\n   <description>\n" . htmlspecialchars($team->description) . "\n\t</description>\n   <country>{$team->country}</country>\n   <id>{$team->id}</id>\n   <user_email_munged>{$user_email_munged}</user_email_munged>\n   <user_name>" . htmlspecialchars($user->name) . "</user_name>\n   <user_country>" . htmlspecialchars($user->country) . "</user_country>\n   <user_postal_code>" . htmlspecialchars($user->postal_code) . "</user_postal_code>\n   <user_url>" . htmlspecialchars($user->url) . "</user_url>\n</team>\n");
}
Exemple #12
0
function show_admin_page($user, $team)
{
    page_head("Team administration for {$team->name}");
    echo "\r\n\t\t<ul>\r\n\t\t<li><a href=team_edit_form.php?teamid={$team->id}>Edit team info</a>\r\n\t\t\t<br><span class=note>Change team name, URL, description, type, or country</span>\r\n\t\t<li>\r\n\t\t\tMember list:\r\n\t\t<a href=team_email_list.php?teamid={$team->id}>HTML</a>\r\n\t\t| <a href=team_email_list.php?teamid={$team->id}&plain=1>text</a>\r\n\t\t\t<br><span class=note> View member names and email addresses </span>\r\n\t\t<li>View change history:\r\n\t\t\t<a href=team_delta.php?teamid={$team->id}>HTML</a>\r\n\t\t\t| <a href=team_delta.php?teamid={$team->id}&xml=1>XML</a>\r\n\t\t\t<br><span class=note>See when members joined or quit this team</span>\r\n\t";
    // founder-only stuff follows
    //
    if ($team->userid == $user->id) {
        $tokens = url_tokens($user->authenticator);
        if ($team->ping_user > 0) {
            $user2 = BoincUser::lookup_id($team->ping_user);
            $deadline = date_str(transfer_ok_time($team));
            echo "<li>\r\n\t\t\t\t<a href=team_change_founder_form.php?teamid={$team->id}><font color=red><b>Respond to foundership request</b></font></a>.  If you don't respond by {$deadline}, {$user2->name} may assume foundership of this team.\r\n\t\t\t";
        }
        echo "\r\n\t\t\t<li><a href=team_remove_inactive_form.php?teamid={$team->id}>Remove members</a>\r\n\t\t\t\t<br><span class=note>Remove inactive or unwanted members from this team</span>\r\n\t\t\t<li><a href=team_change_founder_form.php?teamid={$team->id}>Change founder</a>\r\n\t\t\t\t<br><span class=note>Transfer foundership to another member</span>\r\n\t\t\t<li><a href=team_admins.php?teamid={$team->id}>Add/remove Team Admins</a>\r\n\t\t\t\t<br><span class=note>Give selected team members Team Admin privileges</span>\r\n\r\n\t\t\t<li><a href=team_manage.php?teamid={$team->id}&action=delete&{$tokens}>Remove team</a>\r\n\t\t\t\t<br><span class=note>Allowed only if team has no members</a>\r\n\t\t\t<li><a href=team_forum.php?teamid={$team->id}&cmd=manage>Message board</a>\r\n\t\t\t\t<br><span class=note>Create or manage team message board</span>\r\n\t\t";
    }
    echo "\r\n\r\n\t\t<p>\r\n\t\t<li>\r\n\t\t\tTo have this team created on all BOINC projects\r\n\t\t\t(current and future) you can make it into a\r\n\t\t\t<a href=http://boinc.berkeley.edu/teams/>BOINC-wide team</a>.\r\n\t\t<li>\r\n\t\t\tTeam admins are encouraged to join and participate in the Google\r\n\t\t\t<a href=http://groups.google.com/group/boinc-team-founders>boinc-team-founders</a> group.\r\n\t\t<li>\r\n\t\t\tOther resources for BOINC team admins\r\n\t\t\tare available from a third-party site,\r\n\t\t\t<a href=http://www.boincteams.com>www.boincteams.com</a>.\r\n\t</ul>\r\n\t";
    page_tail();
}
function add_admin($team)
{
    $email_addr = get_str('email_addr');
    $user = BoincUser::lookup("email_addr='{$email_addr}'");
    if (!$user) {
        error_page(tra("no such user"));
    }
    if ($user->teamid != $team->id) {
        error_page(tra("User is not member of team"));
    }
    if (is_team_admin($user, $team)) {
        error_page(tra("%1 is already an admin of %2", $email_addr, $team->name));
    }
    $now = time();
    $ret = BoincTeamAdmin::insert("(teamid, userid, create_time) values ({$team->id}, {$user->id}, {$now})");
    if (!$ret) {
        error_page(tra("Couldn't add admin"));
    }
}
function validate()
{
    $x = get_str("x");
    $u = get_int("u");
    $user = BoincUser::lookup_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();
}
Exemple #15
0
function notify_users()
{
    $now = time();
    $rs = BoltRefresh::enum("due_time < {$now}");
    $users = array();
    foreach ($rs as $r) {
        $view = BoltView::lookup_id($r->view_id);
        $user_id = $view->user_id;
        if (!key_exists($user_id)) {
            $user = BoincUser::lookup_id($user_id);
            BoltUser::lookup($user);
            $user->refresh = array();
            $users[$user_id] = $user;
        }
        $users[$user_id]->refresh[] = $r;
    }
    foreach ($users as $user) {
        notify_user($user);
    }
}
function process_batch($b)
{
    $app = BoincApp::lookup_id($b->app_id);
    if (!$app) {
        echo "no app for batch {$b->id}\n";
        return;
    }
    if ($b->fraction_done > 0 && $b->credit_canonical > 0) {
        $credit_total = $b->credit_canonical / $b->fraction_done;
        $fpops_total = $credit_total * (86400000000000.0 / 200);
    } else {
        $db = BoincDb::get();
        $fpops_total = $db->sum("workunit", "rsc_fpops_est*target_nresults", "where batch={$b->id}");
    }
    echo "batch {$b->id} fpops_total {$fpops_total}\n";
    if ($fpops_total == 0) {
        return;
    }
    // adjust the user's logical start time
    //
    $user = BoincUser::lookup_id($b->user_id);
    if (!$user) {
        die("no user {$b->user_id}\n");
    }
    $us = BoincUserSubmit::lookup_userid("{$user->id}");
    if (!$us) {
        die("no user submit record\n");
    }
    $lst = $us->logical_start_time;
    $cmd = "cd ../../bin; ./adjust_user_priority --user {$user->id} --flops {$fpops_total} --app {$app->name}";
    system($cmd);
    $us = BoincUserSubmit::lookup_userid("{$user->id}");
    $let = $us->logical_start_time;
    $let = (int) $let;
    // set the priority of workunits and results in this batch
    // to the user's new logical start time
    //
    $clause = "priority={$let} where batch={$b->id}";
    BoincResult::update_aux($clause);
    BoincWorkunit::update_aux($clause);
}
Exemple #17
0
function assign_badges($is_user, $badge_pctiles, $badge_images)
{
    $kind = $is_user ? "user" : "team";
    $badges = get_pct_badges($kind . "_pct", $badge_pctiles, $badge_images);
    $pctiles = get_percentiles($is_user, $badge_pctiles);
    //echo "thresholds for $kind badges: $pctiles[0] $pctiles[1] $pctiles[2]\n";
    $n = 0;
    $maxid = $is_user ? BoincUser::max("id") : BoincTeam::max("id");
    while ($n <= $maxid) {
        $m = $n + 1000;
        if ($is_user) {
            $items = BoincUser::enum_fields("id, expavg_credit", "id>={$n} and id<{$m} and total_credit>0");
        } else {
            $items = BoincTeam::enum_fields("id, expavg_credit", "id>={$n} and id<{$m} and total_credit>0");
        }
        foreach ($items as $item) {
            assign_pct_badge($is_user, $item, $pctiles, $badges);
            // ... assign other types of badges
        }
        $n = $m;
    }
}
Exemple #18
0
function show_row($item, $apps, $is_team, $i)
{
    $j = $i % 2;
    if ($is_team) {
        $team = BoincTeam::lookup_id($item->teamid);
        if (!$team) {
            return;
        }
        $x = "<td>" . team_links($team) . "</td>\n";
    } else {
        $user = BoincUser::lookup_id($item->userid);
        if (!$user) {
            return;
        }
        $x = "<td>" . user_links($user, BADGE_HEIGHT_MEDIUM) . "</td>\n";
    }
    echo "<tr class=row{$j}>";
    echo "<td>{$i}</td>\n";
    echo $x;
    foreach ($apps as $app) {
        if ($app->id == $item->appid) {
            $c = $item;
        } else {
            if ($is_team) {
                $c = BoincCreditTeam::lookup("teamid={$item->teamid} and appid={$app->id}");
            } else {
                $c = BoincCreditUser::lookup("userid={$item->userid} and appid={$app->id}");
            }
            if (!$c) {
                $c = new StdClass();
                $c->expavg = 0;
                $c->total = 0;
            }
        }
        echo "<td align=right>" . format_credit($c->expavg) . "</td><td align=right>" . format_credit_large($c->total) . "</td>\n";
    }
    echo "</tr>\n";
}
function do_pass()
{
    $int_max = 2147483647;
    $now = time();
    $insts = BossaJobInst::enum("timeout < {$now}");
    if (!count($insts)) {
        return false;
    }
    foreach ($insts as $inst) {
        BossaDb::start_transaction();
        $inst = BossaJobInst::lookup_id($inst->id);
        // reread instance within transation
        if ($inst->transition_time < $now) {
            $job = BossaJob::lookup_id($inst->job_id);
            $user = BoincUser::lookup_id($inst->user_id);
            BossaUser::lookup($user);
            job_timed_out($job, $inst, $user);
        }
        $inst->update("timeout={$int_max}");
        BossaDb::commit();
    }
    return 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) {
    $cached_data = get_cached_data(TEAM_PAGE_TTL, $cache_args);
    if ($cached_data) {
        // We found some old but non-stale data, let's use it
        $team = unserialize($cached_data);
    } else {
        $get_from_db = true;
    }
}
if ($get_from_db) {
    $team->nusers = BoincUser::count("teamid={$teamid}");
    $team->nusers_worked = BoincUser::count("teamid={$teamid} and total_credit>0");
    $team->nusers_active = BoincUser::count("teamid={$teamid} and expavg_credit>0.1");
    $team->forum = BoincForum::lookup("parent_type=1 and category={$team->id}");
    $team->new_members = new_member_list($teamid);
    $team->admins = admin_list($teamid);
    $team->founder = BoincUser::lookup_id($team->userid);
    set_cached_data(TEAM_PAGE_TTL, serialize($team), $cache_args);
}
if (!$team) {
    error_page(tra("no such team"));
}
display_team_page($team, $user);
page_tail(true);
Exemple #21
0
require_once "../inc/util.inc";
require_once "../inc/xml.inc";
xml_header();
if (DISABLE_FORUMS) {
    xml_error(-1, "Forums are disabled");
}
$retval = db_init_xml();
if ($retval) {
    xml_error($retval);
}
$method = get_str("method", true);
if ($method != "user_posts" && $method != "user_threads") {
    xml_error(-1);
}
$userid = get_int("userid", true);
$user = BoincUser::lookup_id($userid);
if (!$user) {
    xml_error(ERR_DB_NOT_FOUND);
}
if ($method == "user_posts") {
    $count = get_int("count", true);
    if (!$count || $count <= 0 || $count > 50) {
        $count = 10;
    }
    $length = get_int("contentlength", true);
    if ($length == null || $length <= 0) {
        $length = 0;
    }
    $posts = BoincPost::enum("user={$userid} ORDER BY timestamp DESC LIMIT {$count}");
    $realcount = BoincPost::count("user={$userid}");
    echo "<rpc_response>\n";
Exemple #22
0
function show_simulation()
{
    $scen = get_str("scen");
    $sim = get_str("sim");
    $dir = "scenarios/{$scen}/simulations/{$sim}";
    if (!is_dir($dir)) {
        error_page("No such simulation");
    }
    page_head("Simulation {$sim}");
    start_table();
    $userid = (int) file_get_contents("{$dir}/userid");
    $user = BoincUser::lookup_id($userid);
    $date = date_str(filemtime($dir));
    row2("Scenario", "<a href=sim_web.php?action=show_scenario&name={$scen}>{$scen}</a>");
    row2("Who", $user->name);
    row2("When", $date);
    row2("Parameters", "<pre>" . file_get_contents("{$dir}/inputs.txt") . "</pre>");
    row2("Results", "<pre>" . file_get_contents("{$dir}/results.txt") . "</pre>");
    $x = file_get_contents("{$dir}/index.html");
    $x = str_replace("<h3>Output files</h3>", "", $x);
    $x = str_replace("href=", "href=scenarios/{$scen}/simulations/{$sim}/", $x);
    row2("Output files", $x);
    $x = get_comments($dir);
    if ($x) {
        row2("Comments", $x);
    }
    echo "<form action=sim_web.php>\n        <input type=hidden name=scen value={$scen}>\n        <input type=hidden name=sim value={$sim}>\n        <input type=hidden name=action value=add_comment>\n    ";
    row2("<input type=submit value=\"Add comment\">", "<textarea name=comment></textarea>");
    echo "</form>";
    end_table();
    page_tail();
}
// 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/>.
// Users are taken here after creating an account via the Wizard.
// They've already entered an email address and password.
// Now get a name, country, and zip code
require_once '../inc/boinc_db.inc';
require_once '../inc/util.inc';
require_once '../inc/countries.inc';
check_get_args(array("auth"));
$auth = get_str("auth");
$user = BoincUser::lookup_auth($auth);
if (!$user) {
    error_page("no such account");
}
page_head(tra("Finish account setup"));
echo "\n    <form action=account_finish_action.php method=post>\n";
start_table();
row2(tra("Name") . "<br><span class=\"description\">" . tra("Identifies you on our web site. Use your real name or a nickname.") . "</span>", "<input name=\"name\" size=\"30\" value=\"{$user->name}\">");
row2_init(tra("Country") . "<br><span class=\"description\">" . tra("Select the country you want to represent, if any.") . "</span>", "<select name=\"country\">");
print_country_select();
echo "</select></td></tr>\n";
row2(tra("Postal or ZIP Code") . "<br><span class=\"description\">" . tra("Optional") . "</span>", "<input name=\"postal_code\" size=\"20\">");
row2("", "<input type=\"submit\" value=\"OK\">");
end_table();
echo "\n    <input type=hidden name=auth value={$auth}>\n    </form>\n";
page_tail();
if ($search_max_time) {
    $min_timestamp = time() - $search_max_time * 3600 * 24;
} else {
    $min_timestamp = 0;
}
$limit = 100;
if ($search_forum == -1) {
    $forum = null;
} else {
    if ($search_forum) {
        $forum = BoincForum::lookup_id($search_forum);
    }
}
$user = null;
if ($search_author) {
    $user = BoincUser::lookup_id($search_author);
}
// First search thread titles; if we get a hit there it's probably relevant
//
$threads = search_thread_titles($search_list, $forum, $user, $min_timestamp, round($limit / 7), $search_sort, $show_hidden_posts);
// Display the threads while we search for posts
if (count($threads)) {
    echo "<span class=title>" . tra("Thread titles matching your query:") . "</span>";
    show_thread_and_context_header();
    $i = 0;
    foreach ($threads as $thread) {
        if ($thread->hidden) {
            continue;
        }
        show_thread_and_context($thread, $logged_in_user, $i++);
    }
Exemple #25
0
        if ($retval) {
            //echo "$user->id: good\n";
        } else {
            echo "repairing prefs for user {$user->id}\n";
            $p = repair_prefs($user->global_prefs);
            if ($p) {
                $retval = @simplexml_load_string($p);
                if ($retval) {
                    $user->update("global_prefs='{$p}'");
                    echo "   repair succeeded\n";
                } else {
                    echo "   repair failed\n";
                }
            } else {
                echo "   prefs are missing end tag\n";
            }
        }
    }
}
$n = 0;
$maxid = BoincUser::max("id");
while ($n <= $maxid) {
    $m = $n + 1000;
    $users = BoincUser::enum("id >= {$n} and id < {$m}");
    //echo "processing from $n\n";
    if (!$users) {
        break;
    }
    process_set($users);
    $n = $m;
}
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";
}
    $forum_highlight_special = $user->prefs->highlight_special ? "checked=\"checked\"" : "";
    $forum_minimum_wrap_postcount = intval($user->prefs->minimum_wrap_postcount);
    $forum_display_wrap_postcount = intval($user->prefs->display_wrap_postcount);
    row1(tra("Message display"));
    row2(tra("What to display"), "<input type=\"checkbox\" name=\"forum_hide_avatars\" " . $forum_hide_avatars . "> " . tra("Hide avatar images") . "<br>\n    <input type=\"checkbox\" name=\"forum_hide_signatures\" " . $forum_hide_signatures . "> " . tra("Hide signatures") . "<br>\n    <input type=\"checkbox\" name=\"forum_images_as_links\" " . $forum_image_as_link . "> " . tra("Show images as links") . "<br>\n    <input type=\"checkbox\" name=\"forum_link_popup\" " . $forum_link_popup . "> " . tra("Open links in new window/tab") . "<br>\n    <input type=\"checkbox\" name=\"forum_highlight_special\" " . $forum_highlight_special . "> " . tra("Highlight special users") . "<br>\n    <input type=\"text\" name=\"forum_display_wrap_postcount\" size=3 value=\"" . $forum_display_wrap_postcount . "\"> " . tra("Display this many messages per page") . "<br />\n    ");
    row2(tra("How to sort"), tra("Threads:") . " " . select_from_array("forum_sort", $forum_sort_styles, $user->prefs->forum_sorting) . "<br>" . tra("Posts:") . " " . select_from_array("thread_sort", $thread_sort_styles, $user->prefs->thread_sorting) . "<br>\n    <input type=\"checkbox\" name=\"forum_jump_to_unread\" " . $forum_jump_to_unread . "> " . tra("Jump to first new post in thread automatically") . "<br>\n    <input type=\"checkbox\" name=\"forum_ignore_sticky_posts\" " . $forum_ignore_sticky_posts . ">" . tra("Don't move sticky posts to top") . "<br>\n    ");
}
// DISABLE_FORUMS
// ------------ Message filtering  -----------
row1(tra("Message filtering"));
$filtered_userlist = get_ignored_list($user);
$forum_filtered_userlist = "";
for ($i = 0; $i < sizeof($filtered_userlist); $i++) {
    $id = (int) $filtered_userlist[$i];
    if ($id) {
        $filtered_user = BoincUser::lookup_id($id);
        if (!$filtered_user) {
            echo "Missing user {$id}";
            continue;
        }
        $forum_filtered_userlist .= "<input class=\"btn btn-default\" type=\"submit\" name=\"remove" . $filtered_user->id . "\" value=\"" . tra("Remove") . "\"> " . $filtered_user->id . " - " . user_links($filtered_user) . "<br>";
    }
}
row2(tra("Filtered users") . "<br><p class=\"text-muted\">" . tra("Ignore message board posts and private messages from these users.") . "</p>", "{$forum_filtered_userlist}\n        <input type=\"text\" name=\"forum_filter_user\" size=12> " . tra("User ID (For instance: 123456789)") . "\n        <br><input class=\"btn btn-default\" type=\"submit\" name=\"add_user_to_filter\" value=\"" . tra("Add user to filter") . "\">\n    ");
row1(tra("Update"));
row2(tra("Click here to update preferences"), "<input class=\"btn btn-primary\" type=submit value=\"" . tra("Update") . "\">");
echo "</form>\n";
row1(tra("Reset"));
row2(tra("Or click here to reset preferences to the defaults"), "<form method=\"post\" action=\"edit_forum_preferences_action.php\"><input class=\"btn btn-warning\" type=\"submit\" value=\"" . tra("Reset") . "\"><input type=\"hidden\" name=\"action\" value=\"reset_confirm\"></form>");
end_table();
page_tail();
Exemple #28
0
    $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>";
    }
}
admin_page_tail();
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
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}");
}
Exemple #30
0
function show_forum($forum, $start, $sort_style, $user)
{
    $gotoStr = "";
    $nav = show_page_nav($forum, $start);
    if ($nav) {
        $gotoStr = "<div align=\"right\">{$nav}</div><br />";
    }
    echo $gotoStr;
    // Display the navbar
    start_forum_table(array("", tra("Threads"), tra("Posts"), tra("Author"), tra("Views"), "<nobr>" . tra("Last post") . "</nobr>"));
    $sticky_first = !$user || !$user->prefs->ignore_sticky_posts;
    // Show hidden threads if logged in user is a moderator
    //
    $show_hidden = is_moderator($user, $forum);
    $threads = get_forum_threads($forum->id, $start, THREADS_PER_PAGE, $sort_style, $show_hidden, $sticky_first);
    if ($user) {
        $subs = BoincSubscription::enum("userid={$user->id}");
    }
    // Run through the list of threads, displaying each of them
    $n = 0;
    $i = 0;
    foreach ($threads as $thread) {
        $owner = BoincUser::lookup_id($thread->owner);
        $unread = thread_is_unread($user, $thread);
        //if ($thread->status==1){
        // This is an answered helpdesk thread
        if ($user && is_subscribed($thread, $subs)) {
            echo '<tr class="row_hd' . $n . '">';
        } else {
            echo '<tr class="row' . $n . '">';
        }
        echo '<td width="1%"><nobr>';
        if ($user && $thread->rating() > $user->prefs->high_rating_threshold) {
            show_image(EMPHASIZE_IMAGE, "This message has a high average rating", "Highly rated");
        }
        if ($user && $thread->rating() < $user->prefs->low_rating_threshold) {
            show_image(FILTER_IMAGE, "This message has a low average rating", "Low rated");
        }
        if ($thread->hidden) {
            echo "[hidden]";
        }
        if ($unread) {
            if ($thread->sticky) {
                if ($thread->locked) {
                    show_image(NEW_IMAGE_STICKY_LOCKED, "This thread is sticky and locked, and you haven't read it yet", "sticky/locked/unread");
                } else {
                    show_image(NEW_IMAGE_STICKY, "This thread is sticky and you haven't read it yet", "sticky/unread");
                }
            } else {
                if ($thread->locked) {
                    show_image(NEW_IMAGE_LOCKED, "You haven't read this thread yet, and it's locked", "unread/locked");
                } else {
                    show_image(NEW_IMAGE, "You haven't read this thread yet", "unread");
                }
            }
        } else {
            if ($thread->sticky) {
                if ($thread->locked) {
                    show_image(IMAGE_STICKY_LOCKED, "This thread is sticky and locked", "sticky/locked");
                } else {
                    show_image(IMAGE_STICKY, "This thread is sticky", "sticky");
                }
            } else {
                if ($thread->locked) {
                    show_image(IMAGE_LOCKED, "This thread is locked", "locked");
                }
            }
        }
        echo "</nobr></td>";
        $titlelength = 48;
        $title = $thread->title;
        if (strlen($title) > $titlelength) {
            $title = substr($title, 0, $titlelength) . "...";
        }
        $title = cleanup_title($title);
        echo '<td class="threadline">
			<a href="forum_thread.php?id=' . $thread->id . '"><strong>' . $title . '</strong></a>
			<br /></td>';
        $n = ($n + 1) % 2;
        echo '<td class="numbers leftborder">' . ($thread->replies + 1) . '</td>
			<td class="author leftborder">' . user_links($owner) . '</td>
			<td class="numbers leftborder">' . $thread->views . '</td>
			<td class="lastpost leftborder">' . time_diff_str($thread->timestamp, time()) . '</td>
			</tr>';
        flush();
    }
    end_table();
    echo "<br />{$gotoStr}";
    // show page links
}