annotate index.php @ 288:4e6886674e40 gmap2

Check markers.json file for latest update timestamp.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 31 May 2016 16:21:21 +0300
parents 81547bf400a6
children 8e120dadd0a5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
167
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
1 <?php
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
2 require "config.inc.php";
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
3
255
d9e51ab58503 Improve the bootstrap configuration process.
Matti Hamalainen <ccr@tnsp.org>
parents: 253
diff changeset
4 if (!isset($pageBaseURL) || !isset($gmapsKey) || !isset($gmapsVersion))
d9e51ab58503 Improve the bootstrap configuration process.
Matti Hamalainen <ccr@tnsp.org>
parents: 253
diff changeset
5 {
256
85f79c765ab1 missing semicolon
jeskko
parents: 255
diff changeset
6 echo "Some settings are missing. Please check your configuration.";
255
d9e51ab58503 Improve the bootstrap configuration process.
Matti Hamalainen <ccr@tnsp.org>
parents: 253
diff changeset
7 exit;
d9e51ab58503 Improve the bootstrap configuration process.
Matti Hamalainen <ccr@tnsp.org>
parents: 253
diff changeset
8 }
d9e51ab58503 Improve the bootstrap configuration process.
Matti Hamalainen <ccr@tnsp.org>
parents: 253
diff changeset
9
219
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
10 //
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
11 // Generic settings
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
12 //
288
4e6886674e40 Check markers.json file for latest update timestamp.
Matti Hamalainen <ccr@tnsp.org>
parents: 285
diff changeset
13 $lastMTime = filemtime("markers.json");
167
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
14 $pageCharset = "UTF-8";
288
4e6886674e40 Check markers.json file for latest update timestamp.
Matti Hamalainen <ccr@tnsp.org>
parents: 285
diff changeset
15 $pageVersion = " [updated ".date("D d.m.Y H:i:s T", $lastMTime)."]";
183
a0f377c415ee Nicer style / cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
16
a0f377c415ee Nicer style / cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
17 $pageTitle1 = "BatMUD: The Age of Exiles";
282
43d3d2e943aa Bump version.
Matti Hamalainen <ccr@tnsp.org>
parents: 276
diff changeset
18 $pageTitle2 = "Google Maps Hack";
183
a0f377c415ee Nicer style / cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
19 $pageBy = "by Jeskko &amp; Ggr";
a0f377c415ee Nicer style / cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
20 $pageTitle = $pageTitle1." - ".$pageTitle2." ".$pageBy;
a0f377c415ee Nicer style / cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
21
167
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
22 $dataCopyrights = "Map data by BAT ry, Ggr, Slobber and Jeskko";
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
23
219
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
24
262
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
25 $jsLibs = array(
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
26 "map.js",
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
27 "lib/util.js",
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
28 "lib/markerwithlabel_packed.js",
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
29 "lib/markermanager_packed.js",
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
30 "world.js",
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
31 "icons.js",
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
32 "markers.js",
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
33 "nav.js",
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
34 );
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
35
271
1359bc5c53e0 Add name attribute to accepted list.
Matti Hamalainen <ccr@tnsp.org>
parents: 262
diff changeset
36 $jsTokens = array("x", "y", "zoom", "token", "name");
262
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
37
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
38
219
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
39 //
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
40 // Handle CSS stuff
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
41 //
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
42 $pageCSSCookie = "gmapcss";
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
43 if (isset($_GET["css"]))
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
44 {
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
45 $pageCSSIndex = intval($_GET["css"]);
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
46 setcookie($pageCSSCookie, $pageCSSIndex, time() + 365*24*60*60, "/"); // expire in a year
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
47 }
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
48 else
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
49 {
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
50 $pageCSSIndex = isset($_COOKIE[$pageCSSCookie]) ? intval($_COOKIE[$pageCSSCookie]) : 1;
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
51 }
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
52 $pageCSS = "css/mapstyle".$pageCSSIndex.".css";
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
53
167
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
54 echo
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
55 "<!DOCTYPE html>\n".
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
56 "<html>\n".
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
57 " <head>\n".
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
58 " <meta name=\"keywords\" content=\"batmud,map,laenor,lucentium,rothikgen,desolathya,furnachia,mud,mush,moo,online,massively,multiplayer,game,mmorpg,jeskko\" />\n".
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
59 " <meta charset=\"".$pageCharset."\">\n".
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
60 " <meta http-equiv=\"Content-type\" content=\"text/html;charset=".$pageCharset."\">\n".
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
61 " <title>".$pageTitle."</title>\n".
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
62 " <meta name=\"description\" content=\"".$pageTitle."\"/>\n".
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
63 " <script src=\"https://maps.googleapis.com/maps/api/js?v=".$gmapsVersion.
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
64 (isset($gmapsKey) ? "&amp;key=".$gmapsKey: "").
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
65 "&amp;sensor=false\" type=\"text/javascript\"></script>\n".
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
66 " <link rel=\"stylesheet\" href=\"".$pageCSS."\" type=\"text/css\" />\n".
218
373db5c1fe6f Add separate CSS stylesheet file for common color defs.
Matti Hamalainen <ccr@tnsp.org>
parents: 216
diff changeset
67 " <link rel=\"stylesheet\" href=\"css/colors.css\" type=\"text/css\" />\n".
262
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
68 " </head>\n".
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
69 " <body>\n";
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
70
253
c7abc2cce799 Add urchin include.
Matti Hamalainen <ccr@tnsp.org>
parents: 250
diff changeset
71 @include "urchin.inc.php";
c7abc2cce799 Add urchin include.
Matti Hamalainen <ccr@tnsp.org>
parents: 250
diff changeset
72 ?>
167
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
73 <div id="header">
216
ccb8e748a03f Some stylesheet and HTML work.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
74 <a id="headlogo" href="http://www.bat.org/"></a>
167
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
75 <div id="headcontent">
183
a0f377c415ee Nicer style / cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
76 <h1><?php echo $pageTitle1 ?></h1>
288
4e6886674e40 Check markers.json file for latest update timestamp.
Matti Hamalainen <ccr@tnsp.org>
parents: 285
diff changeset
77 <h2><?php echo $pageTitle2 ?></h2>
4e6886674e40 Check markers.json file for latest update timestamp.
Matti Hamalainen <ccr@tnsp.org>
parents: 285
diff changeset
78 <div class="version"><?php echo $pageVersion ?></div>
183
a0f377c415ee Nicer style / cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
79 <div class="credits"><?php echo $pageBy ?></div>
219
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
80 <div class="controls">
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
81 <?php
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
82 for ($i = 1; $i <= 4; $i++)
285
81547bf400a6 Add explanatory titles to certain UI elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 284
diff changeset
83 echo " <a class=\"stylesel\" href=\"?css=".$i."\" title=\"Switch to site style #".$i."\">".$i."</a>\n";
219
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
84 ?>
285
81547bf400a6 Add explanatory titles to certain UI elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 284
diff changeset
85 <a href="javascript:pmapMakeLink()" title="Create a URL link pointing to the current view.">Make link</a>
219
1e1f3c9967d4 Add CSS selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
86 </div>
167
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
87 </div>
19
7d7eb223cb51 Work on layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
88 </div>
167
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
89 <div id="map"></div>
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
90 <div id="copyrights"><?php echo $dataCopyrights ?></div>
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
91 <div id="sidebar">
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
92 <div id="sidetop"></div>
275
e336d0d18c8f Remove forced style def from HTML.
Matti Hamalainen <ccr@tnsp.org>
parents: 271
diff changeset
93 <div id="sidebox">
167
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
94 <div id="controls"></div>
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
95 <div id="sidecontent"></div>
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
96 </div>
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
97 <div id="sidebottom"></div>
19
7d7eb223cb51 Work on layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
98 </div>
167
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
99 <div id="sidecoll">
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
100 <div id="collbuttondiv">
198
66ac93b63482 HTML5 compatibility cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 197
diff changeset
101 <a href="javascript:pmapToggleSideBar()"><img src="img/right.gif" id="collbutton" alt="Collapse or uncollapse menus"></a>
167
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
102 </div>
0
f8eeb66cdb07 initial commit of new map
jeskko
parents:
diff changeset
103 </div>
167
01720e81667e Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
104 <div id="footer">
216
ccb8e748a03f Some stylesheet and HTML work.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
105 <div id="footercontent">&nbsp;</div>
19
7d7eb223cb51 Work on layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
106 </div>
200
f5aa704b1ddf Add "Make a link" feature.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
107 <?php
262
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
108
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
109 foreach ($jsLibs as $libName)
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
110 echo " <script type=\"text/javascript\" src=\"".$libName."\"></script>\n";
250
ee5492ccba8e Add configurable base URL.
Matti Hamalainen <ccr@tnsp.org>
parents: 243
diff changeset
111
262
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
112 $jsData = array();
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
113 foreach ($jsTokens as $key)
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
114 {
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
115 if (isset($_GET[$key]) && strlen($_GET[$key]) > 0)
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
116 {
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
117 $sval = $_GET[$key];
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
118 $jsData[] = "\"".$key."\":".(is_numeric($sval) ? $sval : "\"".$sval."\"");
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
119 }
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
120 }
250
ee5492ccba8e Add configurable base URL.
Matti Hamalainen <ccr@tnsp.org>
parents: 243
diff changeset
121
262
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
122 echo
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
123 " <script type=\"text/javascript\">\n".
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
124 " pmapBaseURL = \"".$pageBaseURL."\";\n".
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
125 " pmapInitializeMap({".implode($jsData, ",")."});\n".
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
126 " </script>\n".
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
127 " </body>\n".
254343316a90 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 261
diff changeset
128 "</html>\n";
200
f5aa704b1ddf Add "Make a link" feature.
Matti Hamalainen <ccr@tnsp.org>
parents: 198
diff changeset
129 ?>