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/>.
|
2002-08-07 18:56:55 +00:00
|
|
|
|
2006-10-23 19:33:22 +00:00
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/team.inc");
|
2007-12-01 22:43:11 +00:00
|
|
|
require_once("../inc/sanitize_html.inc");
|
2007-10-26 21:14:35 +00:00
|
|
|
require_once("../inc/boinc_db.inc");
|
2002-08-07 18:56:55 +00:00
|
|
|
|
2006-10-23 19:33:22 +00:00
|
|
|
$user = get_logged_in_user();
|
|
|
|
$teamid = post_int("teamid");
|
2007-10-26 21:14:35 +00:00
|
|
|
$team = BoincTeam::lookup_id($teamid);
|
2006-10-23 19:33:22 +00:00
|
|
|
|
2007-11-07 17:23:29 +00:00
|
|
|
if (!$team) error_page("no such team");
|
|
|
|
require_admin($user, $team);
|
2007-10-26 21:14:35 +00:00
|
|
|
|
2008-12-14 22:18:49 +00:00
|
|
|
$team_url = BoincDb::escape_string(strip_tags(post_str("url", true)));
|
2007-10-26 21:14:35 +00:00
|
|
|
$x = strstr($team_url, "http://");
|
|
|
|
if ($x) {
|
|
|
|
$team_url = substr($team_url, 7);
|
|
|
|
}
|
2008-12-14 22:18:49 +00:00
|
|
|
$team_name = BoincDb::escape_string(strip_tags(post_str("name")));
|
2007-10-26 21:14:35 +00:00
|
|
|
$team_name_lc = strtolower($team_name);
|
2008-02-17 16:12:03 +00:00
|
|
|
|
2008-06-11 19:36:10 +00:00
|
|
|
$tnh = post_str("name_html", true);
|
2007-12-01 22:43:11 +00:00
|
|
|
$team_name_html = sanitize_html($tnh);
|
|
|
|
|
2008-12-14 22:18:49 +00:00
|
|
|
$team_name_html = BoincDb::escape_string($team_name_html);
|
2007-10-26 21:14:35 +00:00
|
|
|
|
2008-12-14 22:18:49 +00:00
|
|
|
$team_description = BoincDb::escape_string(post_str("description", true));
|
|
|
|
$type = BoincDb::escape_string(post_str("type", true));
|
|
|
|
$country = BoincDb::escape_string(post_str("country", true));
|
2007-10-26 21:14:35 +00:00
|
|
|
if ($country == "") {
|
|
|
|
$country = "International";
|
|
|
|
}
|
|
|
|
if (!is_valid_country($country)) {
|
|
|
|
error_page("bad country");
|
|
|
|
}
|
2008-10-08 16:48:11 +00:00
|
|
|
$joinable = post_str('joinable', true)?1:0;
|
2007-10-26 21:14:35 +00:00
|
|
|
|
2007-12-01 22:43:11 +00:00
|
|
|
$t = BoincTeam::lookup("name='$team_name'");
|
|
|
|
if ($t && $t->id != $teamid) {
|
|
|
|
error_page("The name '$team_name' is being used by another team.");
|
2007-10-26 21:14:35 +00:00
|
|
|
}
|
2007-12-01 22:43:11 +00:00
|
|
|
if (strlen($team_name) == 0) {
|
|
|
|
error_page("Must specify team name");
|
|
|
|
// Should be caught up with the post_str("name"),
|
|
|
|
// but you can never be too safe.
|
2007-10-26 21:14:35 +00:00
|
|
|
}
|
2002-08-07 18:56:55 +00:00
|
|
|
|
2007-10-26 21:14:35 +00:00
|
|
|
$clause = sprintf(
|
|
|
|
"name = '%s',
|
|
|
|
name_lc = '%s',
|
|
|
|
name_html = '%s',
|
|
|
|
url = '%s',
|
|
|
|
description = '%s',
|
|
|
|
type = %d,
|
2008-10-08 16:48:11 +00:00
|
|
|
country='%s',
|
|
|
|
joinable=%d",
|
2007-10-26 21:14:35 +00:00
|
|
|
$team_name,
|
|
|
|
$team_name_lc,
|
|
|
|
$team_name_html,
|
|
|
|
$team_url,
|
|
|
|
$team_description,
|
|
|
|
$type,
|
2008-10-08 16:48:11 +00:00
|
|
|
$country,
|
|
|
|
$joinable
|
2007-10-26 21:14:35 +00:00
|
|
|
);
|
2007-12-01 22:43:11 +00:00
|
|
|
|
2007-10-26 21:14:35 +00:00
|
|
|
$ret = $team->update($clause);
|
|
|
|
if ($ret) {
|
|
|
|
Header("Location: team_display.php?teamid=$team->id");
|
2006-10-23 19:33:22 +00:00
|
|
|
} else {
|
2007-10-26 21:14:35 +00:00
|
|
|
error_page("Could not update team - please try later.");
|
2006-10-23 19:33:22 +00:00
|
|
|
}
|
2002-08-07 18:56:55 +00:00
|
|
|
|
|
|
|
?>
|