Completed
Push — master ( c4440f...341b08 )
by Yannick
42:29 queued 10:21
created
js/map.2d.js.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5
-setcookie("MapFormat",'2d');
5
+setcookie("MapFormat", '2d');
6 6
 
7 7
 if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
8 8
 // Compressed GeoJson is used if true
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
 <?php
57 57
 	}
58 58
 	if (isset($_GET['ident'])) {
59
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
59
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
60 60
 	}
61 61
 	if (isset($_GET['flightaware_id'])) {
62
-		$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
62
+		$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
63 63
 	}
64 64
 	if (isset($_GET['latitude'])) {
65
-		$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_STRING);
65
+		$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_STRING);
66 66
 	}
67 67
 	if (isset($_GET['longitude'])) {
68
-		$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_STRING);
68
+		$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_STRING);
69 69
 	}
70 70
 ?>
71 71
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	} else {
94 94
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
95 95
 			if (isset($_COOKIE['lastcentercoord'])) {
96
-				$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
96
+				$lastcentercoord = explode(',', $_COOKIE['lastcentercoord']);
97 97
 				$viewcenterlatitude = $lastcentercoord[0];
98 98
 				$viewcenterlongitude = $lastcentercoord[1];
99 99
 				$viewzoom = $lastcentercoord[2];
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	     || navigator.userAgent.match(/BlackBerry/i)
115 115
 	     || navigator.userAgent.match(/Windows Phone/i))
116 116
 	{
117
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
117
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom - 1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
118 118
 	} else {
119 119
 		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
120 120
 	}
@@ -240,19 +240,19 @@  discard block
 block discarded – undo
240 240
 	map.addLayer(yandexLayer);
241 241
 <?php
242 242
 	} elseif ($MapType == 'Bing-Aerial') {
243
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
243
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
244 244
 ?>
245 245
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
246 246
 	map.addLayer(bingLayer);
247 247
 <?php
248 248
 	} elseif ($MapType == 'Bing-Hybrid') {
249
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
249
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
250 250
 ?>
251 251
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
252 252
 	map.addLayer(bingLayer);
253 253
 <?php
254 254
 	} elseif ($MapType == 'Bing-Road') {
255
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
255
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
256 256
 ?>
257 257
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
258 258
 	map.addLayer(bingLayer);
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 
391 391
 	function update_tsk() {
392 392
 		var bbox = map.getBounds().toBBoxString();
393
-		var tskLayerQuery = $.getJSON("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php echo filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); ?>",function (data) {
393
+		var tskLayerQuery = $.getJSON("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php echo filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); ?>",function (data) {
394 394
 		    tskLayer = L.geoJson(data,{
395 395
 			onEachFeature: function (feature, layer) {
396 396
 			    tskPopup(feature, layer);
Please login to merge, or discard this patch.
Braces   +122 added lines, -28 removed lines patch added patch discarded remove patch
@@ -4,10 +4,15 @@  discard block
 block discarded – undo
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
 
12 17
 if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
13 18
 	echo "console.log('Archive mode');";
@@ -88,7 +93,17 @@  discard block
 block discarded – undo
88 93
 	}
89 94
 
90 95
 	//create the map
91
-	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);
96
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
97
+	print $latitude;
98
+} else {
99
+	print $globalCenterLatitude;
100
+}
101
+?>,<?php if (isset($longitude)) {
102
+	print $longitude;
103
+} else {
104
+	print $globalCenterLongitude;
105
+}
106
+?>], zoom);
92 107
 <?php
93 108
 	} else {
94 109
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
@@ -114,9 +129,21 @@  discard block
 block discarded – undo
114 129
 	     || navigator.userAgent.match(/BlackBerry/i)
115 130
 	     || navigator.userAgent.match(/Windows Phone/i))
116 131
 	{
117
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
132
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) {
133
+	print $viewzoom-1;
134
+} elseif (isset($viewzoom)) {
135
+	print $viewzoom;
136
+} else {
137
+	print '8';
138
+}
139
+?>;
118 140
 	} else {
119
-		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
141
+		var zoom = <?php if (isset($viewzoom)) {
142
+	print $viewzoom;
143
+} else {
144
+	print '9';
145
+}
146
+?>;
120 147
 	}
121 148
 
122 149
 	//create the map
@@ -142,16 +169,27 @@  discard block
 block discarded – undo
142 169
 	bounds = L.latLngBounds(southWest,northEast);
143 170
 	//a few title layers
144 171
 <?php
145
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
146
-	else $MapType = $globalMapProvider;
172
+	if (isset($_COOKIE['MapType'])) {
173
+		$MapType = $_COOKIE['MapType'];
174
+	} else {
175
+		$MapType = $globalMapProvider;
176
+	}
147 177
 
148 178
 	if ($MapType == 'Mapbox') {
149
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
150
-		else $MapBoxId = $_COOKIE['MapTypeId'];
151
-?>
179
+		if ($_COOKIE['MapTypeId'] == 'default') {
180
+			$MapBoxId = $globalMapboxId;
181
+		} else {
182
+			$MapBoxId = $_COOKIE['MapTypeId'];
183
+		}
184
+		?>
152 185
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
153 186
 	    maxZoom: 18,
154
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
187
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
188
+	print 'false';
189
+} else {
190
+	print 'true';
191
+}
192
+?>,
155 193
 	    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>',
156 194
 	    id: '<?php print $MapBoxId; ?>',
157 195
 	    token: '<?php print $globalMapboxToken; ?>'
@@ -170,7 +208,12 @@  discard block
 block discarded – undo
170 208
 ?>
171 209
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
172 210
 	    maxZoom: 18,
173
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
211
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
212
+	print 'false';
213
+} else {
214
+	print 'true';
215
+}
216
+?>,
174 217
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
175 218
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
176 219
 	}).addTo(map);
@@ -179,7 +222,12 @@  discard block
 block discarded – undo
179 222
 ?>
180 223
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
181 224
 	    maxZoom: 18,
182
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
225
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
226
+	print 'false';
227
+} else {
228
+	print 'true';
229
+}
230
+?>,
183 231
 	    attribution: 'Tiles &copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
184 232
 	}).addTo(map);
185 233
 <?php
@@ -187,7 +235,12 @@  discard block
 block discarded – undo
187 235
 ?>
188 236
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
189 237
 	    maxZoom: 18,
190
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
238
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
239
+	print 'false';
240
+} else {
241
+	print 'true';
242
+}
243
+?>,
191 244
 	    attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
192 245
 	}).addTo(map);
193 246
 <?php
@@ -195,7 +248,12 @@  discard block
 block discarded – undo
195 248
 ?>
196 249
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', {
197 250
 	    maxZoom: 18,
198
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
251
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
252
+	print 'false';
253
+} else {
254
+	print 'true';
255
+}
256
+?>,
199 257
 	    attribution: 'Tiles &copy; Esri &mdash; National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
200 258
 	}).addTo(map);
201 259
 <?php
@@ -240,20 +298,26 @@  discard block
 block discarded – undo
240 298
 	map.addLayer(yandexLayer);
241 299
 <?php
242 300
 	} elseif ($MapType == 'Bing-Aerial') {
243
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
244
-?>
301
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
302
+			setcookie('MapType','OpenStreetMap');
303
+		}
304
+		?>
245 305
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
246 306
 	map.addLayer(bingLayer);
247 307
 <?php
248 308
 	} elseif ($MapType == 'Bing-Hybrid') {
249
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
250
-?>
309
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
310
+			setcookie('MapType','OpenStreetMap');
311
+		}
312
+		?>
251 313
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
252 314
 	map.addLayer(bingLayer);
253 315
 <?php
254 316
 	} elseif ($MapType == 'Bing-Road') {
255
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
256
-?>
317
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
318
+			setcookie('MapType','OpenStreetMap');
319
+		}
320
+		?>
257 321
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
258 322
 	map.addLayer(bingLayer);
259 323
 <?php
@@ -282,7 +346,12 @@  discard block
 block discarded – undo
282 346
 	    maxZoom: 5,
283 347
 	    tms : true,
284 348
 	    zindex : 3,
285
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
349
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
350
+	print 'false';
351
+} else {
352
+	print 'true';
353
+}
354
+?>,
286 355
 	    attribution: 'Natural Earth'
287 356
 	}).addTo(map);
288 357
 <?php
@@ -290,9 +359,24 @@  discard block
 block discarded – undo
290 359
 		$customid = $MapType;
291 360
 ?>
292 361
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
293
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
294
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
295
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
362
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
363
+	print $globalMapCustomLayer[$customid]['maxZoom'];
364
+} else {
365
+	print '18';
366
+}
367
+?>,
368
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
369
+	print $globalMapCustomLayer[$customid]['minZoom'];
370
+} else {
371
+	print '0';
372
+}
373
+?>,
374
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
375
+	print 'false';
376
+} else {
377
+	print 'true';
378
+}
379
+?>,
296 380
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
297 381
 	}).addTo(map);
298 382
 
@@ -332,7 +416,12 @@  discard block
 block discarded – undo
332 416
 		}
333 417
 	} elseif ($globalBounding == 'circle') {
334 418
 ?>
335
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
419
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
420
+	print $globalBoundingCircleSize;
421
+} else {
422
+	print '70000';
423
+}
424
+?>,{
336 425
 	    color: '#92C7D1',
337 426
 	    fillColor: '#92C7D1',
338 427
 	    fillOpacity: 0.3,
@@ -424,7 +513,12 @@  discard block
 block discarded – undo
424 513
 	if (!isset($archive) || $archive === false) {
425 514
 ?>
426 515
 update_locationsLayer();
427
-setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
516
+setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) {
517
+	print $globalMapRefresh*1000*2;
518
+} else {
519
+	print '60000';
520
+}
521
+?>);
428 522
 <?php
429 523
 	}
430 524
 ?>
Please login to merge, or discard this patch.