2006-02-01 20:19:51 +00:00
|
|
|
<?php
|
|
|
|
|
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
|
|
|
|
|
|
|
$auth = process_user_text($_GET["account_key"]);
|
|
|
|
$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
|
|
|
}
|
|
|
|
|
2007-07-25 03:17:31 +00:00
|
|
|
$url = $_GET["url"];
|
|
|
|
$type_name = $_GET["type"]; // textual
|
|
|
|
$type = team_type_num($type_name);
|
|
|
|
$name_html = $_GET["name_html"];
|
|
|
|
$description = $_GET["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
|
|
|
|
|
|
|
// the following cleanses its args
|
|
|
|
//
|
|
|
|
$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
|
|
|
}
|
|
|
|
|
|
|
|
?>
|