annotate www/loc.php @ 1391:7fcea2fce0be

More fixes.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 23 Dec 2013 17:08:10 +0200
parents 2b6b38e94bb2
children ae493885b68e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 <?
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 require "config.inc.php";
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
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
7 $specTags = array(
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 />",
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
14 );
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 = "";
622
6d2c28904660 Synchronized.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
20 if ($afilter) $s = "f=".$filter;
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 if (!$coders) {
801
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
23 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
24 $s .= "s";
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 }
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26
801
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
27 if ($qname !== "") {
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
28 if ($s !== "") $s .= "&amp;";
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
29 $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
30 }
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31
1331
2f142b33e4ed Make location filter selector bar freeform div instead of table.
Matti Hamalainen <ccr@tnsp.org>
parents: 1329
diff changeset
32 echo " <a ";
801
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
33 if ($qclass !== "")
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
34 echo "class=\"".$qclass."\" ";
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
35 echo "href=\"".$_SERVER["PHP_SELF"];
321
eeb6167cf81e Updates.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
36 if (strlen($s) > 0) echo "?".$s;
1331
2f142b33e4ed Make location filter selector bar freeform div instead of table.
Matti Hamalainen <ccr@tnsp.org>
parents: 1329
diff changeset
37 echo "\">".$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
38 }
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
40
441
Matti Hamalainen <ccr@tnsp.org>
parents: 416
diff changeset
41 /* Initialization
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
42 */
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
43 if (isset($_GET["c"]))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
44 {
621
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
45 $filter = "C";
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
46 $applyFilter = TRUE;
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
47 }
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
48 else
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
49 if (($filter = stGetRequestItem("f", "", TRUE)) != "")
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
50 {
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
51 if (!preg_match("/^[\^A-Za-z]+\$/", $filter))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
52 {
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
53 stError("Invalid filter rule '".chentities($filter)."'");
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
54 $filter = "C";
621
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
55 $applyFilter = FALSE;
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
56 }
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
57 else
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
58 $applyFilter = TRUE;
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
59 }
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
60 else
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
61 {
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
62 $filter = "CF";
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
63 $applyFilter = FALSE;
621
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
64 }
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
65
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
66 $showCoders = !isset($_GET["s"]);
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
67
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
68 if (($tmpName = stGetRequestItem("a", FALSE, TRUE)) !== false)
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
69 {
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
70 if (preg_match("#^([a-z]{1,15})#i", $tmpName, $m))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
71 {
1084
4c9c1d56d434 Security fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1060
diff changeset
72 $coderName = $m[1];
4c9c1d56d434 Security fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1060
diff changeset
73 $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
74
02fe48a608d7 Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents: 1148
diff changeset
75 $wizTable = apc_fetch("wizTable");
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
76 if (empty($wizTable))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
77 {
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
78 $wizTable = stReadWizInfoFiles();
1150
02fe48a608d7 Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents: 1148
diff changeset
79 apc_store("wizTable", $wizTable, 3600);
02fe48a608d7 Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents: 1148
diff changeset
80 }
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
81 }
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
82 else
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
83 {
1084
4c9c1d56d434 Security fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1060
diff changeset
84 $coderName = "???";
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
85 stError("Invalid wizard name.");
1150
02fe48a608d7 Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents: 1148
diff changeset
86 }
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
87 }
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
88
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
89 if (isset($_GET["n"]))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
90 {
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
91 $locTable = array();
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
92 $setName = strtolower(basename($_GET["n"]));
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
93 if (file_exists($setName.".loc"))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
94 {
1150
02fe48a608d7 Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents: 1148
diff changeset
95 $locTable = apc_fetch("loc_".$setName);
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
96 if (empty($locTable))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
97 {
1233
796cb8e6f537 Initialize locTable as empty array(), apparently PHP does not create empty array by default ..
Matti Hamalainen <ccr@tnsp.org>
parents: 1153
diff changeset
98 $locTable = array();
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
99 stParseLocFile($setName, $locTable, $applyFilter, $filter);
1150
02fe48a608d7 Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents: 1148
diff changeset
100 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
101 }
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
102 }
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
103 else
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
104 {
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
105 stError("No such continent ID!");
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
106 unset($setName);
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 } else {
1150
02fe48a608d7 Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents: 1148
diff changeset
109 $locTable = apc_fetch("loc_locTable");
02fe48a608d7 Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents: 1148
diff changeset
110 if (empty($locTable)) {
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
111 $locTable = stReadLocationFiles($applyFilter, $filter);
1150
02fe48a608d7 Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents: 1148
diff changeset
112 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
113 }
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
114 }
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
115
441
Matti Hamalainen <ccr@tnsp.org>
parents: 416
diff changeset
116 /* Start of the page
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 */
1140
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
118 printPageHeader($pageTitle." - Locations",
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
119 "<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
120 "<meta name=\"robots\" content=\"nofollow\" />\n");
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
121
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
122 require "menu.inc.php";
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
123
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
124 echo
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
125 "<div id=\"contents\">\n".
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
126 "<h1>";
1140
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
127
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
128 if ($applyFilter)
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
129 {
1060
b78333d62d5b Combine speciaList into continentList and clean up the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1059
diff changeset
130 if (array_key_exists($filter, $locationTypes))
621
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
131 echo $locationTypes[$filter][2];
1060
b78333d62d5b Combine speciaList into continentList and clean up the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1059
diff changeset
132 else
870
51054f3f5d2e Allow inversion of regexp group operator via "^" in the location type filter parameter.
Matti Hamalainen <ccr@tnsp.org>
parents: 822
diff changeset
133 echo "Filter '$filter'";
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
134 }
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
135 else
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 echo "Locations";
621
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
137
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 echo " of ";
621
537fae9ebf1d Synced.
Matti Hamalainen <ccr@tnsp.org>
parents: 609
diff changeset
139
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
140 if (isset($setName) && isset($continentList[$setName]))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
141 {
1060
b78333d62d5b Combine speciaList into continentList and clean up the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1059
diff changeset
142 echo $continentList[$setName][0].
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
143 ($continentList[$setName][3] ? " in " : " continent in ");
1060
b78333d62d5b Combine speciaList into continentList and clean up the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1059
diff changeset
144 }
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 echo "BatMUD";
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 if (isset($coderName))
1084
4c9c1d56d434 Security fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1060
diff changeset
147 echo " by ".chentities($coderName);
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 echo "</h1>\n";
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
150 if ($errorSet)
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
151 {
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
152 echo "<div style=\"color: red;\">Errors: ";
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
153 echo "</div>\n";
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
154 }
1140
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
155
622
6d2c28904660 Synchronized.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
156 ?>
6d2c28904660 Synchronized.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
157 <div class="selbar">
801
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
158 <form action="<? echo $_SERVER["PHP_SELF"]; ?>" method="get">
622
6d2c28904660 Synchronized.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
159 <?
6d2c28904660 Synchronized.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
160 if (isset($setName))
926
Matti Hamalainen <ccr@tnsp.org>
parents: 908
diff changeset
161 echo "<input type=\"hidden\" name=\"n\" value=\"".chentities($setName)."\" />\n";
622
6d2c28904660 Synchronized.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
162 ?>
1331
2f142b33e4ed Make location filter selector bar freeform div instead of table.
Matti Hamalainen <ccr@tnsp.org>
parents: 1329
diff changeset
163 <select class="dropdown" name="f">
622
6d2c28904660 Synchronized.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
164 <?
816
6341de08bd52 Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents: 813
diff changeset
165 foreach ($locationTypes as $id => $type) {
1331
2f142b33e4ed Make location filter selector bar freeform div instead of table.
Matti Hamalainen <ccr@tnsp.org>
parents: 1329
diff changeset
166 echo " <option value=\"".$id."\"";
816
6341de08bd52 Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents: 813
diff changeset
167 if ($applyFilter && $filter == $id)
622
6d2c28904660 Synchronized.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
168 echo " selected=\"selected\"";
816
6341de08bd52 Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents: 813
diff changeset
169 echo ">".$type[3]."</option>\n";
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 }
622
6d2c28904660 Synchronized.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
171 ?>
1331
2f142b33e4ed Make location filter selector bar freeform div instead of table.
Matti Hamalainen <ccr@tnsp.org>
parents: 1329
diff changeset
172 </select>
2f142b33e4ed Make location filter selector bar freeform div instead of table.
Matti Hamalainen <ccr@tnsp.org>
parents: 1329
diff changeset
173 <input type="submit" value=" Update " class="submit" />
622
6d2c28904660 Synchronized.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
174 <?
1331
2f142b33e4ed Make location filter selector bar freeform div instead of table.
Matti Hamalainen <ccr@tnsp.org>
parents: 1329
diff changeset
175 printTitleLink($applyFilter, $filter, $showCoders, "All&nbsp;continents", "", "all");
816
6341de08bd52 Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents: 813
diff changeset
176 foreach ($continentList as $continent => $data) {
1060
b78333d62d5b Combine speciaList into continentList and clean up the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1059
diff changeset
177 if ($data[4])
b78333d62d5b Combine speciaList into continentList and clean up the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1059
diff changeset
178 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
179 }
1115
Matti Hamalainen <ccr@tnsp.org>
parents: 1112
diff changeset
180 printTitleLink($applyFilter, $filter, $showCoders, "Special", "special", "special");
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 ?>
622
6d2c28904660 Synchronized.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
182 </form>
321
eeb6167cf81e Updates.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
183 </div>
eeb6167cf81e Updates.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
184
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 <?
1329
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
186 function qcheck($arr, $key, &$result)
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
187 {
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
188 if (isset($key) && isset($arr[$key]))
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
189 {
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
190 $result = $arr[$key];
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
191 return TRUE;
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
192 }
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
193 else
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
194 {
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
195 unset($result);
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
196 return FALSE;
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
197 }
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
198 }
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
199
1112
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
200 /* Wizard/coder/creator information box
441
Matti Hamalainen <ccr@tnsp.org>
parents: 416
diff changeset
201 */
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
202 if (isset($coderName))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
203 {
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
204 if (isset($wizTable[$coderName]) && count($wizTable[$coderName]) > 1)
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
205 {
1329
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
206 // Profile picture
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
207 if (qcheck($wizTable[$coderName], "imageURL", &$s))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
208 {
1329
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
209 // XXX: backwards compatibility check
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
210 if (substr($s, 0, 6) == "bat://")
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
211 $s = "img/unknown.png";
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
212 }
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
213 else
976
047fa29bc07e Tiny cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 975
diff changeset
214 $s = "img/unknown.png";
1112
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
215
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
216 echo
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
217 "<div class=\"wizinfo\">\n <table>\n <tr>\n".
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
218 " <td class=\"img\"><img src=\"".$s."\" alt=\"".$coderName."\" /></td>\n".
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
219 " <td class=\"info\">\n".
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
220 " <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
221
1329
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
222 // Description block
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
223 if (qcheck($wizTable[$coderName], "desc", &$str))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
224 {
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
225 // Handle special tags
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
226 $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
227
1329
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
228 foreach ($specTags as $tag => $rep)
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
229 $str = preg_replace("/\[".$tag."\]/i", $rep, $str);
1112
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
230
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
231 echo " <p>".$str."</p>\n";
1329
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
232 }
321
eeb6167cf81e Updates.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
233
1329
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
234 // Links, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
235 echo " [<a href=\"".fingerURL($coderName)."\">Finger</a>]\n";
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
236
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
237 if (qcheck($wizTable[$coderName], "homeURL", &$s))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
238 {
1329
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
239 if ($s == "bat")
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
240 $s = "http://wiz.bat.org/~".strtolower($coderName)."/";
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
241
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
242 echo " [<a href=\"".$s."\">Homepage</a>]<br />\n";
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
243 }
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
244
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
245 echo " </td>\n </tr>\n </table>\n</div>\n";
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
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
248 stError("No such wizard.");
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249 }
488
Matti Hamalainen <ccr@tnsp.org>
parents: 441
diff changeset
250
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252 /* Print list of locations
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253 */
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
254 if (count($locTable) > 0)
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
255 {
816
6341de08bd52 Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents: 813
diff changeset
256 /* Make alphabetically sorted table of locations
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 */
813
Matti Hamalainen <ccr@tnsp.org>
parents: 801
diff changeset
258 $alphaTable = array();
816
6341de08bd52 Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents: 813
diff changeset
259 foreach ($locTable as $id => $data)
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
260 if (isset($data["name"]))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
261 {
816
6341de08bd52 Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents: 813
diff changeset
262 $idx = $data["name"][0];
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
263 if (isset($_GET["nocoders"]))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
264 {
816
6341de08bd52 Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents: 813
diff changeset
265 if (count($data["coders"]) == 0 && !preg_match("/[SPG]/", $data["flags"]))
6341de08bd52 Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents: 813
diff changeset
266 $alphaTable[$idx][] = $data;
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
267 }
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
268 else
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
269 {
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
270 if (isset($coderName))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
271 {
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
272 foreach ($data["coders"] as $coder)
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
273 {
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
274 if ($coderName == $coder["name"])
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
275 $alphaTable[$idx][] = $data;
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
276 }
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
277 }
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
278 else
816
6341de08bd52 Handle alternative location names better;Add unique location ID generation to handle locations with exactly same primary name.
Matti Hamalainen <ccr@tnsp.org>
parents: 813
diff changeset
279 $alphaTable[$idx][] = $data;
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280 }
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281 }
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283 ksort($alphaTable, SORT_STRING);
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285 /* Print locations per first character
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286 */
519
Matti Hamalainen <ccr@tnsp.org>
parents: 509
diff changeset
287 $locationTips = array();
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288 $totalLoc = 0;
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 $maxRow = 6;
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
290 foreach ($alphaTable as $alpha => $alphaLocs)
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
291 {
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
292 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
293 $letter = strtoupper($alpha);
817
eaba088b5424 Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents: 816
diff changeset
294
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
295 asort($alphaLocs);
1148
52550f58cee5 Move alphabetic table printing code to a function in common routines.
Matti Hamalainen <ccr@tnsp.org>
parents: 1140
diff changeset
296
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
297 echo
1391
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
298 "<h3><a id=\"ch".$letter."\"></a>".$letter."</h3>\n".
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
299 "<table class=\"loc\">\n";
817
eaba088b5424 Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents: 816
diff changeset
300
eaba088b5424 Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents: 816
diff changeset
301 $n = 0;
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
302 foreach ($alphaLocs as $ik => $iv)
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
303 {
817
eaba088b5424 Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents: 816
diff changeset
304 if ($n == 0)
eaba088b5424 Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents: 816
diff changeset
305 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
306
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
307 $totalLoc++;
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
309 // Print location entry
1391
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
310 printf(" <td class=\"%s\" style=\"width: %d%%\">",
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
311 $iv["continent"], (100 / $maxRow));
311
134dded5369b Changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 300
diff changeset
312
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
313 echo stGetMapLink($iv, $continentList[$iv["continent"]][4]);
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
314
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
315 // 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
316 if (isset($iv["url"]) || isset($iv["freeform"]))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
317 {
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
318 // Free form description
926
Matti Hamalainen <ccr@tnsp.org>
parents: 908
diff changeset
319 $desc = isset($iv["freeform"]) ? chentities($iv["freeform"]) : "";
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
320
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
321 // Add URL information, chopped, if any
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
322 if (isset($iv["url"])) {
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
323 $urlEnt = $iv["url"];
926
Matti Hamalainen <ccr@tnsp.org>
parents: 908
diff changeset
324 $urlBegin = "<a href=\"".chentities($urlEnt)."\" target=\"_blank\">";
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
325 $urlEnd = "</a>";
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
326 if (strlen($iv["url"]) > 40)
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
327 $urlEnt = substr($urlEnt, 0, 40)."...";
926
Matti Hamalainen <ccr@tnsp.org>
parents: 908
diff changeset
328 $desc .= "<br /><br /><b>".chentities($urlEnt)."</b>";
509
622767fb509e Added support for 'limbo'.
Matti Hamalainen <ccr@tnsp.org>
parents: 501
diff changeset
329 } else {
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
330 $urlBegin = $urlEnd = "";
509
622767fb509e Added support for 'limbo'.
Matti Hamalainen <ccr@tnsp.org>
parents: 501
diff changeset
331 }
602
e46ee0632810 Add link via URL field too.
Matti Hamalainen <ccr@tnsp.org>
parents: 601
diff changeset
332
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
333 echo " ".$urlBegin."<img class=\"noborder\" src=\"question.png\" onmouseover=\"stt(".$totalLoc.
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
334 ");\" onmouseout=\"htt();\" alt=\"(?)\" />".$urlEnd."\n";
519
Matti Hamalainen <ccr@tnsp.org>
parents: 509
diff changeset
335
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
336 $locationTips[$totalLoc] = array(
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
337 "title" => $iv["name"],
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
338 "desc" => $desc
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
339 );
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
340 }
519
Matti Hamalainen <ccr@tnsp.org>
parents: 509
diff changeset
341
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
342 // Alternative names
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
343 $nnames = count($iv["names"]);
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
344 if ($nnames > 1) {
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
345 echo "<br />";
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
346 for ($nname = 1; $nname < $nnames; $nname++) {
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
347 if ($iv["names"][$nname]["flags"] & NAME_ORIG)
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
348 echo "<b>";
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
349 echo chentities($iv["names"][$nname]["name"]);
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
350 if ($iv["names"][$nname]["flags"] & NAME_ORIG)
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
351 echo "</b>";
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
352 if ($nname < $nnames - 1) echo " | ";
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
353 }
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
354 }
817
eaba088b5424 Show alternative location names on location page.
Matti Hamalainen <ccr@tnsp.org>
parents: 816
diff changeset
355
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
356 // Coder / society names
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
357 if (count($iv["coders"]) > 0 && $showCoders) {
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
358 $isSG = preg_match("/[SG]/", $iv["flags"]);
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
359 if ((!isset($coderName) && !$isSG) || isset($coderName)) {
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
360 $fs = "";
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
361 foreach ($iv["coders"] as $name) {
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
362 if ($fs != "") $fs .= ", ";
1140
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
363 // Tags/flags of this coder in relation to the area
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
364 switch ($name["flags"]) {
1140
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
365 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
366 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
367 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
368 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
369 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
370 }
679
9382e44a8c42 Import fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 678
diff changeset
371 if ($filter != "C" || !$applyFilter)
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
372 $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
373 else
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
374 $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
375 }
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
376 echo "<br />[".$fs."]";
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
377 }
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
378 }
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
379
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
380 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
381
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
382 if (++$n >= $maxRow)
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
383 {
300
edac314ac9bb Added in the ugly PHP-glue used in http://tnsp.org/maps/
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
384 echo " </tr>\n";
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
385 $n = 0;
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
386 }
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
387 }
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
388
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
389 if ($n > 0)
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
390 {
908
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
391 while ($n++ < $maxRow)
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
392 echo " <td></td>\n";
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
393 echo " </tr>\n";
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
394 }
Matti Hamalainen <ccr@tnsp.org>
parents: 870
diff changeset
395 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
396 }
519
Matti Hamalainen <ccr@tnsp.org>
parents: 509
diff changeset
397
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
398 echo
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
399 "<p><b>".$totalLoc."</b> locations.</p>\n".
1391
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
400 "</div>\n"; // end of contents div
1140
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
401
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
402 // Print out location tooltip HTML code
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
403 foreach ($locationTips as $tipID => $tip)
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
404 {
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
405 echo
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
406 "<div class=\"tooltip\" id=\"tt".$tipID.
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
407 "\"><div class=\"holder\"><b>".chentities($tip["title"]).
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
408 "</b><br />".$tip["desc"]."</div></div>\n";
519
Matti Hamalainen <ccr@tnsp.org>
parents: 509
diff changeset
409 }
1140
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
410
1391
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
411 // Print out the alpha link index div
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
412 stPrintExtraBoxAlphaList("ch", $alphaTable);
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
413 }
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
414 else
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
415 {
1391
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
416 echo
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
417 "<p><b>No locations known!</b></p>\n".
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
418 "</div>\n"; // end of contents div
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
419
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
420 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
421 }
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1331
diff changeset
422
1391
7fcea2fce0be More fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
423 cmPrintPageFooter(FALSE);
1151
e0794ddb605e Add output caching to main page and location page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1150
diff changeset
424 ?>