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 | // This page shows basic account details about a given user |
||
| 20 | // The page can be output as either XML or HTML. |
||
| 21 | // If output as xml the user may optionally |
||
| 22 | // also get a list of hosts in case the user provides his/her authenticator. |
||
| 23 | // Object-caching and full-file caching is used to speed up queries |
||
| 24 | // for data from this page. |
||
| 25 | |||
| 26 | |||
| 27 | require_once("../inc/cache.inc"); |
||
| 28 | require_once("../inc/util.inc"); |
||
| 29 | require_once("../inc/xml.inc"); |
||
| 30 | require_once("../inc/boinc_db.inc"); |
||
| 31 | require_once("../inc/user.inc"); |
||
| 32 | require_once("../inc/forum.inc"); |
||
| 33 | require_once("../project/project.inc"); |
||
| 34 | |||
| 35 | $auth = get_str("auth", true); |
||
| 36 | if (!$auth) { |
||
| 37 | $id = get_int("userid"); |
||
| 38 | } |
||
| 39 | $format = get_str("format", true); |
||
| 40 | |||
| 41 | if ($format=="xml"){ |
||
| 42 | // don't do caching for XML |
||
| 43 | xml_header(); |
||
| 44 | $retval = db_init_xml(); |
||
| 45 | if ($retval) xml_error($retval); |
||
| 46 | if ($auth){ |
||
| 47 | $user = BoincUser::lookup_auth($auth); |
||
| 48 | $show_hosts = true; |
||
| 49 | } else { |
||
| 50 | $user = BoincUser::lookup_id($id); |
||
| 51 | $show_hosts = false; |
||
| 52 | } |
||
| 53 | if (!$user) xml_error(ERR_DB_NOT_FOUND); |
||
| 54 | |||
| 55 | show_user_xml($user, $show_hosts); |
||
| 56 | } else { |
||
| 57 | // The page may be presented in many different languages, |
||
| 58 | // so here we cache the data instead |
||
| 59 | // |
||
| 60 | $cache_args="userid=".$id; |
||
| 61 | $cached_data = get_cached_data(USER_PAGE_TTL, $cache_args); |
||
| 62 | if ($cached_data){ |
||
| 63 | // We found some old but non-stale data, let's use it |
||
| 64 | $data = unserialize($cached_data); |
||
| 65 | $user = $data->user; |
||
| 66 | $community_links = $data->clo; |
||
| 67 | } else { |
||
| 68 | // No data was found, generate new data for the cache and store it |
||
| 69 | $user = BoincUser::lookup_id($id); |
||
| 70 | if (!$user) { |
||
| 71 | error_page("No such user $id"); |
||
| 72 | } |
||
| 73 | if (strstr($user->authenticator, "deleted")) { |
||
| 74 | error_page("No such user"); |
||
| 75 | } |
||
| 76 | BoincForumPrefs::lookup($user); |
||
| 77 | $user = @get_other_projects($user); |
||
| 78 | $community_links = get_community_links_object($user); |
||
| 79 | |||
| 80 | $data = new StdClass; |
||
| 81 | $data->user = $user; |
||
| 82 | $data->clo = $community_links; |
||
| 83 | set_cached_data(USER_PAGE_TTL, serialize($data), $cache_args); |
||
| 84 | } |
||
| 85 | if (!$user->id) { |
||
| 86 | error_page("No such user"); |
||
| 87 | } |
||
| 88 | |||
| 89 | $logged_in_user = get_logged_in_user(false); |
||
|
0 ignored issues
–
show
|
|||
| 90 | $myself = $logged_in_user && ($logged_in_user->id == $user->id); |
||
| 91 | |||
| 92 | page_head($user->name); |
||
| 93 | grid( |
||
| 94 | false, |
||
| 95 | function() use ($data, $myself) { |
||
| 96 | panel( |
||
| 97 | tra("Account information"), |
||
| 98 | function() use ($data) { |
||
| 99 | start_table("table-striped"); |
||
| 100 | show_user_summary_public($data->user); |
||
| 101 | project_user_summary($data->user); |
||
| 102 | end_table(); |
||
| 103 | } |
||
| 104 | ); |
||
| 105 | show_other_projects($data->user, $myself); |
||
| 106 | }, |
||
| 107 | function() use ($data, $logged_in_user) { |
||
| 108 | panel( |
||
| 109 | tra("Community"), |
||
| 110 | function() use ($data, $logged_in_user) { |
||
| 111 | start_table("table-striped"); |
||
| 112 | show_badges_row(true, $data->user); |
||
| 113 | if (!DISABLE_PROFILES) { |
||
| 114 | show_profile_link($data->user); |
||
| 115 | } |
||
| 116 | community_links($data->clo, $logged_in_user); |
||
| 117 | end_table(); |
||
| 118 | } |
||
| 119 | ); |
||
| 120 | } |
||
| 121 | ); |
||
| 122 | page_tail(true); |
||
| 123 | } |
||
| 124 | |||
| 125 | ?> |
||
| 126 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.