Mercurial > hg > batmud > maputils
annotate www/loc.php @ 870:51054f3f5d2e
Allow inversion of regexp group operator via "^" in the location type filter parameter.
This is not documented elsewhere, but allows URIs like http://tnsp.org/maps/loc.php?f=^SGCc
to filter out Shrines, Guilds, playerCities and cities. etc.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 03 Nov 2009 16:57:59 +0000 |
parents | 73107ae46d67 |
children | 2e88bf27e360 |
rev | line source |
---|---|
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 <? |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 require "config.inc.php"; |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
3 require "common.inc.php"; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 |
816
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
5 |
801 | 6 function makeURL($afilter, $filter, $coders, $desc, $qname, $qclass) |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 { |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 $s = ""; |
622 | 9 if ($afilter) $s = "f=".$filter; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
11 if (!$coders) { |
801 | 12 if ($s !== "") $s .= "&"; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 $s .= "s"; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
15 |
801 | 16 if ($qname !== "") { |
17 if ($s !== "") $s .= "&"; | |
18 $s .= "n=".$qname; | |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
19 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
20 |
623 | 21 echo " <td><a "; |
801 | 22 if ($qclass !== "") |
23 echo "class=\"".$qclass."\" "; | |
24 echo "href=\"".$_SERVER["PHP_SELF"]; | |
321 | 25 if (strlen($s) > 0) echo "?".$s; |
26 echo "\">".$desc."</a></td>\n"; | |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
27 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
28 |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
29 |
441 | 30 /* Initialization |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
31 */ |
519 | 32 printPageHeader($pageTitle." - Locations", |
33 "<script type=\"text/javascript\" src=\"tooltip.js\"></script>"); | |
623 | 34 //echo "<div><b>DEVELOPMENT VERSION</b></div>"; |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
35 |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
36 |
678 | 37 if (isset($_GET["c"])) { |
621 | 38 $filter = "C"; |
39 $applyFilter = TRUE; | |
40 } else { | |
622 | 41 if (isset($_GET["f"]) && $_GET["f"] != "") { |
621 | 42 $filter = $_GET["f"]; |
870
51054f3f5d2e
Allow inversion of regexp group operator via "^" in the location type filter parameter.
Matti Hamalainen <ccr@tnsp.org>
parents:
822
diff
changeset
|
43 if (!preg_match("/^[\^A-Za-z]+\$/", $filter)) { |
813 | 44 echo "<h1>Invalid filter rule '".htmlentities($filter)."'</h1>\n"; |
45 $filter = "C"; | |
46 $applyFilter = FALSE; | |
47 } else { | |
48 $applyFilter = TRUE; | |
49 } | |
621 | 50 } else { |
801 | 51 $filter = "CF"; |
621 | 52 $applyFilter = FALSE; |
53 } | |
54 } | |
55 | |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
56 $showCoders = !isset($_GET["s"]); |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
57 |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
58 if (isset($_GET["a"])) { |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
59 $coderName = basename($_GET["a"]); |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
60 $coderName = strtoupper(substr($coderName, 0, 1)).strtolower(substr($coderName, 1)); |
609 | 61 $wizTable = readWizInfoFiles(); |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
62 } |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
63 |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
64 if (isset($_GET["n"])) { |
609 | 65 $locTable = array(); |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
66 $setName = strtolower(basename($_GET["n"])); |
509 | 67 if (file_exists($setName.".loc")) { |
621 | 68 parseLocFile($setName, $locTable, $applyFilter, $filter); |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
69 } else { |
813 | 70 echo "<h1>No such continent ID!</h1>\n"; |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
71 unset($setName); |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
72 } |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
73 } else { |
621 | 74 $locTable = readLocationFiles($applyFilter, $filter); |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
75 } |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
76 |
441 | 77 |
78 /* Start of the page | |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
79 */ |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
80 echo "<h1>"; |
621 | 81 if ($applyFilter) { |
82 if (array_key_exists($filter, $locationTypes)) { | |
83 echo $locationTypes[$filter][2]; | |
84 } else { | |
870
51054f3f5d2e
Allow inversion of regexp group operator via "^" in the location type filter parameter.
Matti Hamalainen <ccr@tnsp.org>
parents:
822
diff
changeset
|
85 echo "Filter '$filter'"; |
621 | 86 } |
87 } else | |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
88 echo "Locations"; |
621 | 89 |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
90 echo " of "; |
621 | 91 |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
92 if (isset($continentList[$setName])) |
735
b066148013cd
Added OpenSearch support, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
679
diff
changeset
|
93 echo $continentList[$setName][0]." continent in "; |
509 | 94 else |
95 if (isset($specialList[$setName])) | |
601
95fc7a0a88dc
Show special list locations too.
Matti Hamalainen <ccr@tnsp.org>
parents:
545
diff
changeset
|
96 echo $specialList[$setName][0]." in "; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
97 echo "BatMUD"; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
98 if (isset($coderName)) |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
99 echo " by ".$coderName; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
100 echo "</h1>\n"; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
101 |
622 | 102 ?> |
103 <div class="selbar"> | |
801 | 104 <form action="<? echo $_SERVER["PHP_SELF"]; ?>" method="get"> |
622 | 105 <? |
106 if (isset($setName)) | |
107 echo "<input type=\"hidden\" name=\"n\" value=\"".htmlentities($setName)."\" />\n"; | |
108 ?> | |
109 <table> | |
110 <tr> | |
111 <td> | |
112 <select name="f"> | |
113 <? | |
816
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
114 foreach ($locationTypes as $id => $type) { |
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
115 echo " <option value=\"".$id."\""; |
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
116 if ($applyFilter && $filter == $id) |
622 | 117 echo " selected=\"selected\""; |
816
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
118 echo ">".$type[3]."</option>\n"; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
119 } |
622 | 120 ?> |
121 </select> | |
122 </td> | |
123 <td> | |
124 <input type="submit" value=" Update " class="isubmit" /> | |
125 </td> | |
816
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
126 <td></td> |
622 | 127 <? |
801 | 128 makeURL($applyFilter, $filter, $showCoders, "All continents", "", ""); |
816
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
129 foreach ($continentList as $continent => $data) { |
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
130 makeURL($applyFilter, $filter, $showCoders, $data[0], $continent, $continent); |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
131 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
132 ?> |
441 | 133 <td><a href="<? echo $pageIndex ?>">Back to main page</a></td> |
321 | 134 </tr> |
135 </table> | |
622 | 136 </form> |
321 | 137 </div> |
138 | |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
139 <? |
441 | 140 /* Coder/creator information box |
141 */ | |
393 | 142 if (isset($coderName) && isset($wizTable[$coderName]) && count($wizTable[$coderName]) > 1) { |
321 | 143 echo "<div class=\"wizinfo\">\n <table>\n <tr>\n"; |
144 | |
501 | 145 $s = $wizTable[$coderName]["imageURL"]; |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
146 if (isset($s)) { |
321 | 147 if (substr($s, 0, 6) == "bat://") |
501 | 148 $s = "img/unknown.png"; |
149 // $s = "http://www.bat.org/albums/".substr($s, 6); | |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
150 } else |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
151 $s = "img/unknown.png"; |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
152 |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
153 echo " <td class=\"img\"><img src=\"".$s."\" alt=\"".$coderName."\" /></td>\n"; |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
154 |
321 | 155 |
156 echo " <td class=\"info\">\n"; | |
501 | 157 echo " <h2>".$coderName."</h2>\n"; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
158 |
321 | 159 $s = $wizTable[$coderName]["desc"]; |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
160 if (isset($s) > 0) { |
321 | 161 echo " <p>".$s."</p>\n"; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
162 } |
321 | 163 |
501 | 164 echo " [<a href=\"".fingerURL($coderName)."\">Finger</a>]\n"; |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
165 |
321 | 166 $s = $wizTable[$coderName]["homeURL"]; |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
167 if (isset($s)) { |
321 | 168 if ($s == "bat") |
169 $s = "http://wiz.bat.org/~".strtolower($coderName)."/"; | |
170 | |
171 echo " [<a href=\"".$s."\">Homepage</a>]<br />\n"; | |
172 } | |
173 | |
174 echo " </td>\n </tr>\n </table>\n</div>\n"; | |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
175 } |
488 | 176 |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
177 |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
178 /* Print list of locations |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
179 */ |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
180 if (count($locTable) > 0) { |
816
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
181 /* Make alphabetically sorted table of locations |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
182 */ |
813 | 183 $alphaTable = array(); |
816
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
184 foreach ($locTable as $id => $data) |
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
185 if (isset($data["name"])) { |
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
186 $idx = $data["name"][0]; |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
187 if (isset($_GET["nocoders"])) { |
816
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
188 if (count($data["coders"]) == 0 && !preg_match("/[SPG]/", $data["flags"])) |
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
189 $alphaTable[$idx][] = $data; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
190 } else { |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
191 if (isset($coderName)) { |
816
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
192 if (array_search($coderName, $data["coders"]) !== FALSE) |
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
193 $alphaTable[$idx][] = $data; |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
194 } else |
816
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
195 $alphaTable[$idx][] = $data; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
196 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
197 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
198 |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
199 ksort($alphaTable, SORT_STRING); |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
200 |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
201 /* Print locations per first character |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
202 */ |
519 | 203 $locationTips = array(); |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
204 $totalLoc = 0; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
205 $maxRow = 6; |
817
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
206 foreach ($alphaTable as $key => $value) { |
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
207 if (count($value) <= 0) continue; |
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
208 |
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
209 asort($value); |
519 | 210 |
817
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
211 echo "<h3><a name=\"".strtolower($key)."\"></a>".$key."</h3>\n". |
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
212 "<table class=\"loc\" width=\"95%\">\n"; |
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
213 |
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
214 $n = 0; |
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
215 foreach ($value as $ik => $iv) { |
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
216 if ($n == 0) |
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
217 echo " <tr>\n"; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
218 |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
219 $totalLoc++; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
220 |
817
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
221 // Print location entry |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
222 printf(" <td width=\"%d%%\" class=\"%s\">", |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
223 (100 / $maxRow), $iv["continent"]); |
311 | 224 |
601
95fc7a0a88dc
Show special list locations too.
Matti Hamalainen <ccr@tnsp.org>
parents:
545
diff
changeset
|
225 if (isset($specialList[$iv["continent"]]) && !$specialList[$iv["continent"]][1]) { |
509 | 226 echo "<b>".htmlentities($iv["name"])."</b>"; |
227 } else { | |
228 printURL($iv["continent"].".html#loc".$iv["x"]."_".$iv["y"]); | |
229 echo htmlentities($iv["name"])."</a>"; | |
230 } | |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
231 |
602
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
232 if (isset($iv["url"]) || isset($iv["freeform"])) { |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
233 if (isset($iv["freeform"])) |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
234 $desc = htmlentities($iv["freeform"]); |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
235 else |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
236 $desc = ""; |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
237 |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
238 if (isset($iv["url"])) { |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
239 $urlEnt = $iv["url"]; |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
240 $urlBegin = "<a href=\"".htmlentities($urlEnt)."\" target=\"_blank\">"; |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
241 $urlEnd = "</a>"; |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
242 if (strlen($iv["url"]) > 40) |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
243 $urlEnt = substr($urlEnt, 0, 40)."..."; |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
244 $desc .= "<br /><br /><b>".htmlentities($urlEnt)."</b>"; |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
245 } else { |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
246 $urlBegin = $urlEnd = ""; |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
247 } |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
248 |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
249 echo " ".$urlBegin."<img class=\"noborder\" src=\"question.png\" onmouseover=\"stt(".$totalLoc. |
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
250 ");\" onmouseout=\"htt();\" alt=\"(?)\" />".$urlEnd."\n"; |
519 | 251 |
252 $locationTips[$totalLoc] = array( | |
253 "title" => $iv["name"], | |
602
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
254 "desc" => $desc |
519 | 255 ); |
256 } | |
257 | |
817
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
258 // Alternative names |
818 | 259 if (count($iv["names"]) > 0) { |
822
73107ae46d67
Pass alternative location names through htmlentities().
Matti Hamalainen <ccr@tnsp.org>
parents:
818
diff
changeset
|
260 echo "<br />".htmlentities(implode(" | ", $iv["names"])); |
817
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
261 } |
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
262 |
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
263 // Coder / society names |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
264 if (count($iv["coders"]) > 0 && $showCoders) { |
393 | 265 $isSG = preg_match("/[SG]/", $iv["flags"]); |
266 if ((!isset($coderName) && !$isSG) || isset($coderName)) { | |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
267 $fs = ""; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
268 while (list($fKey, $fVal) = each($iv["coders"])) { |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
269 if ($fs != "") $fs .= ", "; |
679 | 270 if ($filter != "C" || !$applyFilter) |
801 | 271 $fs .= "<a href=\"".$_SERVER["PHP_SELF"]."?a=".$fVal."\">".$fVal."</a>"; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
272 else |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
273 $fs .= $fVal; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
274 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
275 echo "<br />[".$fs."]"; |
393 | 276 } |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
277 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
278 |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
279 echo "</td>\n"; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
280 |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
281 $n++; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
282 if ($n >= $maxRow) { |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
283 echo " </tr>\n"; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
284 $n = 0; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
285 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
286 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
287 if ($n > 0) { |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
288 while ($n++ < $maxRow) |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
289 echo " <td></td>\n"; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
290 |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
291 echo " </tr>\n"; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
292 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
293 echo "</table>\n"; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
294 } |
519 | 295 |
296 echo "<p><b>".$totalLoc."</b> locations.</p>\n"; | |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
297 |
816
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
298 /* Print out location tooltip HTML code |
519 | 299 */ |
816
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
300 foreach ($locationTips as $tipID => $tip) { |
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
301 echo "<div class=\"tooltip\" id=\"tt".$tipID. |
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
302 "\"><div class=\"holder\"><b>".htmlentities($tip["title"]). |
6341de08bd52
Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents:
813
diff
changeset
|
303 "</b><br />".$tip["desc"]."</div></div>\n"; |
519 | 304 } |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
305 } else { |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
306 echo "<p><b>No locations known!</b></p>\n"; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
307 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
308 |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
309 // Google Analytics |
532 | 310 require "urchin.inc.php"; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
311 ?> |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
312 </body> |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
313 </html> |