Mercurial > hg > batmud > maputils
diff www/info.php @ 1387:2b6b38e94bb2
Various minor code cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 23 Dec 2013 16:49:09 +0200 |
parents | 73dd95d63e7a |
children | 7fcea2fce0be |
line wrap: on
line diff
--- a/www/info.php Sat Dec 21 00:20:47 2013 +0200 +++ b/www/info.php Mon Dec 23 16:49:09 2013 +0200 @@ -38,18 +38,21 @@ <? $locTable = apc_fetch("info_locTable"); -if (empty($locTable)) { - $locTable = readLocationFiles(); +if (empty($locTable)) +{ + $locTable = stReadLocationFiles(); apc_store("info_locTable", $locTable, 3600); } $wizTable = apc_fetch("wizTable"); -if (empty($wizTable)) { - $wizTable = readWizInfoFiles(); +if (empty($wizTable)) +{ + $wizTable = stReadWizInfoFiles(); apc_store("wizTable", $wizTable, 3600); } -if (isset($_GET["a"])) { +if (isset($_GET["a"])) +{ $coderName = basename($_GET["a"]); $coderName = strtoupper(substr($coderName, 0, 1)).strtolower(substr($coderName, 1)); } @@ -74,7 +77,8 @@ } } -if (count($wizTable) > 0) { +if (count($wizTable) > 0) +{ /* Make alphabetically sorted table of wizards */ foreach ($wizTable as $alpha => $data) @@ -87,53 +91,56 @@ */ $totalWiz = 0; $maxRow = 6; - foreach ($alphaTable as $alpha => $data) { - if (count($data) > 0) { - usort($data, "wizardSort"); + foreach ($alphaTable as $alpha => $data) + if (count($data) > 0) + { + usort($data, "wizardSort"); + + $letter = strtoupper($alpha); + echo "<h3><a name=\"".$letter."\"></a>".$letter."</h3>\n"; + echo "<table class=\"loc\">\n"; + $n = 0; + + foreach ($data as $wizard) + { + if ($n == 0) echo " <tr>\n"; - $letter = strtoupper($alpha); - echo "<h3><a name=\"".$letter."\"></a>".$letter."</h3>\n"; - echo "<table class=\"loc\">\n"; - $n = 0; - - foreach ($data as $wizard) { - if ($n == 0) echo " <tr>\n"; - - $totalWiz++; + $totalWiz++; - printf(" <td width=\"%d%%\" style=\"background: %s;\"><a href=\"loc.php?a=%s\">%s</a> <span style=\"color: #f80;\">", - (100 / $maxRow), (count($wizard) > 2 || isset($wizard["desc"])) ? "#474" : "#744", $wizard["name"], $wizard["name"]); + printf(" <td width=\"%d%%\" style=\"background: %s;\"><a href=\"loc.php?a=%s\">%s</a> <span style=\"color: #f80;\">", + (100 / $maxRow), (count($wizard) > 2 || isset($wizard["desc"])) ? "#474" : "#744", $wizard["name"], $wizard["name"]); - if ($wizard["areas"] > 0) - echo " (".$wizard["areas"].")"; + if ($wizard["areas"] > 0) + echo " (".$wizard["areas"].")"; - echo "</span></td>\n"; - - $n++; - if ($n >= $maxRow) { - echo " </tr>\n"; - $n = 0; - } - } - if ($n > 0) { - while ($n++ < $maxRow) - echo " <td></td>\n"; + echo "</span></td>\n"; + $n++; + if ($n >= $maxRow) + { echo " </tr>\n"; - } - echo "</table>\n"; + $n = 0; + } } + + if ($n > 0) + { + while ($n++ < $maxRow) + echo " <td></td>\n"; + echo " </tr>\n"; + } + echo "</table>\n"; } echo "<p><b>".$totalWiz."</b> wizards.</p>\n"; - /* Print out the alpha link index - */ - printExtraBoxAlphaList($alphaTable); -} else { + // Print out the alpha link index + stPrintExtraBoxAlphaList($alphaTable); +} +else +{ echo "<p><b>No wizards known!</b></p>\n"; } -?> -</div> -</body> -</html> + +cmPrintPageFooter(); +?> \ No newline at end of file