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
|
|
|
|
2007-10-29 16:38:25 +00:00
|
|
|
require_once("../inc/boinc_db.inc");
|
2006-01-13 01:07:05 +00:00
|
|
|
require_once("../inc/util.inc");
|
|
|
|
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());
|
|
|
|
|
2006-01-13 01:07:05 +00:00
|
|
|
$user = get_logged_in_user();
|
|
|
|
|
2008-12-13 18:29:15 +00:00
|
|
|
$name = post_str("name", true);
|
2006-01-13 01:07:05 +00:00
|
|
|
if (strlen($name) == 0) {
|
2008-12-13 18:29:15 +00:00
|
|
|
error_page(tra("You must choose a non-blank team name"));
|
2006-02-01 20:19:51 +00:00
|
|
|
}
|
|
|
|
|
2007-07-25 03:17:31 +00:00
|
|
|
$new_team = lookup_team_name($name);
|
|
|
|
if ($new_team) {
|
2008-12-13 18:29:15 +00:00
|
|
|
error_page(tra("A team named %1 already exists - try another name", htmlentities($name)));
|
2006-02-01 20:19:51 +00:00
|
|
|
}
|
|
|
|
|
2007-07-25 03:17:31 +00:00
|
|
|
$url = post_str("url", true);
|
|
|
|
$type = post_str("type", true);
|
|
|
|
$name_html = post_str("name_html", true);
|
|
|
|
$description = post_str("description", true);
|
|
|
|
$country = post_str("country", true);
|
2007-08-26 10:29:08 +00:00
|
|
|
if ($country == "") {
|
|
|
|
$country = "International";
|
|
|
|
}
|
2007-07-25 03:17:31 +00:00
|
|
|
|
|
|
|
$new_team = make_team(
|
|
|
|
$user->id, $name, $url, $type, $name_html, $description, $country
|
2006-01-13 01:07:05 +00:00
|
|
|
);
|
|
|
|
|
2007-07-25 03:17:31 +00:00
|
|
|
if ($new_team) {
|
2006-01-13 01:07:05 +00:00
|
|
|
user_join_team($new_team, $user);
|
2007-07-25 03:17:31 +00:00
|
|
|
Header("Location: team_display.php?teamid=$new_team->id");
|
2006-01-13 01:07:05 +00:00
|
|
|
} else {
|
2008-12-13 18:29:15 +00:00
|
|
|
error_page(tra("Could not create team - please try later."));
|
2006-01-13 01:07:05 +00:00
|
|
|
}
|
2003-01-03 21:55:05 +00:00
|
|
|
|
2002-08-07 18:56:55 +00:00
|
|
|
?>
|