本文整理汇总了PHP中BoincUser类的典型用法代码示例。如果您正苦于以下问题:PHP BoincUser类的具体用法?PHP BoincUser怎么用?PHP BoincUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BoincUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: show_user_wap
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();
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:29,代码来源:userw.php
示例2: show_row
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";
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:29,代码来源:show_coproc.php
示例3: export
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}");
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:26,代码来源:export_credit_by_app.php
示例4: send_notify_email
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";
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:8,代码来源:notify.php
示例5: project_flops
function project_flops()
{
$x = BoincUser::sum("expavg_credit");
if ($x == 0) {
$x = 200;
}
$y = 1000000000.0 * $x / 200;
return $y;
}
开发者ID:brevilo,项目名称:boinc,代码行数:9,代码来源:submit_rpc_handler.php
示例6: update_user_posts
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}");
}
}
}
开发者ID:Turante,项目名称:boincweb,代码行数:11,代码来源:forum_repair.php
示例7: get_top_participants
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}");
}
开发者ID:entibasse,项目名称:superhost,代码行数:11,代码来源:top_users.php
示例8: send_founder_transfer_email
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);
}
开发者ID:maexlich,项目名称:boinc-igemathome,代码行数:11,代码来源:team_founder_transfer_action.php
示例9: show_delta
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 ";
}
}
开发者ID:maexlich,项目名称:boinc-igemathome,代码行数:12,代码来源:team_delta.php
示例10: show_admin_page
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 · <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 · <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();
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:18,代码来源:team_manage.php
示例11: handle_team
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");
}
开发者ID:Turante,项目名称:boincweb,代码行数:18,代码来源:team_export.php
示例12: show_admin_page
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();
}
开发者ID:Turante,项目名称:boincweb,代码行数:18,代码来源:team_manage.php
示例13: add_admin
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"));
}
}
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:19,代码来源:team_admins.php
示例14: validate
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();
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:20,代码来源:validate_email_addr.php
示例15: notify_users
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);
}
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:20,代码来源:bolt_refresh.php
示例16: process_batch
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);
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:41,代码来源:submit_init_priority.php
示例17: assign_badges
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;
}
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:22,代码来源:badge_assign.php
示例18: show_row
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";
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:38,代码来源:per_app_list.php
示例19: do_pass
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;
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:23,代码来源:bossa_transitioner.php
示例20: get_cached_data
}
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);
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:31,代码来源:team_display.php
注:本文中的BoincUser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论