Mercurial > hg > batmud > maputils
annotate www/loc.php @ 1891:68b784c7eae2
Get rid of mgeneric.inc.php here.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 06 Nov 2017 03:09:11 +0200 |
parents | dd123d0a75d9 |
children | ed98d2fe4bca |
rev | line source |
---|---|
1646
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1638
diff
changeset
|
1 <?php |
300
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"; |
1272 | 3 require "world.inc.php"; |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
4 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
|
5 |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
6 |
1112 | 7 // Wizard info box special formatting tags |
1609 | 8 $specTags = [ |
1112 | 9 "b" => "<b>", |
10 "\/b" => "</b>", | |
11 "i" => "<i>", | |
12 "\/i" => "</i>", | |
13 "p" => "<br /><br />", | |
14 "br" => "<br />", | |
1609 | 15 ]; |
1112 | 16 |
17 | |
976 | 18 function printTitleLink($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
|
19 { |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
20 $s = ""; |
1567 | 21 if ($afilter) |
22 $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
|
23 |
1567 | 24 if (!$coders) |
25 { | |
801 | 26 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
|
27 $s .= "s"; |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
28 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
29 |
1567 | 30 if ($qname !== "") |
31 { | |
801 | 32 if ($s !== "") $s .= "&"; |
33 $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
|
34 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
35 |
1567 | 36 echo |
37 " <a class=\"control continent ".$qclass. | |
38 "\" href=\"".$_SERVER["PHP_SELF"]. | |
39 (strlen($s) > 0 ? "?".$s : ""). | |
40 "\">".$desc."</a>\n"; | |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
41 } |
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
43 |
1392 | 44 function qcheck($arr, $key, &$result) |
45 { | |
46 if (isset($key) && isset($arr[$key])) | |
47 { | |
48 $result = $arr[$key]; | |
49 return TRUE; | |
50 } | |
51 else | |
52 { | |
53 unset($result); | |
54 return FALSE; | |
55 } | |
56 } | |
57 | |
58 | |
59 | |
60 // | |
61 // Initialization | |
62 // | |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
63 if (isset($_GET["c"])) |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
64 { |
621 | 65 $filter = "C"; |
66 $applyFilter = TRUE; | |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
67 } |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
68 else |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
69 if (($filter = stGetRequestItem("f", "", TRUE)) != "") |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
70 { |
1428
1aad929253ce
Allow to filter by '!' flag.
Matti Hamalainen <ccr@tnsp.org>
parents:
1401
diff
changeset
|
71 if (!preg_match("/^[\^A-Za-z!]+\$/", $filter)) |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
72 { |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
73 stError("Invalid filter rule '".chentities($filter)."'"); |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
74 $filter = "C"; |
621 | 75 $applyFilter = FALSE; |
76 } | |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
77 else |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
78 $applyFilter = TRUE; |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
79 } |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
80 else |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
81 { |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
82 $filter = "CF"; |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
83 $applyFilter = FALSE; |
621 | 84 } |
85 | |
1638 | 86 |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
87 $showCoders = !isset($_GET["s"]); |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
88 |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
89 if (($tmpName = stGetRequestItem("a", FALSE, TRUE)) !== false) |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
90 { |
1620
6d620441af7f
Rename various functions, and other cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1609
diff
changeset
|
91 if (preg_match("#^([a-z]{1,15})#i", $tmpName, $matches)) |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
92 { |
1620
6d620441af7f
Rename various functions, and other cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1609
diff
changeset
|
93 $coderName = $matches[1]; |
1084 | 94 $coderName = strtoupper(substr($coderName, 0, 1)).strtolower(substr($coderName, 1)); |
1150
02fe48a608d7
Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents:
1148
diff
changeset
|
95 |
02fe48a608d7
Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents:
1148
diff
changeset
|
96 $wizTable = apc_fetch("wizTable"); |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
97 if (empty($wizTable)) |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
98 { |
1620
6d620441af7f
Rename various functions, and other cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1609
diff
changeset
|
99 $wizTable = mpReadWizInfoFiles(); |
1150
02fe48a608d7
Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents:
1148
diff
changeset
|
100 apc_store("wizTable", $wizTable, 3600); |
02fe48a608d7
Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents:
1148
diff
changeset
|
101 } |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
102 } |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
103 else |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
104 { |
1084 | 105 $coderName = "???"; |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
106 stError("Invalid wizard name."); |
1150
02fe48a608d7
Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents:
1148
diff
changeset
|
107 } |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
108 } |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
109 |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
110 if (isset($_GET["n"])) |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
111 { |
1609 | 112 $locTable = []; |
1392 | 113 $setName = strtolower(trim(basename($_GET["n"]))); |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
114 if (file_exists($setName.".loc")) |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
115 { |
1150
02fe48a608d7
Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents:
1148
diff
changeset
|
116 $locTable = apc_fetch("loc_".$setName); |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
117 if (empty($locTable)) |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
118 { |
1609 | 119 $locTable = []; |
1620
6d620441af7f
Rename various functions, and other cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1609
diff
changeset
|
120 mpParseLocFile($setName, $locTable, $applyFilter, $filter); |
1150
02fe48a608d7
Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents:
1148
diff
changeset
|
121 apc_store("loc_".$setName, $locTable, 3600); |
02fe48a608d7
Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents:
1148
diff
changeset
|
122 } |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
123 } |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
124 else |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
125 { |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
126 stError("No such continent ID!"); |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
127 unset($setName); |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
128 } |
1392 | 129 } |
130 else | |
131 { | |
1150
02fe48a608d7
Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents:
1148
diff
changeset
|
132 $locTable = apc_fetch("loc_locTable"); |
1392 | 133 if (empty($locTable)) |
134 { | |
1620
6d620441af7f
Rename various functions, and other cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1609
diff
changeset
|
135 $locTable = mpReadLocationFiles($applyFilter, $filter); |
1150
02fe48a608d7
Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents:
1148
diff
changeset
|
136 apc_store("loc_locTable", $locTable, 3600); |
02fe48a608d7
Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents:
1148
diff
changeset
|
137 } |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
138 } |
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
139 |
1392 | 140 |
1638 | 141 // Make alphabetically sorted table of locations |
142 $alphaTable = []; | |
143 foreach ($locTable as $id => $data) | |
144 if (isset($data["name"])) | |
145 { | |
146 $idx = $data["name"][0]; | |
147 if (isset($_GET["nocoders"])) | |
148 { | |
149 if (count($data["coders"]) == 0 && !preg_match("/[SPG]/", $data["flags"])) | |
150 $alphaTable[$idx][] = $data; | |
151 } | |
152 else | |
153 if (isset($coderName)) | |
154 { | |
155 foreach ($data["coders"] as $coder) | |
156 { | |
157 if ($coderName == $coder["name"]) | |
158 $alphaTable[$idx][] = $data; | |
159 } | |
160 } | |
161 else | |
162 $alphaTable[$idx][] = $data; | |
163 } | |
164 | |
165 ksort($alphaTable, SORT_STRING); | |
166 | |
167 | |
168 // | |
169 // Start of the page | |
170 // | |
171 if ($applyFilter) | |
172 { | |
173 if (array_key_exists($filter, $locationTypes)) | |
174 | |
175 $mtitle = $locationTypes[$filter][2]; | |
176 else | |
177 $mtitle = "Filter '".$filter."'"; | |
178 } | |
179 else | |
180 $mtitle = "Locations"; | |
181 | |
182 $mtitle .= " of "; | |
183 | |
184 if (isset($setName) && isset($continentList[$setName])) | |
185 { | |
186 $mtitle .= $continentList[$setName][0]. | |
187 ($continentList[$setName][3] ? " in " : " continent in "); | |
188 } | |
189 | |
1620
6d620441af7f
Rename various functions, and other cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1609
diff
changeset
|
190 mpPrintPageHeader($pageTitle." - Locations", |
1694 | 191 " <script type=\"text/javascript\" src=\"tooltip.js\"></script>\n". |
192 " <meta name=\"robots\" content=\"nofollow\" />\n"); | |
1140
3bb8253db932
New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
1115
diff
changeset
|
193 |
3bb8253db932
New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
1115
diff
changeset
|
194 echo |
1638 | 195 "<h1>".$mtitle."BatMUD".(isset($coderName) ? " by ".chentities($coderName) : "")."</h1>\n". |
1567 | 196 "<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"get\">\n". |
197 "<div class=\"controls\">\n"; | |
1140
3bb8253db932
New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
1115
diff
changeset
|
198 |
622 | 199 if (isset($setName)) |
1694 | 200 echo " <input type=\"hidden\" name=\"n\" value=\"".chentities($setName)."\" />\n"; |
1392 | 201 |
1694 | 202 echo " <select class=\"control dropdown\" name=\"f\" onChange=\"this.form.submit();\">\n"; |
1392 | 203 foreach ($locationTypes as $id => $type) |
204 { | |
205 echo | |
1694 | 206 " <option value=\"".$id."\"". |
1392 | 207 (($applyFilter && $filter == $id) ? " selected=\"selected\"" : ""). |
208 ">".$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
|
209 } |
1392 | 210 echo |
1694 | 211 " </select>\n". |
212 " <noscript><input type=\"submit\" value=\" Update \" class=\"control submit\" /></noscript>\n"; | |
1392 | 213 |
214 | |
1331
2f142b33e4ed
Make location filter selector bar freeform div instead of table.
Matti Hamalainen <ccr@tnsp.org>
parents:
1329
diff
changeset
|
215 printTitleLink($applyFilter, $filter, $showCoders, "All continents", "", "all"); |
1392 | 216 foreach ($continentList as $continent => $data) |
217 { | |
1060
b78333d62d5b
Combine speciaList into continentList and clean up the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1059
diff
changeset
|
218 if ($data[4]) |
b78333d62d5b
Combine speciaList into continentList and clean up the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1059
diff
changeset
|
219 printTitleLink($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
|
220 } |
1115 | 221 printTitleLink($applyFilter, $filter, $showCoders, "Special", "special", "special"); |
1392 | 222 |
223 echo | |
1567 | 224 "</div>\n". |
225 "</form>\n"; | |
321 | 226 |
1329 | 227 |
1392 | 228 // |
229 // Wizard/coder/creator information box | |
230 // | |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
231 if (isset($coderName)) |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
232 { |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
233 if (isset($wizTable[$coderName]) && count($wizTable[$coderName]) > 1) |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
234 { |
1329 | 235 // Profile picture |
1494
9f9e1e1846f5
Fix obsoleted use of reference arguments.
Matti Hamalainen <ccr@tnsp.org>
parents:
1428
diff
changeset
|
236 if (qcheck($wizTable[$coderName], "imageURL", $s)) |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
237 { |
1329 | 238 // XXX: backwards compatibility check |
239 if (substr($s, 0, 6) == "bat://") | |
1401 | 240 $s = $wizImageURL."unknown.png"; |
241 else | |
242 if (substr($s, 0, 7) != "http://") | |
243 $s = $wizImageURL.$s; | |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
244 } |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
245 else |
1401 | 246 $s = $wizImageURL."unknown.png"; |
1112 | 247 |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
248 echo |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
249 "<div class=\"wizInfoBox\">\n". |
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
250 " <div class=\"wizImage\"><img src=\"".$s."\" alt=\"".$coderName."\" /></div>\n". |
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
251 " <div class=\"wizInfo\">\n". |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
252 " <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
|
253 |
1329 | 254 // Description block |
1494
9f9e1e1846f5
Fix obsoleted use of reference arguments.
Matti Hamalainen <ccr@tnsp.org>
parents:
1428
diff
changeset
|
255 if (qcheck($wizTable[$coderName], "desc", $str)) |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
256 { |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
257 // Handle special tags |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
258 $str = preg_replace("/\~([A-Z][a-z]+)\~/i", "<a href=\"".$_SERVER["PHP_SELF"]."?a=\${1}\">\${1}</a>", $str); |
1112 | 259 |
1329 | 260 foreach ($specTags as $tag => $rep) |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
261 $str = preg_replace("/\[".$tag."\]/i", $rep, $str); |
1112 | 262 |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
263 echo " <p>".$str."</p>\n"; |
1329 | 264 } |
321 | 265 |
1329 | 266 // Links, etc. |
1620
6d620441af7f
Rename various functions, and other cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1609
diff
changeset
|
267 echo " [<a href=\"".mpFingerURL($coderName)."\">Finger</a>]\n"; |
337
ca191c3a0ce1
Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
321
diff
changeset
|
268 |
1494
9f9e1e1846f5
Fix obsoleted use of reference arguments.
Matti Hamalainen <ccr@tnsp.org>
parents:
1428
diff
changeset
|
269 if (qcheck($wizTable[$coderName], "homeURL", $s)) |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
270 { |
1329 | 271 if ($s == "bat") |
272 $s = "http://wiz.bat.org/~".strtolower($coderName)."/"; | |
273 | |
274 echo " [<a href=\"".$s."\">Homepage</a>]<br />\n"; | |
275 } | |
1638 | 276 |
277 echo | |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
278 " </div>\n". |
1638 | 279 "</div>\n"; |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
280 } |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
281 else |
1606 | 282 stError("No information entry for this wizard."); |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
283 } |
488 | 284 |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
285 |
1392 | 286 // |
287 // Print out errors | |
288 // | |
289 if ($errorSet) | |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
290 { |
1392 | 291 echo |
292 "<div style=\"color: red;\">\n". | |
293 " <ul>\n"; | |
294 | |
295 foreach ($errorMsgs as $msg) | |
296 echo " <li>".$msg."</li>\n"; | |
297 | |
298 echo | |
299 " </ul>\n". | |
300 "</div>\n"; | |
301 } | |
302 | |
303 | |
304 // | |
305 // Print list of locations | |
306 // | |
1638 | 307 if (count($alphaTable) > 0) |
1392 | 308 { |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
309 |
1609 | 310 $locationTips = []; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
311 $totalLoc = 0; |
1656 | 312 $maxColumns = 6; |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
313 foreach ($alphaTable as $alpha => $alphaLocs) |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
314 { |
908 | 315 if (count($alphaLocs) <= 0) continue; |
1148
52550f58cee5
Move alphabetic table printing code to a function in common routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
1140
diff
changeset
|
316 $letter = strtoupper($alpha); |
817
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
317 |
908 | 318 asort($alphaLocs); |
1148
52550f58cee5
Move alphabetic table printing code to a function in common routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
1140
diff
changeset
|
319 |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
320 echo |
1630 | 321 "<h3 class=\"alpha\"><a id=\"ch".$letter."\"></a>".$letter."</h3>\n". |
322 mpSpecialDate("loc", 2). | |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
323 "<div class=\"locTable\">\n"; |
817
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
324 |
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
325 $n = 0; |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
326 foreach ($alphaLocs as $ik => $iv) |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
327 { |
908 | 328 $totalLoc++; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
329 |
908 | 330 // Print location entry |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
331 echo |
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
332 " <div class=\"locCell ".$iv["continent"]."\">". |
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
333 "<div class=\"locHeader\">". |
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
334 "<span class=\"locTitle\">".mpGetMapLink($iv, $continentList[$iv["continent"]][4])."</span>"; |
908 | 335 |
336 // If either freeform desc or URL field are set, we add those | |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
337 if (isset($iv["url"]) || isset($iv["freeform"])) |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
338 { |
908 | 339 // Free form description |
926 | 340 $desc = isset($iv["freeform"]) ? chentities($iv["freeform"]) : ""; |
908 | 341 |
342 // Add URL information, chopped, if any | |
1392 | 343 if (isset($iv["url"])) |
344 { | |
908 | 345 $urlEnt = $iv["url"]; |
926 | 346 $urlBegin = "<a href=\"".chentities($urlEnt)."\" target=\"_blank\">"; |
908 | 347 $urlEnd = "</a>"; |
348 if (strlen($iv["url"]) > 40) | |
349 $urlEnt = substr($urlEnt, 0, 40)."..."; | |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
350 $desc .= "<div class=\"locURL\">".chentities($urlEnt)."</div>"; |
1392 | 351 } |
352 else | |
353 { | |
908 | 354 $urlBegin = $urlEnd = ""; |
509 | 355 } |
602
e46ee0632810
Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents:
601
diff
changeset
|
356 |
1392 | 357 echo |
1702 | 358 " ".$urlBegin. |
359 // "<img src=\"img/question.png\" onmouseover=\"stt(".$totalLoc. | |
360 // ");\" onmouseout=\"htt();\" alt=\"(?)\" />". | |
361 "<span onmouseover=\"stt(".$totalLoc. | |
362 ");\" onmouseout=\"htt();\">🍔</span>". | |
363 $urlEnd; | |
519 | 364 |
1609 | 365 $locationTips[$totalLoc] = [ |
908 | 366 "title" => $iv["name"], |
367 "desc" => $desc | |
1609 | 368 ]; |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
369 } |
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
370 |
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
371 echo "</div>"; // locHeader |
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
372 |
908 | 373 // Alternative names |
1392 | 374 if (($nnames = count($iv["names"])) > 1) |
375 { | |
1609 | 376 $fs = []; |
1392 | 377 for ($nname = 1; $nname < $nnames; $nname++) |
378 { | |
379 $norig = $iv["names"][$nname]["flags"] & NAME_ORIG; | |
380 $fs[] = | |
381 ($norig ? "<b>" : ""). | |
382 chentities($iv["names"][$nname]["name"]). | |
383 ($norig ? "</b>" : ""); | |
975
af0fc3a965dc
Fix all the web-interface PHP crap to work with the new LOC file format. Urgh. This shit could really use some refactoring cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents:
926
diff
changeset
|
384 } |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
385 echo "<div class=\"locAltNames\">".implode(" | ", $fs)."</div>"; |
908 | 386 } |
817
eaba088b5424
Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
816
diff
changeset
|
387 |
908 | 388 // Coder / society names |
1392 | 389 if (count($iv["coders"]) > 0 && $showCoders) |
390 { | |
908 | 391 $isSG = preg_match("/[SG]/", $iv["flags"]); |
1392 | 392 if ((!isset($coderName) && !$isSG) || isset($coderName)) |
393 { | |
1609 | 394 $fs = []; |
1392 | 395 foreach ($iv["coders"] as $name) |
396 { | |
1140
3bb8253db932
New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
1115
diff
changeset
|
397 // Tags/flags of this coder in relation to the area |
1392 | 398 switch ($name["flags"]) |
399 { | |
1140
3bb8253db932
New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
1115
diff
changeset
|
400 case NAME_ORIG: $qs = "title=\"Original creator\" class=\"wizorig\""; break; |
3bb8253db932
New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
1115
diff
changeset
|
401 case NAME_RECODER: $qs = "title=\"Converter, recoder\" class=\"wizrecoder\""; break; |
3bb8253db932
New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
1115
diff
changeset
|
402 case NAME_MAINTAINER: $qs = "title=\"Maintainer\" class=\"wizmaintainer\""; break; |
3bb8253db932
New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
1115
diff
changeset
|
403 case NAME_EXPANDER: $qs = "title=\"Implemented new content, expansion(s)\" class=\"wizexpander\""; break; |
975
af0fc3a965dc
Fix all the web-interface PHP crap to work with the new LOC file format. Urgh. This shit could really use some refactoring cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents:
926
diff
changeset
|
404 default: $qs = ""; |
af0fc3a965dc
Fix all the web-interface PHP crap to work with the new LOC file format. Urgh. This shit could really use some refactoring cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents:
926
diff
changeset
|
405 } |
679 | 406 if ($filter != "C" || !$applyFilter) |
1392 | 407 $fs[] = "<a ".$qs." href=\"".$_SERVER["PHP_SELF"]."?a=".$name["name"]."\">".$name["name"]."</a>"; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
408 else |
1392 | 409 $fs[] = $name["name"]; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
410 } |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
411 echo "<div class=\"locCoders\">".implode(", ", $fs)."</div>"; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
412 } |
908 | 413 } |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
414 |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
415 echo "</div>\n"; |
908 | 416 } |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1656
diff
changeset
|
417 echo "</div>\n"; |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
418 } |
519 | 419 |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
420 echo |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
421 "<p><b>".$totalLoc."</b> locations.</p>\n". |
1391 | 422 "</div>\n"; // end of contents div |
1140
3bb8253db932
New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
1115
diff
changeset
|
423 |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
424 // Print out location tooltip HTML code |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
425 foreach ($locationTips as $tipID => $tip) |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
426 { |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
427 echo |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
428 "<div class=\"tooltip\" id=\"tt".$tipID. |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
429 "\"><div class=\"holder\"><b>".chentities($tip["title"]). |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
430 "</b><br />".$tip["desc"]."</div></div>\n"; |
519 | 431 } |
1140
3bb8253db932
New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
1115
diff
changeset
|
432 |
1391 | 433 // Print out the alpha link index div |
1620
6d620441af7f
Rename various functions, and other cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1609
diff
changeset
|
434 mpPrintExtraBoxAlphaList("ch", $alphaTable); |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
435 } |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
436 else |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
437 { |
1391 | 438 echo |
439 "<p><b>No locations known!</b></p>\n". | |
440 "</div>\n"; // end of contents div | |
441 | |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
442 stError("No locations known!"); |
300
edac314ac9bb
Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
443 } |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1331
diff
changeset
|
444 |
1891
68b784c7eae2
Get rid of mgeneric.inc.php here.
Matti Hamalainen <ccr@tnsp.org>
parents:
1702
diff
changeset
|
445 mpPrintPageFooter(FALSE); |
1151
e0794ddb605e
Add output caching to main page and location page.
Matti Hamalainen <ccr@tnsp.org>
parents:
1150
diff
changeset
|
446 ?> |