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