Mercurial > hg > batmud > gmap2
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 |
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 | 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 | 10 // |
11 // Generic settings | |
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 | 16 |
17 $pageTitle1 = "BatMUD: The Age of Exiles"; | |
282 | 18 $pageTitle2 = "Google Maps Hack"; |
183 | 19 $pageBy = "by Jeskko & Ggr"; |
20 $pageTitle = $pageTitle1." - ".$pageTitle2." ".$pageBy; | |
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 | 24 |
262 | 25 $jsLibs = array( |
26 "map.js", | |
27 "lib/util.js", | |
28 "lib/markerwithlabel_packed.js", | |
29 "lib/markermanager_packed.js", | |
30 "world.js", | |
31 "icons.js", | |
32 "markers.js", | |
33 "nav.js", | |
34 ); | |
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 | 37 |
38 | |
219 | 39 // |
40 // Handle CSS stuff | |
41 // | |
42 $pageCSSCookie = "gmapcss"; | |
43 if (isset($_GET["css"])) | |
44 { | |
45 $pageCSSIndex = intval($_GET["css"]); | |
46 setcookie($pageCSSCookie, $pageCSSIndex, time() + 365*24*60*60, "/"); // expire in a year | |
47 } | |
48 else | |
49 { | |
50 $pageCSSIndex = isset($_COOKIE[$pageCSSCookie]) ? intval($_COOKIE[$pageCSSCookie]) : 1; | |
51 } | |
52 $pageCSS = "css/mapstyle".$pageCSSIndex.".css"; | |
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) ? "&key=".$gmapsKey: ""). |
01720e81667e
Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents:
165
diff
changeset
|
65 "&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 | 68 " </head>\n". |
69 " <body>\n"; | |
70 | |
253 | 71 @include "urchin.inc.php"; |
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 | 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 | 79 <div class="credits"><?php echo $pageBy ?></div> |
219 | 80 <div class="controls"> |
81 <?php | |
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 | 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 | 86 </div> |
167
01720e81667e
Separate configuration variables into config.inc.php
Matti Hamalainen <ccr@tnsp.org>
parents:
165
diff
changeset
|
87 </div> |
19 | 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 | 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 | 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"> </div> |
19 | 106 </div> |
200 | 107 <?php |
262 | 108 |
109 foreach ($jsLibs as $libName) | |
110 echo " <script type=\"text/javascript\" src=\"".$libName."\"></script>\n"; | |
250 | 111 |
262 | 112 $jsData = array(); |
113 foreach ($jsTokens as $key) | |
114 { | |
115 if (isset($_GET[$key]) && strlen($_GET[$key]) > 0) | |
116 { | |
117 $sval = $_GET[$key]; | |
118 $jsData[] = "\"".$key."\":".(is_numeric($sval) ? $sval : "\"".$sval."\""); | |
119 } | |
120 } | |
250 | 121 |
262 | 122 echo |
123 " <script type=\"text/javascript\">\n". | |
124 " pmapBaseURL = \"".$pageBaseURL."\";\n". | |
125 " pmapInitializeMap({".implode($jsData, ",")."});\n". | |
126 " </script>\n". | |
127 " </body>\n". | |
128 "</html>\n"; | |
200 | 129 ?> |