Completed
Push — master ( a5ee4b...982e11 )
by Yannick
59:24 queued 26:14
created
js/map.2d.js.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4
-setcookie("MapFormat",'2d');
4
+setcookie("MapFormat", '2d');
5 5
 ?>
6 6
 /**
7 7
  * This javascript is part of FlightAirmap.
@@ -108,16 +108,16 @@  discard block
 block discarded – undo
108 108
 <?php
109 109
 	}
110 110
 	if (isset($_GET['ident'])) {
111
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
111
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
112 112
 	}
113 113
 	if (isset($_GET['flightaware_id'])) {
114
-		$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
114
+		$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
115 115
 	}
116 116
 	if (isset($_GET['latitude'])) {
117
-		$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_STRING);
117
+		$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_STRING);
118 118
 	}
119 119
 	if (isset($_GET['longitude'])) {
120
-		$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_STRING);
120
+		$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_STRING);
121 121
 	}
122 122
 ?>
123 123
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	} else {
146 146
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
147 147
 			if (isset($_COOKIE['lastcentercoord'])) {
148
-				$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
148
+				$lastcentercoord = explode(',', $_COOKIE['lastcentercoord']);
149 149
 				$viewcenterlatitude = $lastcentercoord[0];
150 150
 				$viewcenterlongitude = $lastcentercoord[1];
151 151
 				$viewzoom = $lastcentercoord[2];
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	     || navigator.userAgent.match(/BlackBerry/i)
167 167
 	     || navigator.userAgent.match(/Windows Phone/i))
168 168
 	{
169
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
169
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom - 1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
170 170
 	} else {
171 171
 		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
172 172
 	}
@@ -310,19 +310,19 @@  discard block
 block discarded – undo
310 310
 	map.addLayer(yandexLayer);
311 311
 <?php
312 312
 	} elseif ($MapType == 'Bing-Aerial') {
313
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
313
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
314 314
 ?>
315 315
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
316 316
 	map.addLayer(bingLayer);
317 317
 <?php
318 318
 	} elseif ($MapType == 'Bing-Hybrid') {
319
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
319
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
320 320
 ?>
321 321
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
322 322
 	map.addLayer(bingLayer);
323 323
 <?php
324 324
 	} elseif ($MapType == 'Bing-Road') {
325
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
325
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
326 326
 ?>
327 327
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
328 328
 	map.addLayer(bingLayer);
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 
461 461
 	function update_tsk() {
462 462
 		var bbox = map.getBounds().toBBoxString();
463
-		var tskLayerQuery = $.getJSON("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php echo filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); ?>",function (data) {
463
+		var tskLayerQuery = $.getJSON("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php echo filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); ?>",function (data) {
464 464
 		    tskLayer = L.geoJson(data,{
465 465
 			onEachFeature: function (feature, layer) {
466 466
 			    tskPopup(feature, layer);
Please login to merge, or discard this patch.
Braces   +134 added lines, -30 removed lines patch added patch discarded remove patch
@@ -12,10 +12,15 @@  discard block
 block discarded – undo
12 12
 */
13 13
 <?php
14 14
 
15
-if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
15
+if (!isset($globalOpenWeatherMapKey)) {
16
+	$globalOpenWeatherMapKey = '';
17
+}
16 18
 // Compressed GeoJson is used if true
17
-if (!isset($globalJsonCompress)) $compress = true;
18
-else $compress = $globalJsonCompress;
19
+if (!isset($globalJsonCompress)) {
20
+	$compress = true;
21
+} else {
22
+	$compress = $globalJsonCompress;
23
+}
19 24
 
20 25
 /*
21 26
 if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
@@ -140,7 +145,17 @@  discard block
 block discarded – undo
140 145
 	}
141 146
 
142 147
 	//create the map
143
-	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);
148
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
149
+	print $latitude;
150
+} else {
151
+	print $globalCenterLatitude;
152
+}
153
+?>,<?php if (isset($longitude)) {
154
+	print $longitude;
155
+} else {
156
+	print $globalCenterLongitude;
157
+}
158
+?>], zoom);
144 159
 <?php
145 160
 	} else {
146 161
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
@@ -166,9 +181,21 @@  discard block
 block discarded – undo
166 181
 	     || navigator.userAgent.match(/BlackBerry/i)
167 182
 	     || navigator.userAgent.match(/Windows Phone/i))
168 183
 	{
169
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
184
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) {
185
+	print $viewzoom-1;
186
+} elseif (isset($viewzoom)) {
187
+	print $viewzoom;
188
+} else {
189
+	print '8';
190
+}
191
+?>;
170 192
 	} else {
171
-		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
193
+		var zoom = <?php if (isset($viewzoom)) {
194
+	print $viewzoom;
195
+} else {
196
+	print '9';
197
+}
198
+?>;
172 199
 	}
173 200
 
174 201
 	//create the map
@@ -194,16 +221,27 @@  discard block
 block discarded – undo
194 221
 	bounds = L.latLngBounds(southWest,northEast);
195 222
 	//a few title layers
196 223
 <?php
197
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
198
-	else $MapType = $globalMapProvider;
224
+	if (isset($_COOKIE['MapType'])) {
225
+		$MapType = $_COOKIE['MapType'];
226
+	} else {
227
+		$MapType = $globalMapProvider;
228
+	}
199 229
 
200 230
 	if ($MapType == 'Mapbox') {
201
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
202
-		else $MapBoxId = $_COOKIE['MapTypeId'];
203
-?>
231
+		if ($_COOKIE['MapTypeId'] == 'default') {
232
+			$MapBoxId = $globalMapboxId;
233
+		} else {
234
+			$MapBoxId = $_COOKIE['MapTypeId'];
235
+		}
236
+		?>
204 237
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
205 238
 	    maxZoom: 18,
206
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
239
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
240
+	print 'false';
241
+} else {
242
+	print 'true';
243
+}
244
+?>,
207 245
 	    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>',
208 246
 	    id: '<?php print $MapBoxId; ?>',
209 247
 	    token: '<?php print $globalMapboxToken; ?>'
@@ -222,7 +260,12 @@  discard block
 block discarded – undo
222 260
 ?>
223 261
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
224 262
 	    maxZoom: 18,
225
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
263
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
264
+	print 'false';
265
+} else {
266
+	print 'true';
267
+}
268
+?>,
226 269
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
227 270
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
228 271
 	}).addTo(map);
@@ -231,7 +274,12 @@  discard block
 block discarded – undo
231 274
 ?>
232 275
 	L.tileLayer('https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', {
233 276
 	    maxZoom: 18,
234
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
277
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
278
+	print 'false';
279
+} else {
280
+	print 'true';
281
+}
282
+?>,
235 283
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
236 284
 		'&copy; <a href="http://openseamap.org">OpenSeaMap</a> contributors, ' +
237 285
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
@@ -241,7 +289,12 @@  discard block
 block discarded – undo
241 289
 ?>
242 290
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
243 291
 	    maxZoom: 18,
244
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
292
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
293
+	print 'false';
294
+} else {
295
+	print 'true';
296
+}
297
+?>,
245 298
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
246 299
 	}).addTo(map);
247 300
 <?php
@@ -249,7 +302,12 @@  discard block
 block discarded – undo
249 302
 ?>
250 303
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
251 304
 	    maxZoom: 18,
252
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
305
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
306
+	print 'false';
307
+} else {
308
+	print 'true';
309
+}
310
+?>,
253 311
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
254 312
 	}).addTo(map);
255 313
 <?php
@@ -257,7 +315,12 @@  discard block
 block discarded – undo
257 315
 ?>
258 316
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{z}/{y}/{x}', {
259 317
 	    maxZoom: 18,
260
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
318
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
319
+	print 'false';
320
+} else {
321
+	print 'true';
322
+}
323
+?>,
261 324
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri'
262 325
 	}).addTo(map);
263 326
 <?php
@@ -265,7 +328,12 @@  discard block
 block discarded – undo
265 328
 ?>
266 329
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', {
267 330
 	    maxZoom: 18,
268
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
331
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
332
+	print 'false';
333
+} else {
334
+	print 'true';
335
+}
336
+?>,
269 337
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
270 338
 	}).addTo(map);
271 339
 <?php
@@ -310,20 +378,26 @@  discard block
 block discarded – undo
310 378
 	map.addLayer(yandexLayer);
311 379
 <?php
312 380
 	} elseif ($MapType == 'Bing-Aerial') {
313
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
314
-?>
381
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
382
+			setcookie('MapType','OpenStreetMap');
383
+		}
384
+		?>
315 385
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
316 386
 	map.addLayer(bingLayer);
317 387
 <?php
318 388
 	} elseif ($MapType == 'Bing-Hybrid') {
319
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
320
-?>
389
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
390
+			setcookie('MapType','OpenStreetMap');
391
+		}
392
+		?>
321 393
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
322 394
 	map.addLayer(bingLayer);
323 395
 <?php
324 396
 	} elseif ($MapType == 'Bing-Road') {
325
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
326
-?>
397
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
398
+			setcookie('MapType','OpenStreetMap');
399
+		}
400
+		?>
327 401
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
328 402
 	map.addLayer(bingLayer);
329 403
 <?php
@@ -352,7 +426,12 @@  discard block
 block discarded – undo
352 426
 	    maxZoom: 5,
353 427
 	    tms : true,
354 428
 	    zindex : 3,
355
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
429
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
430
+	print 'false';
431
+} else {
432
+	print 'true';
433
+}
434
+?>,
356 435
 	    attribution: 'Natural Earth'
357 436
 	}).addTo(map);
358 437
 <?php
@@ -360,9 +439,24 @@  discard block
 block discarded – undo
360 439
 		$customid = $MapType;
361 440
 ?>
362 441
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
363
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
364
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
365
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
442
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
443
+	print $globalMapCustomLayer[$customid]['maxZoom'];
444
+} else {
445
+	print '18';
446
+}
447
+?>,
448
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
449
+	print $globalMapCustomLayer[$customid]['minZoom'];
450
+} else {
451
+	print '0';
452
+}
453
+?>,
454
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
455
+	print 'false';
456
+} else {
457
+	print 'true';
458
+}
459
+?>,
366 460
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
367 461
 	}).addTo(map);
368 462
 
@@ -402,7 +496,12 @@  discard block
 block discarded – undo
402 496
 		}
403 497
 	} elseif ($globalBounding == 'circle') {
404 498
 ?>
405
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
499
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
500
+	print $globalBoundingCircleSize;
501
+} else {
502
+	print '70000';
503
+}
504
+?>,{
406 505
 	    color: '#92C7D1',
407 506
 	    fillColor: '#92C7D1',
408 507
 	    fillOpacity: 0.3,
@@ -492,7 +591,12 @@  discard block
 block discarded – undo
492 591
 	});
493 592
 	if (archive === false) {
494 593
 		update_locationsLayer();
495
-		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
594
+		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) {
595
+	print $globalMapRefresh*1000*2;
596
+} else {
597
+	print '60000';
598
+}
599
+?>);
496 600
 	}
497 601
 <?php
498 602
     // Add support for custom json via $globalMapJson
Please login to merge, or discard this patch.