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}"); } } }
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}"); }
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; }
echo "<p>" . tra("Team member %1 requested this team's foundership on %2, but left the team, thus canceling the request.", user_links($ping_user), $x) . "</p>"; $team->update("ping_user=0, ping_time=0"); } else { $ping_user = BoincUser::lookup_id($team->ping_user); $x = date_str(transfer_ok_time($team)); echo "<p>" . tra("Team member %1 has requested this team's foundership. This may be because you left the team or haven't had contact with the team for a long time.", user_links($ping_user)) . "</p>"; echo "<p>\n <form method=\"post\" action=\"team_founder_transfer_action.php\">\n <input type=\"hidden\" name=\"action\" value=\"decline\">\n <input type=\"hidden\" name=\"teamid\" value=\"" . $team->id . "\">\n <input type=\"submit\" value=\"" . tra("decline request") . "\">\n </form>\n <p>\n " . tra("If you don't decline the request by %1, %2 will have the option of assuming team foundership.<br /><br />\n To accept the request, assign foundership to %3 using the form below.", $x, $ping_user->name, $ping_user->name) . "\n </p>\n <hr>\n <p>\n "; } } else { echo tra("No transfer request is pending.") . "<br /><br />"; } echo tra("To assign foundership of this team to another member, check the box next to member name and click <strong>Change founder</strong> below.") . "<form method=post action=team_change_founder_action.php>\n <input type=hidden name=teamid value={$team->id}>"; echo form_tokens($user->authenticator); start_table(); echo "<tr>\n <th>" . tra("New founder?") . "</th>\n <th>" . tra("Name") . "</th>\n <th>" . tra("Total credit") . "</th>\n <th>" . tra("Recent average credit") . "</th>\n </tr>\n"; $users = BoincUser::enum("teamid={$team->id}"); $navailable_users = 0; foreach ($users as $user) { if ($user->id != $team->userid) { //don't show current founder $user_total_credit = format_credit($user->total_credit); $user_expavg_credit = format_credit($user->expavg_credit); $selected = $user->id == $team->ping_user ? "selected" : ""; echo ' <tr> <td align="center"><input type="radio" name="userid" value="' . $user->id . '"> <td>' . $user->name . '</td> <td align=right>' . $user_total_credit . '</td> <td align=right>' . $user_expavg_credit . '</td> </tr> ';
function update_users($app_id) { $n = 0; $maxid = BoincUser::max("id"); while ($n <= $maxid) { $m = $n + 1000; $users = BoincUser::enum("id>={$n} and id<{$m}"); foreach ($users as $user) { update_user($user, $app_id); } $n = $m; } }
<?php // This file is part of BOINC. // http://boinc.berkeley.edu // Copyright (C) 2012 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/>. // replace user names that are all whitespace with the user ID require_once "../inc/boinc_db.inc"; $users = BoincUser::enum("trim(name)=''"); foreach ($users as $u) { $n = (string) $u->id; $u->update("name='{$n}'"); }
function delete_user_url() { global $test, $days; $users = BoincUser::enum("url <> ''"); foreach ($users as $user) { if ($days) { if ($user->create_time < time() - $days * 86400) { continue; } } $n = BoincHost::count("userid={$user->id}"); if ($n) { continue; } $n = BoincPost::count("user={$user->id}"); if ($n) { continue; } do_delete_user($user); } }
function do_send_team($logged_in_user) { check_tokens($logged_in_user->authenticator); $subject = post_str("subject", true); $content = post_str("content", true); $teamid = post_int("teamid"); if (post_str("preview", true) == tra("Preview")) { pm_team_form($logged_in_user, $teamid); return; } // make sure user is authorized, i.e. is a team admin // $team = BoincTeam::lookup_id($teamid); if (!$team) { error_page("no such team"); } if (!is_team_admin($logged_in_user, $team)) { error_page("no team admin"); } if ($subject == null || $content == null) { pm_team_form($logged_in_user, $teamid, tra("You need to fill all fields to send a private message")); return; } $subject = "Message from team " . $team->name . ": " . $subject; // don't use tra() here because we don't know language of recipient // Also, we use it in pm_count() to exclude team messages from limit check $users = BoincUser::enum("teamid={$teamid}"); foreach ($users as $user) { pm_send_msg($logged_in_user, $user, $subject, $content, true); } page_head(tra("Message sent")); echo tra("Your message was sent to %1 team members.", count($users)); page_tail(); }