Completed
Push — master ( aeed75...4249a5 )
by Yannick
31:47
created
js/map.2d.js.php 2 patches
Spacing   +14 added lines, -14 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
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 	$lastupd = $_GET['archivespeed']*$archiveupdatetime;
21 21
 	if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate'];
22 22
 	else $enddate = time();
23
-	setcookie("archive_begin",$begindate);
24
-	setcookie("archive_end",$enddate);
25
-	setcookie("archive_update",$lastupd);
26
-	setcookie("archive_speed",$archivespeed);
23
+	setcookie("archive_begin", $begindate);
24
+	setcookie("archive_end", $enddate);
25
+	setcookie("archive_update", $lastupd);
26
+	setcookie("archive_speed", $archivespeed);
27 27
 ?>
28 28
 document.cookie =  'archive_begin=<?php print $begindate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/';
29 29
 document.cookie =  'archive_end=<?php print $enddate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/';
@@ -75,16 +75,16 @@  discard block
 block discarded – undo
75 75
 <?php
76 76
 	}
77 77
 	if (isset($_GET['ident'])) {
78
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
78
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
79 79
 	}
80 80
 	if (isset($_GET['flightaware_id'])) {
81
-		$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
81
+		$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
82 82
 	}
83 83
 	if (isset($_GET['latitude'])) {
84
-		$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_STRING);
84
+		$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_STRING);
85 85
 	}
86 86
 	if (isset($_GET['longitude'])) {
87
-		$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_STRING);
87
+		$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_STRING);
88 88
 	}
89 89
 ?>
90 90
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	} else {
113 113
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
114 114
 			if (isset($_COOKIE['lastcentercoord'])) {
115
-				$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
115
+				$lastcentercoord = explode(',', $_COOKIE['lastcentercoord']);
116 116
 				$viewcenterlatitude = $lastcentercoord[0];
117 117
 				$viewcenterlongitude = $lastcentercoord[1];
118 118
 				$viewzoom = $lastcentercoord[2];
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	     || navigator.userAgent.match(/BlackBerry/i)
134 134
 	     || navigator.userAgent.match(/Windows Phone/i))
135 135
 	{
136
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
136
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom - 1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
137 137
 	} else {
138 138
 		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
139 139
 	}
@@ -227,19 +227,19 @@  discard block
 block discarded – undo
227 227
 	map.addLayer(yandexLayer);
228 228
 <?php
229 229
 	} elseif ($MapType == 'Bing-Aerial') {
230
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
230
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
231 231
 ?>
232 232
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
233 233
 	map.addLayer(bingLayer);
234 234
 <?php
235 235
 	} elseif ($MapType == 'Bing-Hybrid') {
236
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
236
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
237 237
 ?>
238 238
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
239 239
 	map.addLayer(bingLayer);
240 240
 <?php
241 241
 	} elseif ($MapType == 'Bing-Road') {
242
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
242
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
243 243
 ?>
244 244
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
245 245
 	map.addLayer(bingLayer);
Please login to merge, or discard this patch.
Braces   +103 added lines, -26 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
 if (isset($_GET['archive'])) {
12 17
 	$archive = true;
13 18
 	//$archiveupdatetime = 50;
@@ -18,8 +23,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
@@ -160,16 +190,27 @@  discard block
 block discarded – undo
160 190
 	bounds = L.latLngBounds(southWest,northEast);
161 191
 	//a few title layers
162 192
 <?php
163
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
164
-	else $MapType = $globalMapProvider;
193
+	if (isset($_COOKIE['MapType'])) {
194
+		$MapType = $_COOKIE['MapType'];
195
+	} else {
196
+		$MapType = $globalMapProvider;
197
+	}
165 198
 
166 199
 	if ($MapType == 'Mapbox') {
167
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
168
-		else $MapBoxId = $_COOKIE['MapTypeId'];
169
-?>
200
+		if ($_COOKIE['MapTypeId'] == 'default') {
201
+			$MapBoxId = $globalMapboxId;
202
+		} else {
203
+			$MapBoxId = $_COOKIE['MapTypeId'];
204
+		}
205
+		?>
170 206
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
171 207
 	    maxZoom: 18,
172
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
208
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
209
+	print 'false';
210
+} else {
211
+	print 'true';
212
+}
213
+?>,
173 214
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
174 215
 	      '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
175 216
 	      'Imagery © <a href="http://mapbox.com">Mapbox</a>',
@@ -181,7 +222,12 @@  discard block
 block discarded – undo
181 222
 ?>
182 223
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
183 224
 	    maxZoom: 18,
184
-	    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
+?>,
185 231
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
186 232
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
187 233
 	}).addTo(map);
@@ -227,20 +273,26 @@  discard block
 block discarded – undo
227 273
 	map.addLayer(yandexLayer);
228 274
 <?php
229 275
 	} elseif ($MapType == 'Bing-Aerial') {
230
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
231
-?>
276
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
277
+			setcookie('MapType','OpenStreetMap');
278
+		}
279
+		?>
232 280
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
233 281
 	map.addLayer(bingLayer);
234 282
 <?php
235 283
 	} elseif ($MapType == 'Bing-Hybrid') {
236
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
237
-?>
284
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
285
+			setcookie('MapType','OpenStreetMap');
286
+		}
287
+		?>
238 288
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
239 289
 	map.addLayer(bingLayer);
240 290
 <?php
241 291
 	} elseif ($MapType == 'Bing-Road') {
242
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
243
-?>
292
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
293
+			setcookie('MapType','OpenStreetMap');
294
+		}
295
+		?>
244 296
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
245 297
 	map.addLayer(bingLayer);
246 298
 <?php
@@ -263,9 +315,24 @@  discard block
 block discarded – undo
263 315
 		$customid = $MapType;
264 316
 ?>
265 317
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
266
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
267
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
268
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
318
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
319
+	print $globalMapCustomLayer[$customid]['maxZoom'];
320
+} else {
321
+	print '18';
322
+}
323
+?>,
324
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
325
+	print $globalMapCustomLayer[$customid]['minZoom'];
326
+} else {
327
+	print '0';
328
+}
329
+?>,
330
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
331
+	print 'false';
332
+} else {
333
+	print 'true';
334
+}
335
+?>,
269 336
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
270 337
 	}).addTo(map);
271 338
 
@@ -299,7 +366,12 @@  discard block
 block discarded – undo
299 366
 		}
300 367
 	} elseif ($globalBounding == 'circle') {
301 368
 ?>
302
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
369
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
370
+	print $globalBoundingCircleSize;
371
+} else {
372
+	print '70000';
373
+}
374
+?>,{
303 375
 	    color: '#92C7D1',
304 376
 	    fillColor: '#92C7D1',
305 377
 	    fillOpacity: 0.3,
@@ -398,7 +470,12 @@  discard block
 block discarded – undo
398 470
 		createCookie('lastcentercoord',map.getCenter().lat+','+map.getCenter().lng+','+map.getZoom(),2);
399 471
 	});
400 472
 update_locationsLayer();
401
-setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
473
+setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) {
474
+	print $globalMapRefresh*1000*2;
475
+} else {
476
+	print '60000';
477
+}
478
+?>);
402 479
 
403 480
 <?php
404 481
     // Add support for custom json via $globalMapJson
Please login to merge, or discard this patch.