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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
Matti Hamalainen <ccr@tnsp.org>
parents: 1233
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
6 // Wizard info box special formatting tags
1609
c5e15be5315c Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1607
diff changeset
7 $specTags = [
1112
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
8 "b" => "<b>",
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
9 "\/b" => "</b>",
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
10 "i" => "<i>",
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
11 "\/i" => "</i>",
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
12 "p" => "<br /><br />",
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
13 "br" => "<br />",
1609
c5e15be5315c Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1607
diff changeset
14 ];
1112
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
15
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
16
976
047fa29bc07e Tiny cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 975
diff changeset
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
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
20 if ($afilter)
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
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
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
23 if (!$coders)
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
24 {
801
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
25 if ($s !== "") $s .= "&amp;";
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
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
29 if ($qname !== "")
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
30 {
801
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
31 if ($s !== "") $s .= "&amp;";
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
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
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
35 echo
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
36 " <a class=\"control continent ".$qclass.
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
37 "\" href=\"".$_SERVER["PHP_SELF"].
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
38 (strlen($s) > 0 ? "?".$s : "").
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
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
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
43 function qcheck($arr, $key, &$result)
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
44 {
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
45 if (isset($key) && isset($arr[$key]))
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
46 {
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
47 $result = $arr[$key];
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
48 return TRUE;
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
49 }
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
50 else
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
51 {
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
52 unset($result);
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
53 return FALSE;
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
54 }
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
55 }
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
56
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
57
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
58
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
59 //
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
60 // Initialization
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
64 $filter = "C";
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
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
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
74 $applyFilter = FALSE;
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
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
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
83 }
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
84
1638
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
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
4c9c1d56d434 Security fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1060
diff changeset
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
4c9c1d56d434 Security fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1060
diff changeset
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
c5e15be5315c Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1607
diff changeset
111 $locTable = [];
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
c5e15be5315c Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1607
diff changeset
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
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
128 }
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
129 else
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
132 if (empty($locTable))
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
139
1638
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
140 // Make alphabetically sorted table of locations
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
141 $alphaTable = [];
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
142 foreach ($locTable as $id => $data)
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
143 if (isset($data["name"]))
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
144 {
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
145 $idx = $data["name"][0];
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
146 if (isset($_GET["nocoders"]))
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
147 {
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
148 if (count($data["coders"]) == 0 && !preg_match("/[SPG]/", $data["flags"]))
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
149 $alphaTable[$idx][] = $data;
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
150 }
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
151 else
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
152 if (isset($coderName))
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
153 {
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
154 foreach ($data["coders"] as $coder)
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
155 {
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
156 if ($coderName == $coder["name"])
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
157 $alphaTable[$idx][] = $data;
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
158 }
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
159 }
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
160 else
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
161 $alphaTable[$idx][] = $data;
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
162 }
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
163
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
164 ksort($alphaTable, SORT_STRING);
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
165
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
166
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
167 //
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
168 // Start of the page
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
169 //
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
170 if ($applyFilter)
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
171 {
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
172 if (array_key_exists($filter, $locationTypes))
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
173
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
174 $mtitle = $locationTypes[$filter][2];
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
175 else
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
176 $mtitle = "Filter '".$filter."'";
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
177 }
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
178 else
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
179 $mtitle = "Locations";
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
180
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
181 $mtitle .= " of ";
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
182
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
183 if (isset($setName) && isset($continentList[$setName]))
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
184 {
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
185 $mtitle .= $continentList[$setName][0].
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
186 ($continentList[$setName][3] ? " in " : " continent in ");
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
187 }
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
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
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
197 "<h1>".$mtitle."BatMUD".(isset($coderName) ? " by ".chentities($coderName) : "")."</h1>\n".
1567
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
198 "<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"get\">\n".
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
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
6d2c28904660 Synchronized.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
201 if (isset($setName))
926
Matti Hamalainen <ccr@tnsp.org>
parents: 908
diff changeset
202 echo "<input type=\"hidden\" name=\"n\" value=\"".chentities($setName)."\" />\n";
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
203
1607
Matti Hamalainen <ccr@tnsp.org>
parents: 1606
diff changeset
204 echo "<select class=\"control dropdown\" name=\"f\" onChange=\"this.form.submit();\">\n";
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
205 foreach ($locationTypes as $id => $type)
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
206 {
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
207 echo
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
208 " <option value=\"".$id."\"".
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
209 (($applyFilter && $filter == $id) ? " selected=\"selected\"" : "").
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
212 echo
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
213 "</select>\n".
1607
Matti Hamalainen <ccr@tnsp.org>
parents: 1606
diff changeset
214 "<noscript><input type=\"submit\" value=\" Update \" class=\"control submit\" /></noscript>\n";
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
215
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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&nbsp;continents", "", "all");
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
218 foreach ($continentList as $continent => $data)
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 1112
diff changeset
223 printTitleLink($applyFilter, $filter, $showCoders, "Special", "special", "special");
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
224
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
225 echo
1567
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
226 "</div>\n".
026c6eca781c Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1494
diff changeset
227 "</form>\n";
321
eeb6167cf81e Updates.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
228
1329
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
229
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
230 //
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
231 // Wizard/coder/creator information box
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
240 // XXX: backwards compatibility check
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
241 if (substr($s, 0, 6) == "bat://")
1401
1bd00e901199 Upstream sync.
Matti Hamalainen <ccr@tnsp.org>
parents: 1392
diff changeset
242 $s = $wizImageURL."unknown.png";
1bd00e901199 Upstream sync.
Matti Hamalainen <ccr@tnsp.org>
parents: 1392
diff changeset
243 else
1bd00e901199 Upstream sync.
Matti Hamalainen <ccr@tnsp.org>
parents: 1392
diff changeset
244 if (substr($s, 0, 7) != "http://")
1bd00e901199 Upstream sync.
Matti Hamalainen <ccr@tnsp.org>
parents: 1392
diff changeset
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
1bd00e901199 Upstream sync.
Matti Hamalainen <ccr@tnsp.org>
parents: 1392
diff changeset
248 $s = $wizImageURL."unknown.png";
1112
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
249
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
250 echo
1638
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
251 "<div class=\"wizinfo\">\n".
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
252 " <table>\n".
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
263
1329
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
266
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
267 echo " <p>".$str."</p>\n";
1329
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
268 }
321
eeb6167cf81e Updates.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
269
1329
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
275 if ($s == "bat")
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
276 $s = "http://wiz.bat.org/~".strtolower($coderName)."/";
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
277
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
278 echo " [<a href=\"".$s."\">Homepage</a>]<br />\n";
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
279 }
1638
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
280
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
281 echo
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
282 " </td>\n".
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
283 " </tr>\n".
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
284 " </table>\n".
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 1567
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 441
diff changeset
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
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
292 //
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
293 // Print out errors
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
294 //
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
295 if ($errorSet)
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
296 {
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
297 echo
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
298 "<div style=\"color: red;\">\n".
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
299 " <ul>\n";
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
300
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
301 foreach ($errorMsgs as $msg)
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
302 echo " <li>".$msg."</li>\n";
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
303
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
304 echo
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
305 " </ul>\n".
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
306 "</div>\n";
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
307 }
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
308
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
309
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
310 //
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
311 // Print list of locations
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
312 //
1638
775208d791fa Code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1630
diff changeset
313 if (count($alphaTable) > 0)
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
c5e15be5315c Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1607
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
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
90e6a0eda2ae Implement specialdate.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
327 "<h3 class=\"alpha\"><a id=\"ch".$letter."\"></a>".$letter."</h3>\n".
90e6a0eda2ae Implement specialdate.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
328 mpSpecialDate("loc", 2).
1391
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
339 // Print location entry
1391
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
340 printf(" <td class=\"%s\" style=\"width: %d%%\">",
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
341 $iv["continent"], (100 / $maxRow));
311
134dded5369b Changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 300
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
344
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
348 // Free form description
926
Matti Hamalainen <ccr@tnsp.org>
parents: 908
diff changeset
349 $desc = isset($iv["freeform"]) ? chentities($iv["freeform"]) : "";
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
350
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
351 // Add URL information, chopped, if any
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
352 if (isset($iv["url"]))
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
353 {
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
354 $urlEnt = $iv["url"];
926
Matti Hamalainen <ccr@tnsp.org>
parents: 908
diff changeset
355 $urlBegin = "<a href=\"".chentities($urlEnt)."\" target=\"_blank\">";
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
356 $urlEnd = "</a>";
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
357 if (strlen($iv["url"]) > 40)
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
358 $urlEnt = substr($urlEnt, 0, 40)."...";
926
Matti Hamalainen <ccr@tnsp.org>
parents: 908
diff changeset
359 $desc .= "<br /><br /><b>".chentities($urlEnt)."</b>";
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
360 }
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
361 else
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
362 {
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
363 $urlBegin = $urlEnd = "";
509
622767fb509e Added support for 'limbo'.
Matti Hamalainen <ccr@tnsp.org>
parents: 501
diff changeset
364 }
602
e46ee0632810 Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents: 601
diff changeset
365
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
366 echo
1401
1bd00e901199 Upstream sync.
Matti Hamalainen <ccr@tnsp.org>
parents: 1392
diff changeset
367 " ".$urlBegin."<img class=\"noborder\" src=\"img/question.png\" onmouseover=\"stt(".$totalLoc.
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
368 ");\" onmouseout=\"htt();\" alt=\"(?)\" />".$urlEnd."\n";
519
Matti Hamalainen <ccr@tnsp.org>
parents: 509
diff changeset
369
1609
c5e15be5315c Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1607
diff changeset
370 $locationTips[$totalLoc] = [
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
371 "title" => $iv["name"],
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
372 "desc" => $desc
1609
c5e15be5315c Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1607
diff changeset
373 ];
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
374 }
519
Matti Hamalainen <ccr@tnsp.org>
parents: 509
diff changeset
375
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
376 // Alternative names
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
377 if (($nnames = count($iv["names"])) > 1)
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
378 {
1609
c5e15be5315c Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1607
diff changeset
379 $fs = [];
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
380 for ($nname = 1; $nname < $nnames; $nname++)
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
381 {
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
382 $norig = $iv["names"][$nname]["flags"] & NAME_ORIG;
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
383 $fs[] =
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
384 ($norig ? "<b>" : "").
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
385 chentities($iv["names"][$nname]["name"]).
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
388 echo "<br />".implode(" | ", $fs);
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
389 }
817
eaba088b5424 Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents: 816
diff changeset
390
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
391 // Coder / society names
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
392 if (count($iv["coders"]) > 0 && $showCoders)
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
393 {
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
394 $isSG = preg_match("/[SG]/", $iv["flags"]);
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
395 if ((!isset($coderName) && !$isSG) || isset($coderName))
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
396 {
1609
c5e15be5315c Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1607
diff changeset
397 $fs = [];
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
398 foreach ($iv["coders"] as $name)
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
401 switch ($name["flags"])
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
9382e44a8c42 Import fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 678
diff changeset
409 if ($filter != "C" || !$applyFilter)
1392
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
ae493885b68e More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
423 $n = 0;
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
424 }
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
425 }
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
429 while ($n++ < $maxRow)
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
430 echo " <td></td>\n";
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
431 echo " </tr>\n";
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
432 }
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 509
diff changeset
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
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 509
diff changeset
447 }
1140
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
448
1391
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
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
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
454 echo
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
455 "<p><b>No locations known!</b></p>\n".
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
456 "</div>\n"; // end of contents div
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
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
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
461 cmPrintPageFooter(FALSE);
1151
e0794ddb605e Add output caching to main page and location page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1150
diff changeset
462 ?>