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