function nextprevButtons($numRows, $recordsPerPage) { global $clan_name; $pageid = 1; if (isset($_GET['page'])) { $pageid = escape_string($_GET['page']); } $pagenumber = 1; if (isset($_GET['pagenumber'])) { $pagenumber = escape_string($_GET['pagenumber']); } $nextpage = $pagenumber + 1; $prevpage = $pagenumber - 1; $firstpage = 1; $totalpages = ceil($numRows / $recordsPerPage); $url_clan_name = escape_hash($clan_name); if ($totalpages > 1) { $range = 10; $range_min = $range % 2 == 0 ? $range / 2 - 1 : ($range - 1) / 2; $range_max = $range % 2 == 0 ? $range_min + 1 : $range_min; $page_min = $pagenumber - $range_min; $page_max = $pagenumber + $range_max; $page_min = $page_min < 1 ? 1 : $page_min; $page_max = $page_max < $page_min + $range - 1 ? $page_min + $range - 1 : $page_max; if ($page_max > $totalpages) { $page_min = $page_min > 1 ? $totalpages - $range + 1 : 1; $page_max = $totalpages; } $page_min = $page_min < 1 ? 1 : $page_min; $pagelink = "index.php?func=show&page={$pageid}"; if ($clan_name != "") { $pagelink = "index.php?func=clan&filter={$url_clan_name}&page={$pageid}"; } echo "<tr>"; echo "<td height=\"20\" class=\"line1\" align=\"center\">"; if ($pagenumber != 1) { echo "<a href=\"{$pagelink}&pagenumber={$firstpage}\"><< </a>  "; echo "<a href=\"{$pagelink}&pagenumber={$prevpage}\">< </a>  "; } else { echo "<font color=\"#888888\"><<   </font>"; echo "<font color=\"#888888\"><   </font>"; } // echo "   -    Page $pagenumber of $totalpages    -   "; for ($i = $page_min; $i <= $page_max; $i++) { if ($i == $pagenumber) { echo "<font size=\"2px\" color=\"#555555\">{$i} </font>"; } else { echo "<a href=\"{$pagelink}&pagenumber={$i}\">{$i}</a> "; } } if ($pagenumber != $totalpages) { echo "<a href=\"{$pagelink}&pagenumber={$nextpage}\"> ></a>  "; echo "<a href=\"{$pagelink}&pagenumber={$totalpages}\"> >></a></td>"; } else { echo "<font color=\"#888888\"> >  </font>"; echo "<font color=\"#888888\"> >></font></td>"; } } }
function menubox($menuselected, $clan_name = "") { global $clan_name; global $weaplist_max; global $toplist_max; global $maplist_max; global $hide_menu_header; global $text; $link = baselink(); $func = "show"; if ($clan_name != "") { $func = "clan"; } $url_clan_name = escape_hash($clan_name); if ($hide_menu_header == 1) { echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"outertable\"><tr><td>"; } else { echo "<table width=\"100%\" height=\"20\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"outertable\"><tr><td align=\"center\">" . $text["menu"] . "</td></tr><tr><td>"; } echo "<table width=\"100%\" height=\"40\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"innertable\">"; echo "\t<tr>"; //<td align=\"center\"> if ($menuselected == 1 || $menuselected < 0 || $menuselected > 5) { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border\">" . $text["top"] . " " . $toplist_max . " " . $text["skill"] . "</td>"; } else { if (isset($clan_name)) { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border_alternate\"><a href=\"{$link}?func={$func}&page=1&filter={$url_clan_name}\">" . $text["top"] . " " . $toplist_max . " " . $text["skill"] . "</a></td>"; } else { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border_alternate\"><a href=\"{$link}?func={$func}&page=1\">" . $text["top"] . " " . $toplist_max . " " . $text["skill"] . "</a></td>"; } } if ($menuselected == 2) { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border\">" . $text["top"] . " " . $toplist_max . " " . $text["kills"] . "</td>"; } else { if (isset($clan_name)) { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border_alternate\"><a href=\"{$link}?func={$func}&page=2&filter={$url_clan_name}\">" . $text["top"] . " " . $toplist_max . " " . $text["kills"] . "</a></td>"; } else { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border_alternate\"><a href=\"{$link}?func={$func}&page=2\">" . $text["top"] . " " . $toplist_max . " " . $text["kills"] . "</a></td>"; } } if ($menuselected == 3) { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border\">" . $text["top"] . " " . $toplist_max . " " . $text["ratio"] . "</td>"; } else { if (isset($clan_name)) { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border_alternate\"><a href=\"{$link}?func={$func}&page=3&filter={$url_clan_name}\">" . $text["top"] . " " . $toplist_max . " " . $text["ratio"] . "</a></td>"; } else { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border_alternate\"><a href=\"{$link}?func={$func}&page=3\">" . $text["top"] . " " . $toplist_max . " " . $text["ratio"] . "</a></td>"; } } if ($menuselected == 4) { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border\">" . $text["top"] . " " . $weaplist_max . " " . $text["weapons"] . "</td>"; } else { if (isset($clan_name)) { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border_alternate\"><a href=\"{$link}?func={$func}&page=4&filter={$url_clan_name}\">" . $text["top"] . " " . $weaplist_max . " " . $text["weapons"] . "</a></td>"; } else { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border_alternate\"><a href=\"{$link}?func={$func}&page=4\">" . $text["top"] . " " . $weaplist_max . " " . $text["weapons"] . "</a></td>"; } } if ($menuselected == 5) { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border\">" . $text["top"] . " " . $maplist_max . " " . $text["maps"] . "</td>"; } else { if (isset($clan_name)) { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border_alternate\"><a href=\"{$link}?func={$func}&page=5&filter={$url_clan_name}\">" . $text["top"] . " " . $maplist_max . " " . $text["maps"] . "</a></td>"; } else { echo "\t\t<td width=\"20%\" align=\"center\" class=\"with_border_alternate\"><a href=\"{$link}?func={$func}&page=5\">" . $text["top"] . " " . $maplist_max . " " . $text["maps"] . "</a></td>"; } } echo "</tr></table>"; echo "</td></tr></table>"; }