.
require_once("../inc/util.inc");
require_once("../inc/wap.inc");
check_get_args(array("id"));
function show_credit_wap($user) {
$retstr = "
User TotCred: " . format_credit($user->total_credit) . "
";
$retstr .= "User AvgCred: " . format_credit($user->expavg_credit) . "
";
return $retstr;
}
function show_user_wap($userid) {
wap_begin();
$cache = unserialize(get_cached_data(USER_PAGE_TTL, "userid=".$userid));
if (!$cache) {
$cache = new stdClass;
$cache->user = BoincUser::lookup_id($userid);
if ($cache->user->teamid) {
$cache->team = BoincTeam::lookup_id($cache->user->teamid);
}
$cache->wap_timestamp = wap_timestamp();
set_cached_data(USER_PAGE_TTL, serialize($cache), "userid=".$userid);
}
if (!$cache->user) {
echo "
".tra("User not found!")."
";
wap_end();
return;
}
// keep a 'running tab' in wapstr in case exceeds 1K WAP limit
$wapstr = PROJECT."
".tra("Account Data
for %1
Time:", $cache->user->name)." ".$cache->wap_timestamp;
$wapstr .= show_credit_wap($cache->user);
if ($cache->user->teamid) {
$wapstr .= "
".tra("Team:")." ".$cache->team->name."
";
$wapstr .= tra("Team TotCred:")." " . format_credit($cache->team->total_credit) . "
";
$wapstr .= tra("Team AvgCred:")." " . format_credit($cache->team->expavg_credit) . "
";
} else {
$wapstr .= "
".tra("Team: None")."
";
}
// don't want to send more than 1KB probably?
if (strlen($wapstr) > 1024) {
$wapstr = substr($wapstr, 0, 1024);
}
echo $wapstr;
wap_end();
}
show_user_wap(get_int('id'));
?>