2002-04-30 22:22:54 +00:00
|
|
|
<?php
|
|
|
|
|
2003-03-21 04:38:55 +00:00
|
|
|
// show dynamic user info (private)
|
|
|
|
//
|
|
|
|
function show_user_stats_private($user) {
|
2003-07-11 22:32:56 +00:00
|
|
|
row1("Your account statistics");
|
2003-03-21 04:38:55 +00:00
|
|
|
row2(PROJECT." member since", time_str($user->create_time));
|
2003-09-07 23:29:00 +00:00
|
|
|
row2("Total credit", format_credit($user->total_credit));
|
|
|
|
row2("Recent average credit", format_credit($user->expavg_credit));
|
2003-09-07 23:33:31 +00:00
|
|
|
$team_header = "Team<br>
|
|
|
|
<font size=-1><a href=team.php>Change</a></font>";
|
2002-11-08 17:21:45 +00:00
|
|
|
if ($user->teamid) {
|
|
|
|
$result = mysql_query("select * from team where id = $user->teamid");
|
|
|
|
$team = mysql_fetch_object($result);
|
2003-09-07 23:33:31 +00:00
|
|
|
row2($team_header, "<a href=team_display.php?teamid=$team->id>$team->name</a>");
|
2002-11-08 17:21:45 +00:00
|
|
|
} else {
|
2003-09-07 23:33:31 +00:00
|
|
|
row2($team_header, "None");
|
2002-11-08 17:21:45 +00:00
|
|
|
}
|
2003-03-21 04:38:55 +00:00
|
|
|
row2("Computers", "<a href=hosts_user.php>View</a>");
|
2003-02-19 20:34:33 +00:00
|
|
|
}
|
|
|
|
|
2003-03-21 04:38:55 +00:00
|
|
|
// show static user info (private)
|
|
|
|
//
|
2003-03-19 21:01:32 +00:00
|
|
|
function show_user_profile_private($user) {
|
2003-02-19 20:34:33 +00:00
|
|
|
if (is_valid_email_addr($user->email_addr)) {
|
|
|
|
$email_text = $user->email_addr;
|
2002-11-12 17:01:16 +00:00
|
|
|
} else {
|
2003-02-19 20:34:33 +00:00
|
|
|
$email_text = "Verification pending";
|
2002-11-12 17:01:16 +00:00
|
|
|
}
|
2003-09-07 23:29:00 +00:00
|
|
|
|
2003-07-11 22:32:56 +00:00
|
|
|
row1("Your account information");
|
2003-03-19 21:01:32 +00:00
|
|
|
row2("Email address<br>
|
|
|
|
<font size=-1><a href=edit_email_form.php>Edit</a></font>",
|
|
|
|
$email_text
|
|
|
|
);
|
2003-03-06 17:42:49 +00:00
|
|
|
row2("Name", $user->name);
|
2003-07-11 22:32:56 +00:00
|
|
|
row2("URL", "http://$user->url");
|
2003-03-06 17:42:49 +00:00
|
|
|
row2("Country", $user->country);
|
|
|
|
row2("Postal code", $user->postal_code);
|
2003-03-19 21:01:32 +00:00
|
|
|
row2("", "<a href=edit_user_info_form.php>Edit account info</a>");
|
2003-09-07 23:29:00 +00:00
|
|
|
|
2003-07-11 22:32:56 +00:00
|
|
|
row1("Your profile");
|
|
|
|
$sql = "SELECT * FROM profile WHERE userid = ".$user->id;
|
|
|
|
$result = mysql_query($sql);
|
2003-09-07 23:29:00 +00:00
|
|
|
|
2003-07-11 22:32:56 +00:00
|
|
|
if (mysql_num_rows($result) != 0) {
|
2003-09-07 23:29:00 +00:00
|
|
|
row2("", "<a href=view_profile.php?userid=$user->id>View / Edit</a>");
|
2003-07-11 22:32:56 +00:00
|
|
|
row2("", "<a href=delete_profile.php>Delete</a>");
|
|
|
|
} else {
|
|
|
|
row2("", "<a href=create_profile.php>Create</a>");
|
|
|
|
}
|
|
|
|
|
|
|
|
row1("Your preferences");
|
|
|
|
row2("General", "<a href=prefs.php?subset=global>View / Edit</a>");
|
|
|
|
row2(PROJECT, "<a href=prefs.php?subset=project>View / Edit</a>");
|
2003-03-21 04:38:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// show summary of dynamic and static info (public)
|
|
|
|
function show_user_summary_public($user) {
|
2003-07-11 22:32:56 +00:00
|
|
|
$result = mysql_query("SELECT * FROM profile WHERE userid = $user->id");
|
|
|
|
|
2003-03-21 04:38:55 +00:00
|
|
|
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>");
|
|
|
|
}
|
2003-09-07 23:29:00 +00:00
|
|
|
row2("Total credit", format_credit($user->total_credit));
|
|
|
|
row2("Recent average credit", format_credit($user->expavg_credit));
|
|
|
|
|
2003-07-11 22:32:56 +00:00
|
|
|
if (mysql_num_rows($result) != 0) {
|
|
|
|
row2("Profile", "<a href=view_profile.php?userid=$user->id>View</a>");
|
|
|
|
}
|
2003-09-07 23:29:00 +00:00
|
|
|
|
2003-03-21 04:38:55 +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");
|
|
|
|
}
|
2002-12-06 21:37:30 +00:00
|
|
|
}
|
|
|
|
|
2002-11-08 17:21:45 +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) {
|
2003-07-11 22:32:56 +00:00
|
|
|
start_table();
|
|
|
|
show_user_profile_private($user); // NOTE: Will include the actual user profile.
|
2003-03-21 04:38:55 +00:00
|
|
|
show_user_stats_private($user);
|
2003-03-06 17:42:49 +00:00
|
|
|
end_table();
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
2002-11-08 17:21:45 +00:00
|
|
|
|
|
|
|
function user_table_start() {
|
2003-07-11 22:32:56 +00:00
|
|
|
start_table();
|
2003-03-06 00:42:18 +00:00
|
|
|
echo "
|
2003-03-17 22:37:49 +00:00
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Recent average credit</th>
|
|
|
|
<th>Total credit</th>
|
|
|
|
<th>Country</th>
|
|
|
|
<th>Participant since</th>
|
|
|
|
</tr>
|
2003-03-06 00:42:18 +00:00
|
|
|
";
|
2002-11-08 17:21:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function show_user_row($user) {
|
2003-05-14 23:05:22 +00:00
|
|
|
printf(
|
2003-09-07 23:33:31 +00:00
|
|
|
"<tr class=row1>
|
2003-05-14 23:05:22 +00:00
|
|
|
<td><a href=show_user.php?userid=%d>%s</a></td>
|
2003-09-07 23:41:20 +00:00
|
|
|
<td>%s</td>
|
|
|
|
<td>%s</td>
|
2003-05-14 23:05:22 +00:00
|
|
|
<td>%s</td>
|
|
|
|
<td>%s</td>
|
2003-09-07 23:29:00 +00:00
|
|
|
</tr>\n", $user->id, $user->name, format_credit($user->expavg_credit),
|
|
|
|
format_credit($user->total_credit), $user->country, time_str($user->create_time));
|
2002-11-08 17:21:45 +00:00
|
|
|
}
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
?>
|