2002-08-07 18:56:55 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2006-09-06 20:56:55 +00:00
|
|
|
|
|
|
|
// This page shows basic account details about a given user
|
|
|
|
// The page can be output as either XML or HTML.
|
|
|
|
// If output as xml the user may optionally
|
|
|
|
// also get a list of hosts in case the user provides his/her authenticator.
|
|
|
|
// Object-caching and full-file caching is used to speed up queries
|
|
|
|
// for data from this page.
|
2002-08-07 18:56:55 +00:00
|
|
|
|
2006-08-27 21:03:29 +00:00
|
|
|
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
|
2004-07-15 18:54:17 +00:00
|
|
|
|
2006-08-27 21:03:29 +00:00
|
|
|
require_once("../inc/cache.inc");
|
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/xml.inc");
|
2007-11-12 22:39:56 +00:00
|
|
|
require_once("../inc/boinc_db.inc");
|
2006-08-27 21:03:29 +00:00
|
|
|
require_once("../inc/user.inc");
|
|
|
|
require_once("../inc/forum.inc");
|
2006-09-06 20:56:55 +00:00
|
|
|
require_once("../project/project.inc");
|
2011-02-09 22:11:34 +00:00
|
|
|
|
|
|
|
check_get_args(array("auth", "userid", "format"));
|
2006-08-27 21:03:29 +00:00
|
|
|
|
|
|
|
$auth = get_str("auth", true);
|
2008-09-09 06:07:54 +00:00
|
|
|
if (!$auth) {
|
|
|
|
$id = get_int("userid");
|
|
|
|
}
|
|
|
|
$format = get_str("format", true);
|
2002-12-06 21:37:30 +00:00
|
|
|
|
2006-08-27 21:03:29 +00:00
|
|
|
if ($format=="xml"){
|
2010-07-15 18:10:00 +00:00
|
|
|
// don't do caching for XML
|
2006-09-06 20:56:55 +00:00
|
|
|
xml_header();
|
|
|
|
$retval = db_init_xml();
|
|
|
|
if ($retval) xml_error($retval);
|
2006-08-27 21:03:29 +00:00
|
|
|
if ($auth){
|
2006-09-05 19:00:59 +00:00
|
|
|
$user = lookup_user_auth($auth);
|
|
|
|
$show_hosts = true;
|
2006-08-27 21:03:29 +00:00
|
|
|
} else {
|
2005-06-15 04:53:08 +00:00
|
|
|
$user = lookup_user_id($id);
|
2006-09-05 19:00:59 +00:00
|
|
|
$show_hosts = false;
|
2005-02-15 22:29:32 +00:00
|
|
|
}
|
2006-09-06 20:56:55 +00:00
|
|
|
if (!$user) xml_error(-136);
|
2005-02-15 22:29:32 +00:00
|
|
|
|
2006-08-27 21:03:29 +00:00
|
|
|
show_user_xml($user, $show_hosts);
|
|
|
|
} else {
|
2006-09-06 20:56:55 +00:00
|
|
|
db_init(); // need to do this in any case,
|
|
|
|
// since show_user_summary_public() etc. accesses DB
|
|
|
|
|
2006-12-29 03:29:13 +00:00
|
|
|
// The page may be presented in many different languages,
|
2006-09-06 20:56:55 +00:00
|
|
|
// so here we cache the data instead
|
|
|
|
//
|
2006-08-27 21:03:29 +00:00
|
|
|
$cache_args="userid=".$id;
|
2008-12-29 18:44:11 +00:00
|
|
|
$cached_data = get_cached_data(USER_PAGE_TTL, $cache_args);
|
2006-08-27 21:03:29 +00:00
|
|
|
if ($cached_data){
|
2006-09-05 19:00:59 +00:00
|
|
|
// We found some old but non-stale data, let's use it
|
2008-12-29 18:44:11 +00:00
|
|
|
$data = unserialize($cached_data);
|
2009-02-06 03:40:54 +00:00
|
|
|
$user = $data->user;
|
|
|
|
$community_links = $data->clo;
|
2006-08-27 21:03:29 +00:00
|
|
|
} else {
|
2006-09-05 19:00:59 +00:00
|
|
|
// No data was found, generate new data for the cache and store it
|
2006-08-27 21:03:29 +00:00
|
|
|
$user = lookup_user_id($id);
|
2007-11-12 22:39:56 +00:00
|
|
|
BoincForumPrefs::lookup($user);
|
2008-09-26 07:12:01 +00:00
|
|
|
$user = @get_other_projects($user);
|
2009-02-06 03:40:54 +00:00
|
|
|
$community_links = get_community_links_object($user);
|
2008-12-29 18:44:11 +00:00
|
|
|
|
2009-02-06 03:40:54 +00:00
|
|
|
$data->user = $user;
|
|
|
|
$data->clo = $community_links;
|
2008-12-29 18:44:11 +00:00
|
|
|
set_cache_data(serialize($data), $cache_args);
|
2005-02-15 22:29:32 +00:00
|
|
|
}
|
2006-09-06 20:56:55 +00:00
|
|
|
if (!$user->id) {
|
|
|
|
error_page("No such user found - please check the ID and try again.");
|
|
|
|
}
|
2002-12-06 21:37:30 +00:00
|
|
|
|
2008-12-29 18:44:11 +00:00
|
|
|
$logged_in_user = get_logged_in_user(false);
|
2007-12-18 20:28:08 +00:00
|
|
|
|
2008-12-29 18:44:11 +00:00
|
|
|
page_head(tra("Account data for %1", $user->name));
|
2006-08-27 21:03:29 +00:00
|
|
|
start_table();
|
2008-01-01 22:29:10 +00:00
|
|
|
echo "<tr><td valign=top>";
|
|
|
|
start_table();
|
2006-08-27 21:03:29 +00:00
|
|
|
show_user_summary_public($user);
|
|
|
|
end_table();
|
|
|
|
project_user_summary($user);
|
2006-12-29 19:01:03 +00:00
|
|
|
show_other_projects($user, false);
|
2008-01-01 22:29:10 +00:00
|
|
|
echo "</td><td valign=top>";
|
|
|
|
start_table();
|
|
|
|
show_profile_link($user);
|
2008-12-29 18:44:11 +00:00
|
|
|
community_links($community_links, $logged_in_user);
|
2008-01-01 22:29:10 +00:00
|
|
|
end_table();
|
|
|
|
echo "</td></tr></table>";
|
2006-08-27 21:03:29 +00:00
|
|
|
page_tail(true);
|
|
|
|
}
|
2004-09-20 21:58:47 +00:00
|
|
|
|
2002-08-07 18:56:55 +00:00
|
|
|
?>
|