2002-08-07 18:56:55 +00:00
|
|
|
<?php
|
|
|
|
|
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
|
|
|
|
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);
|
2006-09-06 20:56:55 +00:00
|
|
|
|
|
|
|
if ($team_id || ($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) {
|
|
|
|
$team = lookup_team($team_id);
|
2006-01-16 06:04:16 +00:00
|
|
|
if ($team) {
|
|
|
|
show_team_xml($team);
|
|
|
|
} else {
|
2006-09-06 20:56:55 +00:00
|
|
|
xml_error(-136);
|
2006-01-16 06:04:16 +00:00
|
|
|
}
|
|
|
|
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);
|
|
|
|
|
2007-10-27 20:38:12 +00:00
|
|
|
$clause = "name like '%".boinc_real_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();
|
|
|
|
}
|
|
|
|
|
|
|
|
page_head("Search Results");
|
2007-10-26 21:14:35 +00:00
|
|
|
if (count($teams)) {
|
2007-08-24 15:41:01 +00:00
|
|
|
echo "<h2>Search results for '".strip_tags($team_name)."'</h2>";
|
2006-01-10 23:21:23 +00:00
|
|
|
echo "<p>";
|
|
|
|
echo "You may view these teams' members, statistics, and information.";
|
|
|
|
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) {
|
2006-01-10 23:21:23 +00:00
|
|
|
echo "
|
|
|
|
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
|
|
|
}
|
|
|
|
echo "End of results<br>";
|
|
|
|
echo "If you cannot find the team you are looking for, you may create a team ";
|
|
|
|
echo "by clicking <a href=team_create_form.php>here</a>.";
|
|
|
|
page_tail();
|
2002-08-07 18:56:55 +00:00
|
|
|
|
|
|
|
?>
|