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
|
2014-04-18 06:31:51 +00:00
|
|
|
// Copyright (C) 2014 University of California
|
2008-08-05 22:43:14 +00:00
|
|
|
//
|
|
|
|
// 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-26 21:14:35 +00:00
|
|
|
require_once("../inc/boinc_db.inc");
|
2006-01-10 23:21:23 +00:00
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/team.inc");
|
2002-08-07 18:56:55 +00:00
|
|
|
|
2014-04-18 06:31:51 +00:00
|
|
|
if (DISABLE_TEAMS) error_page("Teams are disabled");
|
|
|
|
|
2011-02-09 22:11:34 +00:00
|
|
|
check_get_args(array("format", "team_id", "team_ids", "team_name"));
|
|
|
|
|
2006-01-10 23:21:23 +00:00
|
|
|
$format = get_str("format", true);
|
2006-01-16 06:04:16 +00:00
|
|
|
$team_id = get_int("team_id", true);
|
2010-03-06 20:25:58 +00:00
|
|
|
$team_ids = get_str("team_ids", true);
|
2006-09-06 20:56:55 +00:00
|
|
|
|
2010-03-06 20:25:58 +00:00
|
|
|
if ($team_id || $team_ids || ($format == 'xml')) {
|
2006-01-16 06:04:16 +00:00
|
|
|
require_once ('../inc/xml.inc');
|
|
|
|
xml_header();
|
2006-09-06 20:56:55 +00:00
|
|
|
$retval = db_init_xml();
|
|
|
|
if ($retval) xml_error($retval);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($team_id) {
|
2014-06-24 01:29:20 +00:00
|
|
|
$team = BoincTeam::lookup_id($team_id);
|
2006-01-16 06:04:16 +00:00
|
|
|
if ($team) {
|
|
|
|
show_team_xml($team);
|
|
|
|
} else {
|
2013-12-29 06:50:59 +00:00
|
|
|
xml_error(ERR_DB_NOT_FOUND);
|
2006-01-16 06:04:16 +00:00
|
|
|
}
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2010-03-06 20:25:58 +00:00
|
|
|
if ($team_ids) {
|
|
|
|
$team_id_array = explode(",", $team_ids);
|
|
|
|
echo "<teams>\n";
|
|
|
|
$total = 0;
|
|
|
|
foreach ($team_id_array as $team_id) {
|
|
|
|
if (is_numeric($team_id)) { //make sure only numbers get through
|
2014-06-24 01:29:20 +00:00
|
|
|
$team = BoincTeam::lookup_id($team_id);
|
2010-03-06 20:25:58 +00:00
|
|
|
if ($team) {
|
|
|
|
show_team_xml($team);
|
|
|
|
$total++;
|
|
|
|
if ($total == 100) break;
|
|
|
|
}
|
|
|
|
//do not error out
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo "</teams>\n";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2007-08-24 15:41:01 +00:00
|
|
|
$team_name = get_str("team_name");
|
2006-09-06 20:56:55 +00:00
|
|
|
$name_lc = strtolower($team_name);
|
|
|
|
$name_lc = escape_pattern($name_lc);
|
2010-03-06 20:25:58 +00:00
|
|
|
|
2011-08-25 22:12:48 +00:00
|
|
|
$clause = "name like '%".BoincDb::escape_string($name_lc)."%' order by expavg_credit desc limit 100";
|
2007-10-26 21:14:35 +00:00
|
|
|
$teams = BoincTeam::enum($clause);
|
2006-01-10 23:21:23 +00:00
|
|
|
|
|
|
|
if ($format == 'xml') {
|
|
|
|
echo "<teams>\n";
|
|
|
|
$total = 0;
|
2007-10-26 21:14:35 +00:00
|
|
|
foreach($teams as $team) {
|
2006-01-10 23:21:23 +00:00
|
|
|
show_team_xml($team);
|
|
|
|
$total++;
|
|
|
|
if ($total == 100) break;
|
|
|
|
}
|
|
|
|
echo "</teams>\n";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2010-02-16 01:06:03 +00:00
|
|
|
page_head(tra("Search Results"));
|
2007-10-26 21:14:35 +00:00
|
|
|
if (count($teams)) {
|
2011-08-25 22:12:48 +00:00
|
|
|
echo "<h2>".tra("Search results for '%1'", sanitize_tags($team_name))."</h2>";
|
2006-01-10 23:21:23 +00:00
|
|
|
echo "<p>";
|
2010-02-16 01:06:03 +00:00
|
|
|
echo tra("You may view these teams' members, statistics, and information.");
|
2006-01-10 23:21:23 +00:00
|
|
|
echo "<ul>";
|
2007-10-26 21:14:35 +00:00
|
|
|
foreach($teams as $team) {
|
2006-01-10 23:21:23 +00:00
|
|
|
echo "<li>";
|
2007-10-26 21:14:35 +00:00
|
|
|
echo "<a href=team_display.php?teamid=$team->id>";
|
|
|
|
echo "$team->name</a></li>";
|
2006-01-10 23:21:23 +00:00
|
|
|
}
|
|
|
|
echo "</ul>";
|
2007-10-26 21:14:35 +00:00
|
|
|
if (count($teams)==100) {
|
2010-03-06 20:25:58 +00:00
|
|
|
echo
|
|
|
|
tra("More than 100 teams match your search. The first 100 are shown.")
|
|
|
|
."<br>
|
|
|
|
";
|
2002-08-07 18:56:55 +00:00
|
|
|
}
|
2006-01-10 23:21:23 +00:00
|
|
|
}
|
2010-03-06 20:25:58 +00:00
|
|
|
echo tra(
|
2010-05-12 17:09:40 +00:00
|
|
|
"End of results. %1 If you cannot find the team you are looking for, you may %2create a team%3 yourself.",
|
2010-03-06 20:25:58 +00:00
|
|
|
"<br>",
|
|
|
|
"<a href=team_create_form.php>",
|
|
|
|
"</a>"
|
|
|
|
);
|
2006-01-10 23:21:23 +00:00
|
|
|
page_tail();
|
2002-08-07 18:56:55 +00:00
|
|
|
|
|
|
|
?>
|