Mercurial > hg > batmud > maputils
comparison www/latest.php @ 2819:7f90630781a7
Cleanup.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 14 Apr 2024 20:19:46 +0300 |
parents | 164aa519640d |
children |
comparison
equal
deleted
inserted
replaced
2818:783495d9fa7f | 2819:7f90630781a7 |
---|---|
18 the information presented here</a>. You may also be interested in the | 18 the information presented here</a>. You may also be interested in the |
19 <a href="changelog.txt">PupuMaps project changelog</a>, which lists | 19 <a href="changelog.txt">PupuMaps project changelog</a>, which lists |
20 the changes made to the data. | 20 the changes made to the data. |
21 </div> | 21 </div> |
22 <hr /> | 22 <hr /> |
23 <? | 23 <?php |
24 $locGetNameLink = function($sdata) | 24 $locGetNameLink = function($sdata) |
25 { | 25 { |
26 return "<a href=\"loc.php?a=". | 26 return "<a href=\"loc.php?a=". |
27 chentities($sdata["name"])."\">". | 27 chentities($sdata["name"])."\">". |
28 chentities($sdata["name"])."</a>"; | 28 chentities($sdata["name"])."</a>"; |
54 else | 54 else |
55 echo "only notable locations [<a href=\"?all\">Show all latest added locations</a> (including player cities)]"; | 55 echo "only notable locations [<a href=\"?all\">Show all latest added locations</a> (including player cities)]"; |
56 echo "<hr />\n"; | 56 echo "<hr />\n"; |
57 | 57 |
58 | 58 |
59 if (count($locTable) > 0) | 59 // Sort locations by timestamp .. |
60 foreach ($locTable as $location) | |
60 { | 61 { |
61 // Sort locations by timestamp .. | 62 // If "nodate" is set, show locations with NO known addition timestamp |
62 foreach ($locTable as $location) | 63 if (isset($_REQUEST["nodate"])) |
63 { | 64 { |
64 // If "nodate" is set, show locations with NO known addition timestamp | 65 if ($location["added"] < 0) |
65 if (isset($_REQUEST["nodate"])) | 66 $sortedLocs[] = $location; |
66 { | |
67 if ($location["added"] < 0) | |
68 $sortedLocs[] = $location; | |
69 } | |
70 else | |
71 { | |
72 if ($location["added"] > 0) | |
73 $sortedLocs[] = $location; | |
74 } | |
75 } | 67 } |
68 else | |
69 { | |
70 if ($location["added"] > 0) | |
71 $sortedLocs[] = $location; | |
72 } | |
73 } | |
76 | 74 |
77 usort($sortedLocs, "locCompare"); | 75 usort($sortedLocs, "locCompare"); |
78 | 76 |
79 // Print the list | 77 // Print the list |
80 $totalLoc = 0; | 78 $totalLoc = 0; |
79 echo | |
80 "<table class=\"locTable\">\n". | |
81 " <tr>\n". | |
82 " <th class=\"locdate\">Date</th>\n". | |
83 " <th class=\"locname\">Location name</th>\n". | |
84 " <th class=\"loccont\">Continent</th>\n". | |
85 ($showAll ? " <th>Type</th>\n" : ""). | |
86 " <th class=\"locauthor\">Author(s)</th>\n". | |
87 " <th class=\"locinfo\">Information</th>\n". | |
88 " </tr>\n"; | |
89 | |
90 foreach ($sortedLocs as $ik => $iv) | |
91 { | |
92 $totalLoc++; | |
93 | |
81 echo | 94 echo |
82 "<table class=\"locTable\">\n". | |
83 " <tr>\n". | 95 " <tr>\n". |
84 " <th class=\"locdate\">Date</th>\n". | 96 " <td>".(($iv["added"] <= 0) ? "?" : mpLocFormatTime($iv))."</td>\n". |
85 " <th class=\"locname\">Location name</th>\n". | 97 " <td class=\"".$iv["continent"]."\">".mpGetMapLink($iv, TRUE, TRUE, FALSE)."</td>\n". |
86 " <th class=\"loccont\">Continent</th>\n". | 98 " <td>".$continentList[$iv["continent"]][CTI_NAME]."</td>\n". |
87 ($showAll ? " <th>Type</th>\n" : ""). | 99 ($showAll ? " <td>".mpGetLocationTypeStr($iv["flags"])."</td>\n" : ""). |
88 " <th class=\"locauthor\">Author(s)</th>\n". | 100 " <td>".implode(", ", array_map( |
89 " <th class=\"locinfo\">Information</th>\n". | 101 (($iv["flags"] & LOCF_M_MASK) == LOCF_M_PCITY) ? $locGetNameStr : $locGetNameLink, |
102 $iv["authors"]))."</td>\n". | |
103 " <td>".(isset($iv["freeform"]) ? chentities($iv["freeform"]) : "")."</td>\n". | |
90 " </tr>\n"; | 104 " </tr>\n"; |
91 | |
92 foreach ($sortedLocs as $ik => $iv) | |
93 { | |
94 $totalLoc++; | |
95 | |
96 echo | |
97 " <tr>\n". | |
98 " <td>".(($iv["added"] <= 0) ? "?" : mpLocFormatTime($iv))."</td>\n". | |
99 " <td class=\"".$iv["continent"]."\">".mpGetMapLink($iv, TRUE, TRUE, FALSE)."</td>\n". | |
100 " <td>".$continentList[$iv["continent"]][CTI_NAME]."</td>\n". | |
101 ($showAll ? " <td>".mpGetLocationTypeStr($iv["flags"])."</td>\n" : ""). | |
102 " <td>".implode(", ", array_map( | |
103 (($iv["flags"] & LOCF_M_MASK) == LOCF_M_PCITY) ? $locGetNameStr : $locGetNameLink, | |
104 $iv["authors"]))."</td>\n". | |
105 " <td>".(isset($iv["freeform"]) ? chentities($iv["freeform"]) : "")."</td>\n". | |
106 " </tr>\n"; | |
107 } | |
108 echo | |
109 "</table>\n". | |
110 "<p><b>".$totalLoc."</b> locations.</p>\n"; | |
111 } | 105 } |
112 else | 106 echo |
113 { | 107 "</table>\n". |
114 echo "<p><b>No locations known!</b></p>\n"; | 108 "<p><b>".$totalLoc."</b> locations.</p>\n"; |
115 } | |
116 | 109 |
117 mpPrintPageFooter(); | 110 mpPrintPageFooter(); |
118 ?> | 111 ?> |