@@ -4,10 +4,15 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | setcookie("MapFormat",'2d'); |
| 6 | 6 | |
| 7 | -if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = ''; |
|
| 7 | +if (!isset($globalOpenWeatherMapKey)) { |
|
| 8 | + $globalOpenWeatherMapKey = ''; |
|
| 9 | +} |
|
| 8 | 10 | // Compressed GeoJson is used if true |
| 9 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 10 | -else $compress = $globalJsonCompress; |
|
| 11 | +if (!isset($globalJsonCompress)) { |
|
| 12 | + $compress = true; |
|
| 13 | +} else { |
|
| 14 | + $compress = $globalJsonCompress; |
|
| 15 | +} |
|
| 11 | 16 | if (isset($_GET['archive'])) { |
| 12 | 17 | $archive = true; |
| 13 | 18 | //$archiveupdatetime = 50; |
@@ -18,8 +23,11 @@ discard block |
||
| 18 | 23 | //$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10)); |
| 19 | 24 | //$lastupd = 20; |
| 20 | 25 | $lastupd = $_GET['archivespeed']*$archiveupdatetime; |
| 21 | - if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate']; |
|
| 22 | - else $enddate = time(); |
|
| 26 | + if (isset($_GET['enddate']) && $_GET['enddate'] != '') { |
|
| 27 | + $enddate = $_GET['enddate']; |
|
| 28 | + } else { |
|
| 29 | + $enddate = time(); |
|
| 30 | + } |
|
| 23 | 31 | setcookie("archive_begin",$begindate); |
| 24 | 32 | setcookie("archive_end",$enddate); |
| 25 | 33 | setcookie("archive_update",$lastupd); |
@@ -107,7 +115,17 @@ discard block |
||
| 107 | 115 | } |
| 108 | 116 | |
| 109 | 117 | //create the map |
| 110 | - map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom); |
|
| 118 | + map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) { |
|
| 119 | + print $latitude; |
|
| 120 | +} else { |
|
| 121 | + print $globalCenterLatitude; |
|
| 122 | +} |
|
| 123 | +?>,<?php if (isset($longitude)) { |
|
| 124 | + print $longitude; |
|
| 125 | +} else { |
|
| 126 | + print $globalCenterLongitude; |
|
| 127 | +} |
|
| 128 | +?>], zoom); |
|
| 111 | 129 | <?php |
| 112 | 130 | } else { |
| 113 | 131 | if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) { |
@@ -133,9 +151,21 @@ discard block |
||
| 133 | 151 | || navigator.userAgent.match(/BlackBerry/i) |
| 134 | 152 | || navigator.userAgent.match(/Windows Phone/i)) |
| 135 | 153 | { |
| 136 | - var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>; |
|
| 154 | + var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) { |
|
| 155 | + print $viewzoom-1; |
|
| 156 | +} elseif (isset($viewzoom)) { |
|
| 157 | + print $viewzoom; |
|
| 158 | +} else { |
|
| 159 | + print '8'; |
|
| 160 | +} |
|
| 161 | +?>; |
|
| 137 | 162 | } else { |
| 138 | - var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>; |
|
| 163 | + var zoom = <?php if (isset($viewzoom)) { |
|
| 164 | + print $viewzoom; |
|
| 165 | +} else { |
|
| 166 | + print '9'; |
|
| 167 | +} |
|
| 168 | +?>; |
|
| 139 | 169 | } |
| 140 | 170 | |
| 141 | 171 | //create the map |
@@ -161,16 +191,27 @@ discard block |
||
| 161 | 191 | bounds = L.latLngBounds(southWest,northEast); |
| 162 | 192 | //a few title layers |
| 163 | 193 | <?php |
| 164 | - if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType']; |
|
| 165 | - else $MapType = $globalMapProvider; |
|
| 194 | + if (isset($_COOKIE['MapType'])) { |
|
| 195 | + $MapType = $_COOKIE['MapType']; |
|
| 196 | + } else { |
|
| 197 | + $MapType = $globalMapProvider; |
|
| 198 | + } |
|
| 166 | 199 | |
| 167 | 200 | if ($MapType == 'Mapbox') { |
| 168 | - if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId; |
|
| 169 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 170 | -?> |
|
| 201 | + if ($_COOKIE['MapTypeId'] == 'default') { |
|
| 202 | + $MapBoxId = $globalMapboxId; |
|
| 203 | + } else { |
|
| 204 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 205 | + } |
|
| 206 | + ?> |
|
| 171 | 207 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
| 172 | 208 | maxZoom: 18, |
| 173 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
| 209 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
| 210 | + print 'false'; |
|
| 211 | +} else { |
|
| 212 | + print 'true'; |
|
| 213 | +} |
|
| 214 | +?>, |
|
| 174 | 215 | attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>', |
| 175 | 216 | id: '<?php print $MapBoxId; ?>', |
| 176 | 217 | token: '<?php print $globalMapboxToken; ?>' |
@@ -189,7 +230,12 @@ discard block |
||
| 189 | 230 | ?> |
| 190 | 231 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
| 191 | 232 | maxZoom: 18, |
| 192 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
| 233 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
| 234 | + print 'false'; |
|
| 235 | +} else { |
|
| 236 | + print 'true'; |
|
| 237 | +} |
|
| 238 | +?>, |
|
| 193 | 239 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
| 194 | 240 | '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>' |
| 195 | 241 | }).addTo(map); |
@@ -198,7 +244,12 @@ discard block |
||
| 198 | 244 | ?> |
| 199 | 245 | L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', { |
| 200 | 246 | maxZoom: 18, |
| 201 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
| 247 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
| 248 | + print 'false'; |
|
| 249 | +} else { |
|
| 250 | + print 'true'; |
|
| 251 | +} |
|
| 252 | +?>, |
|
| 202 | 253 | attribution: 'Tiles © Esri — Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012' |
| 203 | 254 | }).addTo(map); |
| 204 | 255 | <?php |
@@ -206,7 +257,12 @@ discard block |
||
| 206 | 257 | ?> |
| 207 | 258 | L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { |
| 208 | 259 | maxZoom: 18, |
| 209 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
| 260 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
| 261 | + print 'false'; |
|
| 262 | +} else { |
|
| 263 | + print 'true'; |
|
| 264 | +} |
|
| 265 | +?>, |
|
| 210 | 266 | attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' |
| 211 | 267 | }).addTo(map); |
| 212 | 268 | <?php |
@@ -214,7 +270,12 @@ discard block |
||
| 214 | 270 | ?> |
| 215 | 271 | L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', { |
| 216 | 272 | maxZoom: 18, |
| 217 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
| 273 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
| 274 | + print 'false'; |
|
| 275 | +} else { |
|
| 276 | + print 'true'; |
|
| 277 | +} |
|
| 278 | +?>, |
|
| 218 | 279 | attribution: 'Tiles © Esri — National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC' |
| 219 | 280 | }).addTo(map); |
| 220 | 281 | <?php |
@@ -259,20 +320,26 @@ discard block |
||
| 259 | 320 | map.addLayer(yandexLayer); |
| 260 | 321 | <?php |
| 261 | 322 | } elseif ($MapType == 'Bing-Aerial') { |
| 262 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
| 263 | -?> |
|
| 323 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
| 324 | + setcookie('MapType','OpenStreetMap'); |
|
| 325 | + } |
|
| 326 | + ?> |
|
| 264 | 327 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'}); |
| 265 | 328 | map.addLayer(bingLayer); |
| 266 | 329 | <?php |
| 267 | 330 | } elseif ($MapType == 'Bing-Hybrid') { |
| 268 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
| 269 | -?> |
|
| 331 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
| 332 | + setcookie('MapType','OpenStreetMap'); |
|
| 333 | + } |
|
| 334 | + ?> |
|
| 270 | 335 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'}); |
| 271 | 336 | map.addLayer(bingLayer); |
| 272 | 337 | <?php |
| 273 | 338 | } elseif ($MapType == 'Bing-Road') { |
| 274 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
| 275 | -?> |
|
| 339 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
| 340 | + setcookie('MapType','OpenStreetMap'); |
|
| 341 | + } |
|
| 342 | + ?> |
|
| 276 | 343 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'}); |
| 277 | 344 | map.addLayer(bingLayer); |
| 278 | 345 | <?php |
@@ -301,7 +368,12 @@ discard block |
||
| 301 | 368 | maxZoom: 5, |
| 302 | 369 | tms : true, |
| 303 | 370 | zindex : 3, |
| 304 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
| 371 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
| 372 | + print 'false'; |
|
| 373 | +} else { |
|
| 374 | + print 'true'; |
|
| 375 | +} |
|
| 376 | +?>, |
|
| 305 | 377 | attribution: 'Natural Earth' |
| 306 | 378 | }).addTo(map); |
| 307 | 379 | <?php |
@@ -309,9 +381,24 @@ discard block |
||
| 309 | 381 | $customid = $MapType; |
| 310 | 382 | ?> |
| 311 | 383 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
| 312 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
| 313 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
| 314 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
| 384 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
| 385 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
| 386 | +} else { |
|
| 387 | + print '18'; |
|
| 388 | +} |
|
| 389 | +?>, |
|
| 390 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
| 391 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
| 392 | +} else { |
|
| 393 | + print '0'; |
|
| 394 | +} |
|
| 395 | +?>, |
|
| 396 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
| 397 | + print 'false'; |
|
| 398 | +} else { |
|
| 399 | + print 'true'; |
|
| 400 | +} |
|
| 401 | +?>, |
|
| 315 | 402 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
| 316 | 403 | }).addTo(map); |
| 317 | 404 | |
@@ -351,7 +438,12 @@ discard block |
||
| 351 | 438 | } |
| 352 | 439 | } elseif ($globalBounding == 'circle') { |
| 353 | 440 | ?> |
| 354 | - var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{ |
|
| 441 | + var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) { |
|
| 442 | + print $globalBoundingCircleSize; |
|
| 443 | +} else { |
|
| 444 | + print '70000'; |
|
| 445 | +} |
|
| 446 | +?>,{ |
|
| 355 | 447 | color: '#92C7D1', |
| 356 | 448 | fillColor: '#92C7D1', |
| 357 | 449 | fillOpacity: 0.3, |
@@ -443,7 +535,12 @@ discard block |
||
| 443 | 535 | createCookie('lastcentercoord',map.getCenter().lat+','+map.getCenter().lng+','+map.getZoom(),2); |
| 444 | 536 | }); |
| 445 | 537 | update_locationsLayer(); |
| 446 | -setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
| 538 | +setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) { |
|
| 539 | + print $globalMapRefresh*1000*2; |
|
| 540 | +} else { |
|
| 541 | + print '60000'; |
|
| 542 | +} |
|
| 543 | +?>); |
|
| 447 | 544 | |
| 448 | 545 | <?php |
| 449 | 546 | // Add support for custom json via $globalMapJson |