2002-08-07 18:56:55 +00:00
|
|
|
<?php
|
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
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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);
|
2006-11-02 19:34:02 +00:00
|
|
|
set_cache_data(serialize($team), $cache_args);
|
|
|
|
}
|
|
|
|
|
2002-08-07 18:56:55 +00:00
|
|
|
if (!$team) {
|
2005-02-15 22:29:32 +00:00
|
|
|
error_page("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
|
|
|
?>
|