From 91317aa5769ac058228b82cf66d8c9a245c95e20 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 18 Jan 2012 20:59:24 +0000 Subject: [PATCH] - WAP interface to credit info: return correct timestamp, and don't bother with caching. svn path=/trunk/boinc/; revision=25101 --- checkin_notes | 10 ++++++++++ html/inc/wap.inc | 2 +- html/user/userw.php | 34 ++++++++++++++-------------------- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/checkin_notes b/checkin_notes index 81ad34c9a0..4dc10a5ff0 100644 --- a/checkin_notes +++ b/checkin_notes @@ -703,3 +703,13 @@ Rom 18 Jan 2012 samples/vboxwrapper vbox.cpp + +David 18 Jan 2012 + - WAP interface to credit info: return correct timestamp, + and don't bother with caching. + + html/ + inc/ + wap.inc + user/ + userw.php diff --git a/html/inc/wap.inc b/html/inc/wap.inc index c8019e16f5..04b30ab93b 100644 --- a/html/inc/wap.inc +++ b/html/inc/wap.inc @@ -33,6 +33,6 @@ function wap_end() { } function wap_timestamp() { - return strftime("%d %b %Y %H:%M:%S UTC", mktime()); + return gmdate('j M Y G:i:s', time()) . " UTC"; } ?> diff --git a/html/user/userw.php b/html/user/userw.php index c920e89bac..169cee7e3b 100644 --- a/html/user/userw.php +++ b/html/user/userw.php @@ -30,35 +30,29 @@ function show_credit_wap($user) { 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) { + $user = BoincUser::lookup_id($userid); + if (!$user) { echo "
".tra("User not found!")."
"; wap_end(); return; } + + if ($user->teamid) { + $team = BoincTeam::lookup_id($user->teamid); + } - // 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) . "
"; + $wapstr = PROJECT."
".tra("Account Data
for %1
Time:", $user->name)." ".wap_timestamp(); + $wapstr .= show_credit_wap($user); + if ($user->teamid && $team) { + $wapstr .= "
".tra("Team:")." ".$team->name."
"; + $wapstr .= tra("Team TotCred:")." " . format_credit($team->total_credit) . "
"; + $wapstr .= tra("Team AvgCred:")." " . format_credit($team->expavg_credit) . "
"; } else { $wapstr .= "
".tra("Team: None")."
"; } - // don't want to send more than 1KB probably? + // don't want to send more than 1KB (WAP limit) + // if (strlen($wapstr) > 1024) { $wapstr = substr($wapstr, 0, 1024); }