annotate www/loc.php @ 1151:e0794ddb605e

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