Mercurial > hg > batmud > maputils
changeset 2819:7f90630781a7
Cleanup.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 14 Apr 2024 20:19:46 +0300 |
parents | 783495d9fa7f |
children | fd98db48ccab |
files | www/latest.php www/ss.php |
diffstat | 2 files changed, 73 insertions(+), 85 deletions(-) [+] |
line wrap: on
line diff
--- a/www/latest.php Fri Apr 12 21:56:09 2024 +0300 +++ b/www/latest.php Sun Apr 14 20:19:46 2024 +0300 @@ -20,7 +20,7 @@ the changes made to the data. </div> <hr /> -<? +<?php $locGetNameLink = function($sdata) { return "<a href=\"loc.php?a=". @@ -56,63 +56,56 @@ echo "<hr />\n"; -if (count($locTable) > 0) +// Sort locations by timestamp .. +foreach ($locTable as $location) { - // Sort locations by timestamp .. - foreach ($locTable as $location) + // If "nodate" is set, show locations with NO known addition timestamp + if (isset($_REQUEST["nodate"])) + { + if ($location["added"] < 0) + $sortedLocs[] = $location; + } + else { - // If "nodate" is set, show locations with NO known addition timestamp - if (isset($_REQUEST["nodate"])) - { - if ($location["added"] < 0) - $sortedLocs[] = $location; - } - else - { - if ($location["added"] > 0) - $sortedLocs[] = $location; - } + if ($location["added"] > 0) + $sortedLocs[] = $location; } +} - usort($sortedLocs, "locCompare"); +usort($sortedLocs, "locCompare"); - // Print the list - $totalLoc = 0; +// Print the list +$totalLoc = 0; +echo + "<table class=\"locTable\">\n". + " <tr>\n". + " <th class=\"locdate\">Date</th>\n". + " <th class=\"locname\">Location name</th>\n". + " <th class=\"loccont\">Continent</th>\n". + ($showAll ? " <th>Type</th>\n" : ""). + " <th class=\"locauthor\">Author(s)</th>\n". + " <th class=\"locinfo\">Information</th>\n". + " </tr>\n"; + +foreach ($sortedLocs as $ik => $iv) +{ + $totalLoc++; + echo - "<table class=\"locTable\">\n". " <tr>\n". - " <th class=\"locdate\">Date</th>\n". - " <th class=\"locname\">Location name</th>\n". - " <th class=\"loccont\">Continent</th>\n". - ($showAll ? " <th>Type</th>\n" : ""). - " <th class=\"locauthor\">Author(s)</th>\n". - " <th class=\"locinfo\">Information</th>\n". + " <td>".(($iv["added"] <= 0) ? "?" : mpLocFormatTime($iv))."</td>\n". + " <td class=\"".$iv["continent"]."\">".mpGetMapLink($iv, TRUE, TRUE, FALSE)."</td>\n". + " <td>".$continentList[$iv["continent"]][CTI_NAME]."</td>\n". + ($showAll ? " <td>".mpGetLocationTypeStr($iv["flags"])."</td>\n" : ""). + " <td>".implode(", ", array_map( + (($iv["flags"] & LOCF_M_MASK) == LOCF_M_PCITY) ? $locGetNameStr : $locGetNameLink, + $iv["authors"]))."</td>\n". + " <td>".(isset($iv["freeform"]) ? chentities($iv["freeform"]) : "")."</td>\n". " </tr>\n"; - - foreach ($sortedLocs as $ik => $iv) - { - $totalLoc++; - - echo - " <tr>\n". - " <td>".(($iv["added"] <= 0) ? "?" : mpLocFormatTime($iv))."</td>\n". - " <td class=\"".$iv["continent"]."\">".mpGetMapLink($iv, TRUE, TRUE, FALSE)."</td>\n". - " <td>".$continentList[$iv["continent"]][CTI_NAME]."</td>\n". - ($showAll ? " <td>".mpGetLocationTypeStr($iv["flags"])."</td>\n" : ""). - " <td>".implode(", ", array_map( - (($iv["flags"] & LOCF_M_MASK) == LOCF_M_PCITY) ? $locGetNameStr : $locGetNameLink, - $iv["authors"]))."</td>\n". - " <td>".(isset($iv["freeform"]) ? chentities($iv["freeform"]) : "")."</td>\n". - " </tr>\n"; - } - echo - "</table>\n". - "<p><b>".$totalLoc."</b> locations.</p>\n"; } -else -{ - echo "<p><b>No locations known!</b></p>\n"; -} +echo + "</table>\n". + "<p><b>".$totalLoc."</b> locations.</p>\n"; mpPrintPageFooter(); ?> \ No newline at end of file
--- a/www/ss.php Fri Apr 12 21:56:09 2024 +0300 +++ b/www/ss.php Sun Apr 14 20:19:46 2024 +0300 @@ -17,50 +17,45 @@ // Page start mpPrintPageHeader($pageTitle." - Secret societies"); +?> +<h1>Secret societies of BatMUD</h1> +<div class="attnbox"> +</div> +<hr /> +<?php +// Print list of societies +// Make the list array +foreach ($locTable as $key => $value) +foreach ($value["authors"] as $name) + $sortTable[$name["name"]] = $value; + +foreach ($locPTable as $key => $value) + $sortTable[$value["name"]] = $value; + +ksort($sortTable); echo - "<h1>Secret societies of BatMUD</h1>\n"; + "<table class=\"locTable societies\">\n". + " <tr>\n". + " <th>Society name</th>\n". + " <th>Player city/location</th>\n". + " <th>Continent</th>\n". + " </tr>\n"; -// Print list of societies -if (count($locTable) > 0) +foreach ($sortTable as $name => $data) { - // Make the list array - foreach ($locTable as $key => $value) - foreach ($value["authors"] as $name) - $sortTable[$name["name"]] = $value; - - foreach ($locPTable as $key => $value) - $sortTable[$value["name"]] = $value; - - ksort($sortTable); - + $cont = $data["continent"]; + $link = $continentList[$cont][CTI_HAS_MAP]; echo - "<table class=\"locTable societies\">\n". " <tr>\n". - " <th>Society name</th>\n". - " <th>Player city/location</th>\n". - " <th>Continent</th>\n". + " <td>".mpGetMapURLLink($data, $link, $name, TRUE)."</td>\n". + " <td class=\"".$cont."\">".mpGetMapLink($data, $link, TRUE, FALSE)."</td>\n". + " <td>".chentities($continentList[$cont][CTI_NAME])."</td>\n". " </tr>\n"; - - foreach ($sortTable as $name => $data) - { - $cont = $data["continent"]; - $link = $continentList[$cont][CTI_HAS_MAP]; - echo - " <tr>\n". - " <td>".mpGetMapURLLink($data, $link, $name, TRUE)."</td>\n". - " <td class=\"".$cont."\">".mpGetMapLink($data, $link, TRUE, FALSE)."</td>\n". - " <td>".chentities($continentList[$cont][CTI_NAME])."</td>\n". - " </tr>\n"; - } - echo - "</table>\n". - "<p><b>".count($sortTable)."</b> societies.</p>\n"; } -else -{ - echo "<p><b>No societies known!</b></p>\n"; -} +echo + "</table>\n". + "<p><b>".count($sortTable)."</b> societies.</p>\n"; mpPrintPageFooter(); ?> \ No newline at end of file