2004-02-02 23:34:39 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function pending_credit($user) {
|
|
|
|
$result = mysql_query("select sum(claimed_credit) as total from result where userid=$user->id and validate_state=0");
|
|
|
|
$foobar = mysql_fetch_object($result);
|
|
|
|
if (!$foobar) return 0;
|
|
|
|
mysql_free_result($result);
|
|
|
|
return $foobar->total;
|
|
|
|
}
|
|
|
|
|
2004-05-30 21:47:11 +00:00
|
|
|
function show_credit($user) {
|
|
|
|
row2("Total credit", format_credit($user->total_credit));
|
|
|
|
row2("Recent average credit", format_credit($user->expavg_credit));
|
|
|
|
if ($user->seti_nresults) {
|
2004-10-01 23:46:22 +00:00
|
|
|
row2(
|
|
|
|
"SETI@home classic workunits
|
|
|
|
<br><font size=-2>as of 14 May 2004</font>",
|
|
|
|
number_format($user->seti_nresults)
|
|
|
|
);
|
2004-05-30 21:47:11 +00:00
|
|
|
}
|
|
|
|
if ($user->seti_total_cpu) {
|
|
|
|
$x = number_format($user->seti_total_cpu/3600)." hours";
|
2004-10-01 23:46:22 +00:00
|
|
|
row2(
|
|
|
|
"SETI@home classic CPU time
|
|
|
|
<br><font size=-2>as of 14 May 2004</font>",
|
|
|
|
$x
|
|
|
|
);
|
2004-05-30 21:47:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
// show dynamic user info (private)
|
|
|
|
//
|
|
|
|
function show_user_stats_private($user) {
|
|
|
|
row1("Account statistics");
|
|
|
|
row2(PROJECT." member since", time_str($user->create_time));
|
2004-05-30 21:47:11 +00:00
|
|
|
show_credit($user);
|
2004-02-02 23:34:39 +00:00
|
|
|
row2("Pending credit", "<a href=pending.php>View</a>");
|
|
|
|
if ($user->teamid) {
|
2004-06-07 03:34:07 +00:00
|
|
|
$team = lookup_team($user->teamid);
|
|
|
|
$x = "<a href=team_display.php?teamid=$team->id>$team->name</a>
|
|
|
|
| <a href=team_quit_form.php>Quit this team</a>";
|
|
|
|
if ($team->userid == $user->id) {
|
|
|
|
$x .= " | <a href=team_manage.php>management functions</a>";
|
|
|
|
}
|
|
|
|
row2("Team", $x);
|
2004-02-02 23:34:39 +00:00
|
|
|
} else {
|
2004-06-07 03:34:07 +00:00
|
|
|
row2("Team", "None (<a href=team.php>find a team</a>)");
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
2004-10-01 23:46:22 +00:00
|
|
|
row2("Computers on this account", "<a href=hosts_user.php>View computers</a>");
|
2004-02-02 23:34:39 +00:00
|
|
|
row2("Results", "<a href=results.php?userid=$user->id>View</a>");
|
2004-09-10 20:33:05 +00:00
|
|
|
row2("Stats on your cell phone", URL_BASE."userw.php?id=$user->id");
|
2004-02-02 23:34:39 +00:00
|
|
|
if ($user->posts) {
|
2004-05-30 21:47:11 +00:00
|
|
|
row2("Message board posts", "<a href=forum_user_posts.php?userid=$user->id>$user->posts messages</a>");
|
2004-02-02 23:34:39 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// show static user info (private)
|
|
|
|
//
|
2004-05-30 21:47:11 +00:00
|
|
|
function show_user_info_private($user) {
|
2004-02-02 23:34:39 +00:00
|
|
|
if (is_valid_email_addr($user->email_addr)) {
|
|
|
|
$email_text = $user->email_addr;
|
|
|
|
} else {
|
|
|
|
$email_text = "Verification pending";
|
|
|
|
}
|
|
|
|
|
|
|
|
row1("Account information");
|
|
|
|
row2("Email address<br>
|
|
|
|
<font size=-2><a href=edit_email_form.php>Edit</a></font>",
|
|
|
|
$email_text
|
|
|
|
);
|
|
|
|
row2("Name", $user->name);
|
2004-05-14 22:57:59 +00:00
|
|
|
if (strlen($user->url)) {
|
|
|
|
$x = "http://$user->url";
|
|
|
|
} else {
|
|
|
|
$x = "none";
|
|
|
|
}
|
|
|
|
row2("URL", $x);
|
2004-02-02 23:34:39 +00:00
|
|
|
row2("Country", $user->country);
|
|
|
|
row2("Postal code", $user->postal_code);
|
2004-09-04 23:37:49 +00:00
|
|
|
/* if ($user->signature) {
|
2004-02-02 23:34:39 +00:00
|
|
|
$x = "<pre>".htmlspecialchars($user->signature)."</pre>";
|
|
|
|
row2("Forums signature", $x);
|
2004-09-04 23:37:49 +00:00
|
|
|
}*/
|
2004-02-02 23:34:39 +00:00
|
|
|
row2("", "<a href=edit_user_info_form.php>Edit account info</a>");
|
|
|
|
|
|
|
|
row1("Profile");
|
|
|
|
$sql = "SELECT * FROM profile WHERE userid = ".$user->id;
|
|
|
|
$result = mysql_query($sql);
|
|
|
|
|
|
|
|
if (mysql_num_rows($result) != 0) {
|
2004-09-30 17:44:43 +00:00
|
|
|
row2("", "<a href=view_profile.php?userid=$user->id>View or edit profile</a>");
|
|
|
|
row2("", "<a href=delete_profile.php>Delete profile</a>");
|
2004-02-02 23:34:39 +00:00
|
|
|
} else {
|
2004-08-12 15:06:35 +00:00
|
|
|
row2("", "<a href=create_profile.php>Create</a>");
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
row1("Preferences");
|
2004-08-12 15:06:35 +00:00
|
|
|
row2(
|
|
|
|
"General<br><font size=-2>specify when and how BOINC uses your computer</font>",
|
2004-09-30 17:44:43 +00:00
|
|
|
"<a href=prefs.php?subset=global>View or edit general preferences</a>"
|
2004-08-12 15:06:35 +00:00
|
|
|
);
|
2004-09-30 17:44:43 +00:00
|
|
|
row2(PROJECT."<br><font size=-2>control resource share and customize graphics</font>",
|
|
|
|
"<a href=prefs.php?subset=project>View or edit ".PROJECT." preferences</a>"
|
2004-08-12 15:06:35 +00:00
|
|
|
);
|
2004-09-04 23:37:49 +00:00
|
|
|
row2("Forum<br><font size=-2>configure features and the appearance of the forum</font>",
|
2004-09-30 17:44:43 +00:00
|
|
|
"<a href=\"edit_forum_preferences_form.php\">View or edit forum preferences</a>"
|
2004-09-04 23:37:49 +00:00
|
|
|
);
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
|
2004-10-15 23:46:24 +00:00
|
|
|
function show_clone_url($user) {
|
|
|
|
$url = URL_BASE."create_account_form.php?userid=$user->id";
|
|
|
|
row2("Clone account URL<br><font size=-2>create accounts with the same team and project preferences as this account</font>", "<a href=$url>$url</a>");
|
|
|
|
}
|
2004-02-02 23:34:39 +00:00
|
|
|
// show summary of dynamic and static info (public)
|
|
|
|
function show_user_summary_public($user) {
|
|
|
|
row1("Account data for $user->name");
|
|
|
|
row2(PROJECT." member since", time_str($user->create_time));
|
|
|
|
row2("Country", $user->country);
|
|
|
|
if (strlen($user->url)) {
|
|
|
|
row2("URL", "<a href=http://$user->url>http://$user->url</a>");
|
|
|
|
}
|
2004-05-30 21:47:11 +00:00
|
|
|
show_credit($user);
|
2004-02-02 23:34:39 +00:00
|
|
|
|
|
|
|
if ($user->teamid) {
|
|
|
|
$result = mysql_query("select * from team where id = $user->teamid");
|
|
|
|
$team = mysql_fetch_object($result);
|
|
|
|
row2("Team", "<a href=team_display.php?teamid=$team->id>$team->name</a>");
|
|
|
|
} else {
|
|
|
|
row2("Team", "None");
|
|
|
|
}
|
|
|
|
if ($user->show_hosts) {
|
|
|
|
row2("Computers", "<a href=hosts_user.php?userid=$user->id>View</a>");
|
|
|
|
} else {
|
|
|
|
row2("Computers", "hidden");
|
|
|
|
}
|
|
|
|
if ($user->posts) {
|
2004-05-30 21:47:11 +00:00
|
|
|
row2("Message board posts", "<a href=forum_user_posts.php?userid=$user->id>$user->posts</a>");
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
if ($user->has_profile) {
|
|
|
|
row2("Profile", "<a href=view_profile.php?userid=$user->id>view</a>");
|
|
|
|
}
|
2004-10-15 23:46:24 +00:00
|
|
|
show_clone_url($user);
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// show a summary of the user.
|
|
|
|
// NOTE: This is intended to be shown only to that user.
|
|
|
|
// it has info that other users aren't supposed to see
|
|
|
|
|
|
|
|
function show_user_page_private($user) {
|
2004-05-12 17:54:23 +00:00
|
|
|
start_table("width=100%");
|
2004-05-30 21:47:11 +00:00
|
|
|
show_user_info_private($user);
|
2004-02-02 23:34:39 +00:00
|
|
|
show_user_stats_private($user);
|
2004-05-30 21:47:11 +00:00
|
|
|
row1("Other");
|
|
|
|
row2("", "<a href=logout.php>Log out</a>");
|
|
|
|
row2("Account number<br><font size=-2>Used in URLs</font>", $user->id);
|
2004-08-24 00:15:14 +00:00
|
|
|
row2("Cross-project ID", $user->cross_project_id);
|
2004-10-15 23:46:24 +00:00
|
|
|
show_clone_url($user);
|
2004-02-02 23:34:39 +00:00
|
|
|
end_table();
|
|
|
|
}
|
|
|
|
|
2004-05-31 00:50:06 +00:00
|
|
|
function user_table_start($sort_by) {
|
2004-02-02 23:34:39 +00:00
|
|
|
start_table();
|
|
|
|
echo "
|
|
|
|
<tr>
|
|
|
|
<th>Rank</th>
|
|
|
|
<th>Name</th>
|
2004-05-31 00:50:06 +00:00
|
|
|
";
|
|
|
|
if ($sort_by == "total_credit") {
|
|
|
|
echo "
|
|
|
|
<th><a href=top_users.php?sort_by=expavg_credit>Recent average credit</a></th>
|
|
|
|
<th>Total credit</th>
|
|
|
|
";
|
|
|
|
} else {
|
|
|
|
echo "
|
|
|
|
<th>Recent average credit</th>
|
|
|
|
<th><a href=top_users.php?sort_by=total_credit>Total credit</a></th>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
echo "
|
2004-02-02 23:34:39 +00:00
|
|
|
<th>Country</th>
|
|
|
|
<th>Participant since</th>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_user_row($user, $i) {
|
|
|
|
echo "
|
|
|
|
<tr class=row1>
|
|
|
|
<td>$i</td>
|
|
|
|
<td>", user_links($user), "</td>
|
|
|
|
<td>", format_credit($user->expavg_credit), "</td>
|
|
|
|
<td>", format_credit($user->total_credit), "</td>
|
|
|
|
<td>", $user->country, "</td>
|
|
|
|
<td>", time_str($user->create_time),"</td>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|