diff options
Diffstat (limited to 'html/pages/maps.php')
-rw-r--r-- | html/pages/maps.php | 89 |
1 files changed, 44 insertions, 45 deletions
diff --git a/html/pages/maps.php b/html/pages/maps.php index 9d30179..69c8785 100644 --- a/html/pages/maps.php +++ b/html/pages/maps.php @@ -12,14 +12,13 @@ function SortPic($curr_field, $filter, $sort) { return(' <img src="'. $fname .'" border="0" width="11" height="9" alt="" class="tooltip" title="('.strtolower($sort).'ending)">');
}
-
// Get filter and set sorting
$filter = my_addslashes($_GET[filter]);
$sort = my_addslashes($_GET[sort]);
$q = my_addslashes($_GET[q]);
$gid = preg_replace('/\D/', '', $_GET[gid]);
-IF (empty($filter) or (!in_array(strtolower($filter), array("mapfile", "matchcount", "frags", "matchscore", "gametime")))) {
+if (empty($filter) or (!in_array(strtolower($filter), array("mapfile", "matchcount", "frags", "matchscore", "gametime")))) {
$filter = "mapfile";
}
@@ -37,32 +36,29 @@ else { if (isset($q)) {
if ($gid != 0) {
- $sql_condition .= ' AND mapfile LIKE "%' . $q . '%" ';
+ $sql_condition .= ' AND mapfile LIKE "%' . $q . '%" ';
}
else {
- $sql_condition .= ' WHERE mapfile LIKE "%' . $q . '%" ';
+ $sql_condition .= ' WHERE mapfile LIKE "%' . $q . '%" ';
}
$url_condition .= "&q=".urlencode($q);
}
-
// Firstly we need to work out First Last Next Prev pages
-
$mcount = small_count("SELECT mapfile FROM uts_match" . $sql_condition . " GROUP BY mapfile");
-
-$ecount = $mcount/25;
+$ecount = $mcount / 25;
$ecount2 = number_format($ecount, 0, '.', '');
-IF($ecount > $ecount2) {
+if ($ecount > $ecount2) {
$ecount2 = $ecount2+1;
}
$fpage = 0;
-IF($ecount < 1) { $lpage = 0; }
+if ($ecount < 1) { $lpage = 0; }
else { $lpage = $ecount2-1; }
$cpage = preg_replace('/\D/', '', $_GET["page"]);
-IF ($cpage == "") { $cpage = "0"; }
+if ($cpage == "") { $cpage = "0"; }
$qpage = $cpage*25;
$tfpage = $cpage+1;
@@ -70,46 +66,49 @@ $tlpage = $lpage+1; $ppage = $cpage-1;
$ppageurl = "<a class=\"pages\" href=\"./?p=maps&filter=$filter&sort=$sort&page=$ppage".$url_condition."\">[Previous]</a>";
-IF ($ppage < "0") { $ppageurl = "[Previous]"; }
+if ($ppage < "0") { $ppageurl = "[Previous]"; }
$npage = $cpage+1;
$npageurl = "<a class=\"pages\" href=\"./?p=maps&filter=$filter&sort=$sort&page=$npage".$url_condition."\">[Next]</a>";
-IF ($npage >= "$ecount") { $npageurl = "[Next]"; }
+if ($npage >= "$ecount") { $npageurl = "[Next]"; }
$fpageurl = "<a class=\"pages\" href=\"./?p=maps&filter=$filter&sort=$sort&page=$fpage".$url_condition."\">[First]</a>";
-IF ($cpage == "0") { $fpageurl = "[First]"; }
+if ($cpage == "0") { $fpageurl = "[First]"; }
$lpageurl = "<a class=\"pages\" href=\"./?p=maps&filter=$filter&sort=$sort&page=$lpage".$url_condition."\">[Last]</a>";
-IF ($cpage == "$lpage") { $lpageurl = "[Last]"; }
+if ($cpage == "$lpage") { $lpageurl = "[Last]"; }
echo'
<form NAME="mapfilter" METHOD="get" ACTION="">
<div class="pages">Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</div>
<table class="zebra box" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
- <th class="heading" colspan="5" align="center">Unreal Tournament Maps List</th>
+ <th class="heading" colspan="5" align="center">Maps List</th>
</tr>
<tr>
<th class="smheading" align="center" width="100%" colspan="5">
- <input type = "hidden" name = "p" value = "maps">
- <input type = "hidden" name = "sort" value = "'.$sort.'">
- <input type = "hidden" name = "filter" value = "'.$filter.'">
- Filter: ';
-echo '<select class="searchform" name="gid">';
-echo '<option value="0">*</option>';
-$sql_game = "SELECT DISTINCT(p.gid), g.name FROM uts_player AS p, uts_games AS g WHERE p.gid = g.id ORDER BY g.name ASC";
-$q_game = mysql_query($sql_game) or die(mysql_error());
-while ($r_game = mysql_fetch_array($q_game)) {
- $selected = ($r_game['gid'] == $gid) ? 'selected' : '';
- echo '<option '.$selected.' value="'.$r_game['gid'].'">'. $r_game['name'] .'</option>';
-}
-echo '</select> ';
-
-echo '<div class="darksearch">
- <span><input type="text" class="search square" placeholder="Search maps..." name="q" value="'.htmlentities($q).'"><input class="searchbutton" type="submit" value="Search"></span></div>';
-
-echo '
- </th>
+ <input type = "hidden" name = "p" value = "maps">
+ <input type = "hidden" name = "sort" value = "'.$sort.'">
+ <input type = "hidden" name = "filter" value = "'.$filter.'">
+ Filter:
+ <select class="searchform" name="gid">
+ <option value="0">*</option>';
+
+ $sql_game = "SELECT DISTINCT(p.gid), g.name FROM uts_player AS p, uts_games AS g WHERE p.gid = g.id ORDER BY g.name ASC";
+ $q_game = mysql_query($sql_game) or die(mysql_error());
+ while ($r_game = mysql_fetch_array($q_game)) {
+ $selected = ($r_game['gid'] == $gid) ? 'selected' : '';
+ echo '<option '.$selected.' value="'.$r_game['gid'].'">'. $r_game['name'] .'</option>';
+ }
+
+echo '</select>
+ <div class="darksearch">
+ <span>
+ <input type="text" class="search square" placeholder="Search maps..." name="q" value="'.htmlentities($q).'">
+ <input class="searchbutton" type="submit" value="Search">
+ </span>
+ </div>
+ </th>
</tr>
<tr>
<th class="smheading" align="center" width="250"><a class="smheading" href="./?p=maps&filter=mapfile&sort='.InvertSort('mapfile', $filter, $sort).$url_condition.'">Map Name</a>'.SortPic('mapfile', $filter, $sort).'</th>
@@ -120,26 +119,26 @@ echo ' </tr>';
$sql_maps = "SELECT IF(RIGHT(mapfile,4) LIKE '.unr', mapfile, CONCAT(mapfile, '.unr')) as mapfile, COUNT(id) AS matchcount, AVG(frags) AS frags, AVG(t0score+t1score+t2score+t3score) AS matchscore, SUM(gametime) AS gametime
-FROM uts_match" . $sql_condition . " GROUP BY mapfile ORDER BY $filter $sort LIMIT $qpage,25";
+ FROM uts_match" . $sql_condition . " GROUP BY mapfile ORDER BY $filter $sort LIMIT $qpage,25";
$q_maps = mysql_query($sql_maps) or die(mysql_error());
-while ($r_maps = mysql_fetch_array($q_maps)) {
+while ($r_maps = mysql_fetch_array($q_maps)) {
$r_mapfile = un_ut($r_maps[mapfile]);
$myurl = urlencode($r_mapfile);
$r_gametime = GetMinutes($r_maps[gametime]);
- echo'
+ echo '
<tr class="clickableRow" href="./?p=minfo&map='.$myurl.'">
- <td align="center"><a href="./?p=minfo&map='.$myurl.'">'.$r_mapfile.'</a></td>
- <td align="center">'.$r_maps[matchcount].'</td>
- <td align="center">'.get_dp($r_maps[frags]).'</td>
- <td align="center">'.get_dp($r_maps[matchscore]).'</td>
- <td align="center">'.$r_gametime.'</td>
+ <td align="center"><a href="./?p=minfo&map='.$myurl.'">'.$r_mapfile.'</a></td>
+ <td align="center">'.$r_maps[matchcount].'</td>
+ <td align="center">'.get_dp($r_maps[frags]).'</td>
+ <td align="center">'.get_dp($r_maps[matchscore]).'</td>
+ <td align="center">'.$r_gametime.'</td>
</tr>';
}
-echo'
+echo '
</tbody></table>
<div class="pages">Page ['.$tfpage.'/'.$tlpage.'] Selection: '.$fpageurl.' / '.$ppageurl.' / '.$npageurl.' / '.$lpageurl.'</div>
</form>';
-?>
\ No newline at end of file +?>
|