2006-02-01 20:19:51 +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/>.
|
2006-02-01 20:19:51 +00:00
|
|
|
|
2007-10-29 16:38:25 +00:00
|
|
|
require_once("../inc/boinc_db.inc");
|
2006-02-01 20:19:51 +00:00
|
|
|
require_once("../inc/xml.inc");
|
|
|
|
require_once("../inc/team.inc");
|
2007-07-25 03:17:31 +00:00
|
|
|
require_once("../inc/team_types.inc");
|
2006-02-01 20:19:51 +00:00
|
|
|
|
|
|
|
xml_header();
|
2006-09-06 20:56:55 +00:00
|
|
|
$retval = db_init_xml();
|
|
|
|
if ($retval) xml_error($retval);
|
2006-02-01 20:19:51 +00:00
|
|
|
|
2008-06-11 19:36:10 +00:00
|
|
|
$auth = get_str("account_key");
|
2006-02-01 20:19:51 +00:00
|
|
|
$user = lookup_user_auth($auth);
|
|
|
|
if (!$user) {
|
2006-09-06 20:56:55 +00:00
|
|
|
xml_error(-136);
|
2006-02-01 20:19:51 +00:00
|
|
|
}
|
|
|
|
|
2007-07-25 03:17:31 +00:00
|
|
|
$name = $_GET["name"];
|
2006-02-01 20:19:51 +00:00
|
|
|
if (strlen($name) == 0) {
|
2006-09-06 20:56:55 +00:00
|
|
|
xml_error(-1, "must set team name");
|
2006-02-01 20:19:51 +00:00
|
|
|
}
|
|
|
|
|
2008-06-11 19:36:10 +00:00
|
|
|
$url = get_str("url");
|
|
|
|
$type_name = get_str("type"); // textual
|
2007-07-25 03:17:31 +00:00
|
|
|
$type = team_type_num($type_name);
|
2008-06-11 19:36:10 +00:00
|
|
|
$name_html = get_str("name_html");
|
|
|
|
$description = get_str("description");
|
2007-08-26 10:29:08 +00:00
|
|
|
$country = get_str("country");
|
|
|
|
if ($country == "") {
|
|
|
|
$country = "International";
|
|
|
|
}
|
2007-07-25 03:17:31 +00:00
|
|
|
|
2008-06-11 19:36:10 +00:00
|
|
|
// the following DB-escapes its args
|
2007-07-25 03:17:31 +00:00
|
|
|
//
|
|
|
|
$new_team = make_team(
|
|
|
|
$user->id, $name, $url, $type, $name_html, $description, $country
|
2006-02-01 20:19:51 +00:00
|
|
|
);
|
|
|
|
|
2007-07-25 03:17:31 +00:00
|
|
|
if ($new_team) {
|
2006-02-01 20:19:51 +00:00
|
|
|
user_join_team($new_team, $user);
|
2006-09-06 20:56:55 +00:00
|
|
|
echo "<create_team_reply>
|
|
|
|
<success/>
|
2007-07-25 03:17:31 +00:00
|
|
|
<team_id>$new_team->id</team_id>
|
2006-09-06 20:56:55 +00:00
|
|
|
</create_team_reply>
|
|
|
|
";
|
2006-02-01 20:19:51 +00:00
|
|
|
} else {
|
2006-09-08 19:51:33 +00:00
|
|
|
xml_error(-137, "could not create team");
|
2006-02-01 20:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|