2003-03-17 22:37:49 +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/>.
|
2008-03-06 00:40:48 +00:00
|
|
|
|
2005-12-04 23:39:09 +00:00
|
|
|
// show all the hosts for a user.
|
|
|
|
// if $userid is absent, show hosts of logged-in user
|
2003-03-19 21:01:32 +00:00
|
|
|
|
2007-10-28 15:03:14 +00:00
|
|
|
require_once("../inc/boinc_db.inc");
|
2005-12-04 23:39:09 +00:00
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/host.inc");
|
|
|
|
require_once("../inc/cache.inc");
|
2003-03-17 22:37:49 +00:00
|
|
|
|
2005-12-04 23:39:09 +00:00
|
|
|
$show_all = get_int("show_all", true);
|
2006-02-27 20:49:22 +00:00
|
|
|
if ($show_all != 1) {
|
|
|
|
$show_all = 0;
|
2008-09-07 07:40:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$rev = get_int("rev", true);
|
|
|
|
if ($rev != 1) {
|
|
|
|
$rev = 0;
|
2006-02-27 20:49:22 +00:00
|
|
|
}
|
|
|
|
|
2006-02-22 06:19:54 +00:00
|
|
|
$sort = get_str("sort", true);
|
2008-09-07 07:40:56 +00:00
|
|
|
|
2005-12-04 23:39:09 +00:00
|
|
|
$user = get_logged_in_user(false);
|
2006-02-27 20:49:22 +00:00
|
|
|
$userid = get_int("userid", true);
|
|
|
|
|
2005-12-04 23:39:09 +00:00
|
|
|
if ($user && $user->id == $userid) {
|
|
|
|
$userid = 0;
|
|
|
|
}
|
|
|
|
if ($userid) {
|
|
|
|
$user = lookup_user_id($userid);
|
|
|
|
if (!$user) {
|
|
|
|
error_page("No such user");
|
2005-07-20 12:49:45 +00:00
|
|
|
}
|
2007-10-27 20:05:32 +00:00
|
|
|
$caching = true;
|
|
|
|
|
2007-10-24 17:35:28 +00:00
|
|
|
// At this point, we know that $userid, $show_all and $sort all have
|
2006-02-27 20:49:22 +00:00
|
|
|
// valid values.
|
2007-10-24 17:35:28 +00:00
|
|
|
//
|
2009-02-17 17:39:57 +00:00
|
|
|
$cache_args="userid=$userid&show_all=$show_all&sort=$sort&rev=$rev";
|
2005-12-04 23:39:09 +00:00
|
|
|
start_cache(USER_PAGE_TTL, $cache_args);
|
|
|
|
if ($user->show_hosts) {
|
|
|
|
page_head("Computers belonging to $user->name");
|
2003-03-19 21:01:32 +00:00
|
|
|
} else {
|
2005-12-04 23:39:09 +00:00
|
|
|
page_head("Computers hidden");
|
|
|
|
echo "This user has chosen not to show information about their computers.\n";
|
|
|
|
page_tail();
|
|
|
|
end_cache(USER_PAGE_TTL, $cache_args);
|
|
|
|
exit();
|
2003-03-19 21:01:32 +00:00
|
|
|
}
|
2005-12-04 23:39:09 +00:00
|
|
|
$private = false;
|
|
|
|
} else {
|
2005-12-21 22:59:21 +00:00
|
|
|
$user = get_logged_in_user();
|
2007-10-27 20:05:32 +00:00
|
|
|
$caching = false;
|
2005-12-04 23:39:09 +00:00
|
|
|
$userid = $user->id;
|
|
|
|
page_head("Your computers");
|
|
|
|
$private = true;
|
|
|
|
}
|
2005-09-21 21:39:35 +00:00
|
|
|
|
2010-02-04 16:15:54 +00:00
|
|
|
show_user_hosts($userid, $private, $show_all, $sort, $rev);
|
2007-10-24 17:35:28 +00:00
|
|
|
|
2005-12-04 23:39:09 +00:00
|
|
|
if ($caching) {
|
|
|
|
page_tail(true);
|
|
|
|
end_cache(USER_PAGE_TTL, $cache_args);
|
|
|
|
} else {
|
|
|
|
page_tail();
|
|
|
|
}
|
2008-03-06 00:40:48 +00:00
|
|
|
|
2003-03-17 22:37:49 +00:00
|
|
|
?>
|