BOINC /
boinc
| 1 | <?php |
||
| 2 | // This file is part of BOINC. |
||
| 3 | // http://boinc.berkeley.edu |
||
| 4 | // Copyright (C) 2008 University of California |
||
| 5 | // |
||
| 6 | // BOINC is free software; you can redistribute it and/or modify it |
||
| 7 | // under the terms of the GNU Lesser General Public License |
||
| 8 | // as published by the Free Software Foundation, |
||
| 9 | // either version 3 of the License, or (at your option) any later version. |
||
| 10 | // |
||
| 11 | // BOINC is distributed in the hope that it will be useful, |
||
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 14 | // See the GNU Lesser General Public License for more details. |
||
| 15 | // |
||
| 16 | // You should have received a copy of the GNU Lesser General Public License |
||
| 17 | // along with BOINC. If not, see <http://www.gnu.org/licenses/>. |
||
| 18 | |||
| 19 | require_once("../inc/util.inc"); |
||
| 20 | require_once("../inc/wap.inc"); |
||
| 21 | |||
| 22 | check_get_args(array("id")); |
||
| 23 | |||
| 24 | function show_credit_wap($user) { |
||
| 25 | $retstr = "<br/>User TotCred: " . format_credit($user->total_credit) . "<br/>"; |
||
| 26 | $retstr .= "User AvgCred: " . format_credit($user->expavg_credit) . "<br/>"; |
||
| 27 | return $retstr; |
||
| 28 | } |
||
| 29 | |||
| 30 | function show_user_wap($userid) { |
||
| 31 | wap_begin(); |
||
| 32 | |||
| 33 | $user = BoincUser::lookup_id($userid); |
||
| 34 | if (!$user) { |
||
| 35 | echo "<br/>".tra("User not found!")."<br/>"; |
||
| 36 | wap_end(); |
||
| 37 | return; |
||
| 38 | } |
||
| 39 | |||
| 40 | if ($user->teamid) { |
||
| 41 | $team = BoincTeam::lookup_id($user->teamid); |
||
| 42 | } |
||
| 43 | |||
| 44 | $wapstr = PROJECT."<br/>".tra("Account Data<br/>for %1<br/>Time:", $user->name)." ".wap_timestamp(); |
||
| 45 | $wapstr .= show_credit_wap($user); |
||
| 46 | if ($user->teamid && $team) { |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 47 | $wapstr .= "<br/>".tra("Team:")." ".$team->name."<br/>"; |
||
| 48 | $wapstr .= tra("Team TotCred:")." " . format_credit($team->total_credit) . "<br/>"; |
||
| 49 | $wapstr .= tra("Team AvgCred:")." " . format_credit($team->expavg_credit) . "<br/>"; |
||
| 50 | } else { |
||
| 51 | $wapstr .= "<br/>".tra("Team: None")."<br/>"; |
||
| 52 | } |
||
| 53 | |||
| 54 | // don't want to send more than 1KB (WAP limit) |
||
| 55 | // |
||
| 56 | if (strlen($wapstr) > 1024) { |
||
| 57 | $wapstr = substr($wapstr, 0, 1024); |
||
| 58 | } |
||
| 59 | |||
| 60 | echo $wapstr; |
||
| 61 | wap_end(); |
||
| 62 | } |
||
| 63 | |||
| 64 | show_user_wap(get_int('id')); |
||
| 65 | |||
| 66 | ?> |
||
| 67 |