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/>.
|
|
|
|
|
2004-06-16 19:10:24 +00:00
|
|
|
require_once("../inc/cache.inc");
|
2005-02-16 19:08:07 +00:00
|
|
|
require_once("../inc/util.inc");
|
2007-11-07 17:23:29 +00:00
|
|
|
require_once("../inc/boinc_db.inc");
|
2006-11-02 19:34:02 +00:00
|
|
|
require_once("../inc/team.inc");
|
2002-08-07 18:56:55 +00:00
|
|
|
|
2011-02-09 22:11:34 +00:00
|
|
|
check_get_args(array("teamid"));
|
|
|
|
|
2005-02-15 22:29:32 +00:00
|
|
|
$teamid = get_int("teamid");
|
2007-11-16 20:43:07 +00:00
|
|
|
$team = BoincTeam::lookup_id($teamid);
|
2004-06-24 16:51:22 +00:00
|
|
|
|
2007-10-26 21:14:35 +00:00
|
|
|
$get_from_db = false;
|
|
|
|
|
2003-03-21 04:38:55 +00:00
|
|
|
$user = get_logged_in_user(false);
|
2007-10-26 21:14:35 +00:00
|
|
|
|
2007-11-16 20:43:07 +00:00
|
|
|
// always show fresh copy to admins; they might be editing info
|
2007-10-26 21:14:35 +00:00
|
|
|
//
|
2007-11-16 20:43:07 +00:00
|
|
|
if (is_team_admin($user, $team)) {
|
2007-10-26 21:14:35 +00:00
|
|
|
$get_from_db = true;
|
|
|
|
}
|
2008-06-13 16:40:51 +00:00
|
|
|
if ($user->id == $team->ping_user) {
|
|
|
|
$get_from_db = true;
|
|
|
|
}
|
2007-10-26 21:14:35 +00:00
|
|
|
|
2007-11-16 20:43:07 +00:00
|
|
|
// Cache the team record, its forum record, its new members,
|
|
|
|
// its admins, and its member counts
|
2007-10-26 21:14:35 +00:00
|
|
|
|
2007-11-26 03:05:27 +00:00
|
|
|
$cache_args = "teamid=$teamid";
|
2007-10-26 21:14:35 +00:00
|
|
|
if (!$get_from_db) {
|
|
|
|
$cached_data = get_cached_data(TEAM_PAGE_TTL, $cache_args);
|
|
|
|
if ($cached_data) {
|
|
|
|
// We found some old but non-stale data, let's use it
|
|
|
|
$team = unserialize($cached_data);
|
|
|
|
} else {
|
|
|
|
$get_from_db = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($get_from_db) {
|
2007-11-07 17:23:29 +00:00
|
|
|
$team->nusers = BoincUser::count("teamid=$teamid");
|
2007-11-16 20:43:07 +00:00
|
|
|
$team->nusers_worked = BoincUser::count("teamid=$teamid and total_credit>0");
|
|
|
|
$team->nusers_active = BoincUser::count("teamid=$teamid and expavg_credit>0.1");
|
|
|
|
$team->forum = BoincForum::lookup("parent_type=1 and category=$team->id");
|
|
|
|
$team->new_members = new_member_list($teamid);
|
|
|
|
$team->admins = admin_list($teamid);
|
|
|
|
$team->founder = BoincUser::lookup_id($team->userid);
|
2011-03-12 15:36:58 +00:00
|
|
|
set_cached_data(TEAM_PAGE_TTL, serialize($team), $cache_args);
|
2006-11-02 19:34:02 +00:00
|
|
|
}
|
|
|
|
|
2002-08-07 18:56:55 +00:00
|
|
|
if (!$team) {
|
2010-02-16 01:06:03 +00:00
|
|
|
error_page(tra("no such team"));
|
2002-08-07 18:56:55 +00:00
|
|
|
}
|
|
|
|
|
2007-11-16 20:43:07 +00:00
|
|
|
display_team_page($team, $user);
|
2003-03-21 04:38:55 +00:00
|
|
|
|
2004-11-18 20:01:12 +00:00
|
|
|
page_tail(true);
|
2004-06-16 19:10:24 +00:00
|
|
|
|
2002-08-07 18:56:55 +00:00
|
|
|
?>
|