Completed
Push — master ( c396ef...4342b6 )
by Yannick
34:34
created
js/map-satellite.2d.js.php 1 patch
Braces   +42 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,8 +13,11 @@  discard block
 block discarded – undo
13 13
 <?php
14 14
 
15 15
 // Compressed GeoJson is used if true
16
-if (!isset($globalJsonCompress)) $compress = true;
17
-else $compress = $globalJsonCompress;
16
+if (!isset($globalJsonCompress)) {
17
+	$compress = true;
18
+} else {
19
+	$compress = $globalJsonCompress;
20
+}
18 21
 $compress = false;
19 22
 ?>
20 23
 
@@ -145,9 +148,13 @@  discard block
 block discarded – undo
145 148
 		    if (callsign != ""){ markerSatelliteLabel += callsign; }
146 149
 		    if (type != ""){ markerSatelliteLabel += ' - '+type; }
147 150
 <?php
148
-	if (isset($_COOKIE['SatelliteIconColor'])) $IconColor = $_COOKIE['SatelliteIconColor'];
149
-	elseif (isset($globalSatelliteIconColor)) $IconColor = $globalSatelliteIconColor;
150
-	else $IconColor = '1a3151';
151
+	if (isset($_COOKIE['SatelliteIconColor'])) {
152
+		$IconColor = $_COOKIE['SatelliteIconColor'];
153
+	} elseif (isset($globalSatelliteIconColor)) {
154
+		$IconColor = $globalSatelliteIconColor;
155
+	} else {
156
+		$IconColor = '1a3151';
157
+	}
151 158
 	if (!isset($ident) && !isset($famsatid)) {
152 159
 ?>
153 160
 		    info_satellite_update(feature.properties.fc);
@@ -174,7 +181,12 @@  discard block
 block discarded – undo
174 181
 <?php
175 182
 		} else {
176 183
 ?>
177
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
184
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
185
+	print $archiveupdatetime*1000;
186
+} else {
187
+	print $globalMapRefresh*1000+20000;
188
+}
189
+?>+feature.properties.sqt*1000);
178 190
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
179 191
 <?php
180 192
 		}
@@ -231,7 +243,12 @@  discard block
 block discarded – undo
231 243
 <?php
232 244
 		} else {
233 245
 ?>
234
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
246
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
247
+	print $archiveupdatetime*1000;
248
+} else {
249
+	print $globalMapRefresh*1000+20000;
250
+}
251
+?>+feature.properties.sqt*1000);
235 252
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
236 253
 <?php
237 254
 		}
@@ -287,7 +304,12 @@  discard block
 block discarded – undo
287 304
 <?php
288 305
 		} else {
289 306
 ?>
290
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
307
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
308
+	print $archiveupdatetime*1000;
309
+} else {
310
+	print $globalMapRefresh*1000+20000;
311
+}
312
+?>+feature.properties.sqt*1000);
291 313
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
292 314
 <?php
293 315
 		}
@@ -456,14 +478,24 @@  discard block
 block discarded – undo
456 478
 	if (isset($archive) && $archive) {
457 479
 ?>
458 480
 //then load it again every 30 seconds
459
-//  var reload = setInterval(function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
481
+//  var reload = setInterval(function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) {
482
+	print ($globalMapRefresh*1000)/2;
483
+} else {
484
+	print '15000';
485
+}
486
+?>);
460 487
 var reloadSatellitePage = setInterval(function(){if (noTimeout) updateSat(0)},<?php print $archiveupdatetime*1000; ?>);
461 488
 <?php
462 489
 	} else {
463 490
 ?>
464 491
 //then load it again every 30 seconds
465 492
 var reloadSatellitePage = setInterval(
466
-    function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
493
+    function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) {
494
+	print $globalMapRefresh*1000;
495
+} else {
496
+	print '30000';
497
+}
498
+?>);
467 499
 <?php
468 500
 	}
469 501
 ?>
Please login to merge, or discard this patch.
js/map.2d.js.php 1 patch
Braces   +134 added lines, -30 removed lines patch added patch discarded remove patch
@@ -13,10 +13,15 @@  discard block
 block discarded – undo
13 13
 "use strict";
14 14
 <?php
15 15
 
16
-if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
16
+if (!isset($globalOpenWeatherMapKey)) {
17
+	$globalOpenWeatherMapKey = '';
18
+}
17 19
 // Compressed GeoJson is used if true
18
-if (!isset($globalJsonCompress)) $compress = true;
19
-else $compress = $globalJsonCompress;
20
+if (!isset($globalJsonCompress)) {
21
+	$compress = true;
22
+} else {
23
+	$compress = $globalJsonCompress;
24
+}
20 25
 
21 26
 /*
22 27
 if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
@@ -142,7 +147,17 @@  discard block
 block discarded – undo
142 147
 	}
143 148
 
144 149
 	//create the map
145
-	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);
150
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
151
+	print $latitude;
152
+} else {
153
+	print $globalCenterLatitude;
154
+}
155
+?>,<?php if (isset($longitude)) {
156
+	print $longitude;
157
+} else {
158
+	print $globalCenterLongitude;
159
+}
160
+?>], zoom);
146 161
 <?php
147 162
 	} else {
148 163
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
@@ -168,9 +183,21 @@  discard block
 block discarded – undo
168 183
 	     || navigator.userAgent.match(/BlackBerry/i)
169 184
 	     || navigator.userAgent.match(/Windows Phone/i))
170 185
 	{
171
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
186
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) {
187
+	print $viewzoom-1;
188
+} elseif (isset($viewzoom)) {
189
+	print $viewzoom;
190
+} else {
191
+	print '8';
192
+}
193
+?>;
172 194
 	} else {
173
-		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
195
+		var zoom = <?php if (isset($viewzoom)) {
196
+	print $viewzoom;
197
+} else {
198
+	print '9';
199
+}
200
+?>;
174 201
 	}
175 202
 
176 203
 	//create the map
@@ -196,16 +223,27 @@  discard block
 block discarded – undo
196 223
 	var bounds = L.latLngBounds(southWest,northEast);
197 224
 	//a few title layers
198 225
 <?php
199
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
200
-	else $MapType = $globalMapProvider;
226
+	if (isset($_COOKIE['MapType'])) {
227
+		$MapType = $_COOKIE['MapType'];
228
+	} else {
229
+		$MapType = $globalMapProvider;
230
+	}
201 231
 
202 232
 	if ($MapType == 'Mapbox') {
203
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
204
-		else $MapBoxId = $_COOKIE['MapTypeId'];
205
-?>
233
+		if ($_COOKIE['MapTypeId'] == 'default') {
234
+			$MapBoxId = $globalMapboxId;
235
+		} else {
236
+			$MapBoxId = $_COOKIE['MapTypeId'];
237
+		}
238
+		?>
206 239
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
207 240
 	    maxZoom: 18,
208
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
241
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
242
+	print 'false';
243
+} else {
244
+	print 'true';
245
+}
246
+?>,
209 247
 	    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>',
210 248
 	    id: '<?php print $MapBoxId; ?>',
211 249
 	    token: '<?php print $globalMapboxToken; ?>'
@@ -224,7 +262,12 @@  discard block
 block discarded – undo
224 262
 ?>
225 263
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
226 264
 	    maxZoom: 18,
227
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
265
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
266
+	print 'false';
267
+} else {
268
+	print 'true';
269
+}
270
+?>,
228 271
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
229 272
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
230 273
 	}).addTo(map);
@@ -233,7 +276,12 @@  discard block
 block discarded – undo
233 276
 ?>
234 277
 	L.tileLayer('https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', {
235 278
 	    maxZoom: 18,
236
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
279
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
280
+	print 'false';
281
+} else {
282
+	print 'true';
283
+}
284
+?>,
237 285
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
238 286
 		'&copy; <a href="http://openseamap.org">OpenSeaMap</a> contributors, ' +
239 287
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
@@ -243,7 +291,12 @@  discard block
 block discarded – undo
243 291
 ?>
244 292
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
245 293
 	    maxZoom: 18,
246
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
294
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
295
+	print 'false';
296
+} else {
297
+	print 'true';
298
+}
299
+?>,
247 300
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
248 301
 	}).addTo(map);
249 302
 <?php
@@ -251,7 +304,12 @@  discard block
 block discarded – undo
251 304
 ?>
252 305
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
253 306
 	    maxZoom: 18,
254
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
307
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
308
+	print 'false';
309
+} else {
310
+	print 'true';
311
+}
312
+?>,
255 313
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
256 314
 	}).addTo(map);
257 315
 <?php
@@ -259,7 +317,12 @@  discard block
 block discarded – undo
259 317
 ?>
260 318
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{z}/{y}/{x}', {
261 319
 	    maxZoom: 18,
262
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
320
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
321
+	print 'false';
322
+} else {
323
+	print 'true';
324
+}
325
+?>,
263 326
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri'
264 327
 	}).addTo(map);
265 328
 <?php
@@ -267,7 +330,12 @@  discard block
 block discarded – undo
267 330
 ?>
268 331
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', {
269 332
 	    maxZoom: 18,
270
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
333
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
334
+	print 'false';
335
+} else {
336
+	print 'true';
337
+}
338
+?>,
271 339
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
272 340
 	}).addTo(map);
273 341
 <?php
@@ -312,20 +380,26 @@  discard block
 block discarded – undo
312 380
 	map.addLayer(yandexLayer);
313 381
 <?php
314 382
 	} elseif ($MapType == 'Bing-Aerial') {
315
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
316
-?>
383
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
384
+			setcookie('MapType','OpenStreetMap');
385
+		}
386
+		?>
317 387
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
318 388
 	map.addLayer(bingLayer);
319 389
 <?php
320 390
 	} elseif ($MapType == 'Bing-Hybrid') {
321
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
322
-?>
391
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
392
+			setcookie('MapType','OpenStreetMap');
393
+		}
394
+		?>
323 395
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
324 396
 	map.addLayer(bingLayer);
325 397
 <?php
326 398
 	} elseif ($MapType == 'Bing-Road') {
327
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
328
-?>
399
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
400
+			setcookie('MapType','OpenStreetMap');
401
+		}
402
+		?>
329 403
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
330 404
 	map.addLayer(bingLayer);
331 405
 <?php
@@ -354,7 +428,12 @@  discard block
 block discarded – undo
354 428
 	    maxZoom: 5,
355 429
 	    tms : true,
356 430
 	    zindex : 3,
357
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
431
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
432
+	print 'false';
433
+} else {
434
+	print 'true';
435
+}
436
+?>,
358 437
 	    attribution: 'Natural Earth'
359 438
 	}).addTo(map);
360 439
 <?php
@@ -362,9 +441,24 @@  discard block
 block discarded – undo
362 441
 		$customid = $MapType;
363 442
 ?>
364 443
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
365
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
366
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
367
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
444
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
445
+	print $globalMapCustomLayer[$customid]['maxZoom'];
446
+} else {
447
+	print '18';
448
+}
449
+?>,
450
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
451
+	print $globalMapCustomLayer[$customid]['minZoom'];
452
+} else {
453
+	print '0';
454
+}
455
+?>,
456
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
457
+	print 'false';
458
+} else {
459
+	print 'true';
460
+}
461
+?>,
368 462
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
369 463
 	}).addTo(map);
370 464
 
@@ -404,7 +498,12 @@  discard block
 block discarded – undo
404 498
 		}
405 499
 	} elseif ($globalBounding == 'circle') {
406 500
 ?>
407
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
501
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
502
+	print $globalBoundingCircleSize;
503
+} else {
504
+	print '70000';
505
+}
506
+?>,{
408 507
 	    color: '#92C7D1',
409 508
 	    fillColor: '#92C7D1',
410 509
 	    fillOpacity: 0.3,
@@ -494,7 +593,12 @@  discard block
 block discarded – undo
494 593
 	});
495 594
 	if (archive === false) {
496 595
 		update_locationsLayer();
497
-		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
596
+		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) {
597
+	print $globalMapRefresh*1000*2;
598
+} else {
599
+	print '60000';
600
+}
601
+?>);
498 602
 	}
499 603
 	var currentdate = new Date();
500 604
 	var currentyear = new Date().getFullYear();
Please login to merge, or discard this patch.
search-kml.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,8 +16,12 @@  discard block
 block discarded – undo
16 16
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
17 17
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
18 18
 		$sql_date = $end_date;
19
-	} else $sql_date = '';
20
-} else $sql_date = '';
19
+	} else {
20
+		$sql_date = '';
21
+	}
22
+	} else {
23
+	$sql_date = '';
24
+}
21 25
 
22 26
 if (isset($_GET['highest_altitude'])) {
23 27
 	//for altitude manipulation
@@ -31,8 +35,12 @@  discard block
 block discarded – undo
31 35
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
32 36
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
33 37
 		$sql_altitude = $start_altitude;
34
-	} else $sql_altitude = '';
35
-} else $sql_altitude = '';
38
+	} else {
39
+		$sql_altitude = '';
40
+	}
41
+	} else {
42
+	$sql_altitude = '';
43
+}
36 44
 
37 45
 //calculuation for the pagination
38 46
 if(!isset($_GET['limit']))
@@ -49,7 +57,7 @@  discard block
 block discarded – undo
49 57
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50 58
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
51 59
 	}
52
-}  else {
60
+} else {
53 61
 	$limit_explode = explode(",", $_GET['limit']);
54 62
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
55 63
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -67,8 +75,11 @@  discard block
 block discarded – undo
67 75
 
68 76
 header('Content-Type: text/xml');
69 77
 
70
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
71
-else $sort = '';
78
+if (isset($_GET['sort'])) {
79
+	$sort = $_GET['sort'];
80
+} else {
81
+	$sort = '';
82
+}
72 83
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
73 84
 $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING);
74 85
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
install/install-action.php 1 patch
Braces   +78 added lines, -28 removed lines patch added patch discarded remove patch
@@ -75,7 +75,9 @@  discard block
 block discarded – undo
75 75
 	if ($error != '') {
76 76
 		$_SESSION['error'] = $error;
77 77
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create database'));
78
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database'));
78
+	} else {
79
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Create database'));
80
+	}
79 81
 	$_SESSION['install'] = 'database_import';
80 82
 	$_SESSION['next'] = 'Create and import tables';
81 83
 	$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -93,7 +95,9 @@  discard block
 block discarded – undo
93 95
 		if ($error != '') {
94 96
 			$_SESSION['error'] = $error;
95 97
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables'));
96
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables'));
98
+		} else {
99
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables'));
100
+		}
97 101
 		if ((!isset($globalAircraft) || $globalAircraft === TRUE) && (!isset($globalVA) || $globalVA === FALSE)) {
98 102
 			$_SESSION['install'] = 'populate';
99 103
 			$_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B';
@@ -107,7 +111,9 @@  discard block
 block discarded – undo
107 111
 		$error .= $check_version;
108 112
 		$_SESSION['error'] = $error;
109 113
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables'));
110
-		if (!isset($_SESSION['next'])) $_SESSION['next'] = '';
114
+		if (!isset($_SESSION['next'])) {
115
+			$_SESSION['next'] = '';
116
+		}
111 117
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
112 118
 		print json_encode($result);
113 119
 	} else {
@@ -115,7 +121,9 @@  discard block
 block discarded – undo
115 121
 		if ($error != '') {
116 122
 			$_SESSION['error'] = $error;
117 123
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Update schema if needed'));
118
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed'));
124
+		} else {
125
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed'));
126
+		}
119 127
 		$_SESSION['install'] = 'sources';
120 128
 		$_SESSION['next'] = 'Insert data in source table';
121 129
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -128,8 +136,10 @@  discard block
 block discarded – undo
128 136
 	if ($error != '') {
129 137
 		$_SESSION['error'] = $error;
130 138
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate waypoints database'));
131
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database'));
132
-/*
139
+	} else {
140
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database'));
141
+	}
142
+	/*
133 143
 	$_SESSION['install'] = 'airspace';
134 144
 	$_SESSION['next'] = 'Populate airspace table';
135 145
 	$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -154,7 +164,9 @@  discard block
 block discarded – undo
154 164
 	if ($error != '') {
155 165
 		$_SESSION['error'] = $error;
156 166
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database'));
157
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
167
+	} else {
168
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
169
+	}
158 170
 	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
159 171
 	    $_SESSION['install'] = 'notam';
160 172
 	    $_SESSION['next'] = 'Populate NOTAM table with externals data';
@@ -188,7 +200,9 @@  discard block
 block discarded – undo
188 200
 		if ($error != '') {
189 201
 			$_SESSION['error'] = $error;
190 202
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B'));
191
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B'));
203
+		} else {
204
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B'));
205
+		}
192 206
 		$_SESSION['install'] = 'populate_flarm';
193 207
 		$_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM';
194 208
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -209,18 +223,26 @@  discard block
 block discarded – undo
209 223
 		if ($error != '') {
210 224
 			$_SESSION['error'] = $error;
211 225
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM'));
212
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM'));
226
+		} else {
227
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM'));
228
+		}
213 229
 		if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) {
214 230
 			$_SESSION['install'] = 'vatsim';
215
-			if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
216
-			else $_SESSION['next'] = 'Insert VATSIM data';
231
+			if (file_exists('tmp/ivae_feb2013.zip')) {
232
+				$_SESSION['next'] = 'Insert IVAO data';
233
+			} else {
234
+				$_SESSION['next'] = 'Insert VATSIM data';
235
+			}
217 236
 		} elseif (isset($globalVATSIM) && $globalVATSIM) {
218 237
 			$_SESSION['install'] = 'vatsim';
219 238
 			$_SESSION['next'] = 'Insert VATSIM data';
220 239
 		} elseif (isset($globalIVAO) && $globalIVAO) {
221 240
 			$_SESSION['install'] = 'vatsim';
222
-			if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
223
-			else $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
241
+			if (file_exists('tmp/ivae_feb2013.zip')) {
242
+				$_SESSION['next'] = 'Insert IVAO data';
243
+			} else {
244
+				$_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
245
+			}
224 246
 		} elseif (isset($globalphpVMS) && $globalphpVMS) {
225 247
 			$_SESSION['install'] = 'vatsim';
226 248
 			$_SESSION['next'] = 'Insert phpVMS data';
@@ -245,7 +267,9 @@  discard block
 block discarded – undo
245 267
 		if ($error != '') {
246 268
 			$_SESSION['error'] = $error;
247 269
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate routes table with externals data'));
248
-		} else 	$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data'));
270
+		} else {
271
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data'));
272
+		}
249 273
 		$_SESSION['install'] = 'translation';
250 274
 		$_SESSION['next'] = 'Populate translation table with externals data';
251 275
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -265,7 +289,9 @@  discard block
 block discarded – undo
265 289
 		if ($error != '') {
266 290
 			$_SESSION['error'] = $error;
267 291
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data'));
268
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data'));
292
+		} else {
293
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data'));
294
+		}
269 295
 		if ($_SESSION['waypoints'] == 1) {
270 296
 			$_SESSION['install'] = 'waypoints';
271 297
 			$_SESSION['next'] = 'Populate waypoints table';
@@ -300,7 +326,9 @@  discard block
 block discarded – undo
300 326
 		if ($error != '') {
301 327
 			$_SESSION['error'] = $error;
302 328
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data'));
303
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data'));
329
+		} else {
330
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data'));
331
+		}
304 332
 		$_SESSION['install'] = 'sources';
305 333
 		$_SESSION['next'] = 'Insert data in source table';
306 334
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -321,12 +349,16 @@  discard block
 block discarded – undo
321 349
 			if ($error != '') {
322 350
 				$_SESSION['error'] = $error;
323 351
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data'));
324
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data'));
352
+			} else {
353
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data'));
354
+			}
325 355
 		} else {
326 356
 			if ($error != '') {
327 357
 				$_SESSION['error'] = $error;
328 358
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data (no source defined)'));
329
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)'));
359
+			} else {
360
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)'));
361
+			}
330 362
 		}
331 363
 		/*
332 364
 		if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) {
@@ -376,7 +408,9 @@  discard block
 block discarded – undo
376 408
 		$Source = new Source();
377 409
 		$Source->deleteAllLocation();
378 410
 		foreach ($sources as $src) {
379
-			if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png');
411
+			if (isset($src['latitude']) && $src['latitude'] != '') {
412
+				$Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png');
413
+			}
380 414
 		}
381 415
 		$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table'));
382 416
 		unset($_SESSION['sources']);
@@ -387,15 +421,21 @@  discard block
 block discarded – undo
387 421
 	*/
388 422
 	if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) {
389 423
 		$_SESSION['install'] = 'vatsim';
390
-		if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
391
-		else $_SESSION['next'] = 'Insert VATSIM data';
424
+		if (file_exists('tmp/ivae_feb2013.zip')) {
425
+			$_SESSION['next'] = 'Insert IVAO data';
426
+		} else {
427
+			$_SESSION['next'] = 'Insert VATSIM data';
428
+		}
392 429
 	} elseif (isset($globalVATSIM) && $globalVATSIM) {
393 430
 		$_SESSION['install'] = 'vatsim';
394 431
 		$_SESSION['next'] = 'Insert VATSIM data';
395 432
 	} elseif (isset($globalIVAO) && $globalIVAO) {
396 433
 		$_SESSION['install'] = 'vatsim';
397
-		if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
398
-		else $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
434
+		if (file_exists('tmp/ivae_feb2013.zip')) {
435
+			$_SESSION['next'] = 'Insert IVAO data';
436
+		} else {
437
+			$_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
438
+		}
399 439
 	} elseif (isset($globalphpVMS) && $globalphpVMS) {
400 440
 		$_SESSION['install'] = 'vatsim';
401 441
 		$_SESSION['next'] = 'Insert phpVMS data';
@@ -416,33 +456,43 @@  discard block
 block discarded – undo
416 456
 			if ($error != '') {
417 457
 				$_SESSION['error'] = $error;
418 458
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data'));
419
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
459
+			} else {
460
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
461
+			}
420 462
 		} else {
421 463
 			$error .= update_db::update_vatsim();
422 464
 			if ($error != '') {
423 465
 				$_SESSION['error'] = $error;
424 466
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data'));
425
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
467
+			} else {
468
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
469
+			}
426 470
 		}
427 471
 	} elseif (isset($globalVATSIM) && $globalVATSIM) {
428 472
 		$error .= update_db::update_vatsim();
429 473
 		if ($error != '') {
430 474
 			$_SESSION['error'] = $error;
431 475
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data'));
432
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
476
+		} else {
477
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
478
+		}
433 479
 	} elseif (isset($globalIVAO) && $globalIVAO) {
434 480
 		if (file_exists('tmp/ivae_feb2013.zip')) {
435 481
 			$error .= update_db::update_IVAO();
436 482
 			if ($error != '') {
437 483
 				$_SESSION['error'] = $error;
438 484
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data'));
439
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
485
+			} else {
486
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
487
+			}
440 488
 		} else {
441 489
 			$error .= update_db::update_vatsim();
442 490
 			if ($error != '') {
443 491
 				$_SESSION['error'] = $error;
444 492
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data (IVAO not found)'));
445
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)'));
493
+			} else {
494
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)'));
495
+			}
446 496
 		}
447 497
 	} elseif (isset($globalphpVMS) && $globalphpVMS) {
448 498
 		$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data'));
Please login to merge, or discard this patch.
require/class.AIS.php 1 patch
Braces   +204 added lines, -79 removed lines patch added patch discarded remove patch
@@ -123,7 +123,9 @@  discard block
 block discarded – undo
123 123
 			$temp += 1;
124 124
 			$flat = (float)($temp / (60.0 * 10000.0));
125 125
 			$flat *= -1.0;
126
-		} else $flat = (float)($temp / (60.0 * 10000.0));
126
+		} else {
127
+			$flat = (float)($temp / (60.0 * 10000.0));
128
+		}
127 129
 		return $flat; // float
128 130
 	}
129 131
 
@@ -135,7 +137,9 @@  discard block
 block discarded – undo
135 137
 			$temp += 1;
136 138
 			$flon = (float)($temp / (60.0 * 10000.0));
137 139
 			$flon *= -1.0;
138
-		} else $flon = (float)($temp / (60.0 * 10000.0));
140
+		} else {
141
+			$flon = (float)($temp / (60.0 * 10000.0));
142
+		}
139 143
 		return $flon;
140 144
 	}
141 145
 
@@ -158,10 +162,8 @@  discard block
 block discarded – undo
158 162
     */
159 163
 	private function asciidec_2_8bit($ascii) {
160 164
 		//only process in the following range: 48-87, 96-119
161
-		if ($ascii < 48) { }
162
-		else {
163
-			if($ascii>119) { }
164
-			else {
165
+		if ($ascii < 48) { } else {
166
+			if($ascii>119) { } else {
165 167
 				if ($ascii>87 && $ascii<96) ;
166 168
 				else {
167 169
 					$ascii=$ascii+40;
@@ -263,7 +265,9 @@  discard block
 block discarded – undo
263 265
 			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,57,28)));
264 266
 			$ro->lat = $this->make_latf(bindec(substr($_aisdata,85,27)));
265 267
 			$ro->heading = bindec(substr($_aisdata,124,9));
266
-			if ($ro->heading == 511) $ro->heading = '';
268
+			if ($ro->heading == 511) {
269
+				$ro->heading = '';
270
+			}
267 271
 			$ro->cls = 2; // class B
268 272
 		} else if ($ro->id == 19) {
269 273
 			$ro->cog = bindec(substr($_aisdata,112,12))/10;
@@ -273,7 +277,9 @@  discard block
 block discarded – undo
273 277
 			$ro->name = $this->binchar($_aisdata,143,120);
274 278
 			$ro->cls = 2; // class B
275 279
 			$ro->heading = bindec(substr($_aisdata,124,9));
276
-			if ($ro->heading == 511) $ro->heading = '';
280
+			if ($ro->heading == 511) {
281
+				$ro->heading = '';
282
+			}
277 283
 			$ro->typeid = bindec(substr($_aisdata,263,8));
278 284
 			$ro->type = $this->getShipType($ro->typeid);
279 285
 			//$ro->to_bow = bindec(substr($_aisdata,271,9));
@@ -304,9 +310,13 @@  discard block
 block discarded – undo
304 310
 			$ro->cls = 2; // class B
305 311
 		} else if ($ro->id == 27) {
306 312
 			$ro->cog = bindec(substr($_aisdata,85,9));
307
-			if ($ro->cog == 511) $ro->cog = 0.0;
313
+			if ($ro->cog == 511) {
314
+				$ro->cog = 0.0;
315
+			}
308 316
 			$ro->sog = bindec(substr($_aisdata,79,6));
309
-			if ($ro->sog == 63) $ro->sog = 0.0;
317
+			if ($ro->sog == 63) {
318
+				$ro->sog = 0.0;
319
+			}
310 320
 			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,44,18))*10);
311 321
 			$ro->lat = $this->make_latf(bindec(substr($_aisdata,62,17))*10);
312 322
 			$ro->cls = 1; // class A
@@ -354,28 +364,48 @@  discard block
 block discarded – undo
354 364
 	}
355 365
 	
356 366
 	public function getShipType($code) {
357
-		if (isset($this->shiptype[$code])) return $this->shiptype[$code];
358
-		else return '';
367
+		if (isset($this->shiptype[$code])) {
368
+			return $this->shiptype[$code];
369
+		} else {
370
+			return '';
371
+		}
359 372
 	}
360 373
 
361 374
 	public function getShipTypeID($type) {
362 375
 		$typeid = array_search($type,$this->shiptype);
363
-		if ($typeid !== FALSE) return $typeid;
364
-		elseif ($type == 'Cargo' || $type == 'General Cargo' || $type == 'Bulk Carrier' || $type == 'Container Ship' || $type == 'Cargo A' || $type == 'Reefer' || $type == 'Vehicles Carrier' || $type == 'Ro-Ro Cargo') return 70;
365
-		elseif ($type == 'Passengers Ship' || $type == 'Passenger' || $type == 'Ro-Ro/Passenger Ship' || $type == 'Motor Passenger') return 60;
366
-		elseif ($type == 'Tanker' || $type == 'Crude Oil Tanker' || $type == 'Oil Products Tanker' || $type == 'Oil/Chemical Tanker' || $type == 'Bunkering Tanker') return 80;
367
-		elseif ($type == 'Lpg Tanker' || $type == 'Lng Tanker') return 84;
368
-		elseif ($type == 'Sailing Vessel') return 36;
369
-		elseif ($type == 'Yacht') return 37;
370
-		elseif ($type == 'Trailing Suction Hopper Dredger' || $type == 'Drilling Jack Up' || $type == 'Suction Dredger' || $type == 'Hopper Dredger') return 33;
371
-		elseif ($type == 'High speed craft') return 40;
372
-		elseif ($type == 'Crew Boat') return 53;
373
-		elseif ($type == 'Icebreaker') return 52;
374
-		elseif ($type == 'Pollution Control Vessel') return 54;
375
-		elseif ($type == 'Other Type') return 90;
376
-		elseif ($type == 'Anchor Handling Vessel' || $type == 'Offshore Supply Ship' || $type == 'Research/Survey Vessel' || $type == 'Utility Vessel' || $type == 'Pipe Burying Vessel' || $type == 'Heavy Lift Vessel' || $type == 'Crane Ship' || $type == 'Buoy-laying Vessel') return 59;
377
-		elseif ($type == 'Fish Carrier' || $type == 'Trawler' || $type == 'Trawlers' || $type == 'Fishing Vessel' || $type == 'Trawlers|unknown Not Fishing' || $type == 'Purse Seines|trawlers' || $type == 'Purse Seines' || $type == 'Trollers' || $type == 'Set Longlines' || $type == 'Set Gillnets|trawlers') return 30;
378
-		else return 0;
376
+		if ($typeid !== FALSE) {
377
+			return $typeid;
378
+		} elseif ($type == 'Cargo' || $type == 'General Cargo' || $type == 'Bulk Carrier' || $type == 'Container Ship' || $type == 'Cargo A' || $type == 'Reefer' || $type == 'Vehicles Carrier' || $type == 'Ro-Ro Cargo') {
379
+			return 70;
380
+		} elseif ($type == 'Passengers Ship' || $type == 'Passenger' || $type == 'Ro-Ro/Passenger Ship' || $type == 'Motor Passenger') {
381
+			return 60;
382
+		} elseif ($type == 'Tanker' || $type == 'Crude Oil Tanker' || $type == 'Oil Products Tanker' || $type == 'Oil/Chemical Tanker' || $type == 'Bunkering Tanker') {
383
+			return 80;
384
+		} elseif ($type == 'Lpg Tanker' || $type == 'Lng Tanker') {
385
+			return 84;
386
+		} elseif ($type == 'Sailing Vessel') {
387
+			return 36;
388
+		} elseif ($type == 'Yacht') {
389
+			return 37;
390
+		} elseif ($type == 'Trailing Suction Hopper Dredger' || $type == 'Drilling Jack Up' || $type == 'Suction Dredger' || $type == 'Hopper Dredger') {
391
+			return 33;
392
+		} elseif ($type == 'High speed craft') {
393
+			return 40;
394
+		} elseif ($type == 'Crew Boat') {
395
+			return 53;
396
+		} elseif ($type == 'Icebreaker') {
397
+			return 52;
398
+		} elseif ($type == 'Pollution Control Vessel') {
399
+			return 54;
400
+		} elseif ($type == 'Other Type') {
401
+			return 90;
402
+		} elseif ($type == 'Anchor Handling Vessel' || $type == 'Offshore Supply Ship' || $type == 'Research/Survey Vessel' || $type == 'Utility Vessel' || $type == 'Pipe Burying Vessel' || $type == 'Heavy Lift Vessel' || $type == 'Crane Ship' || $type == 'Buoy-laying Vessel') {
403
+			return 59;
404
+		} elseif ($type == 'Fish Carrier' || $type == 'Trawler' || $type == 'Trawlers' || $type == 'Fishing Vessel' || $type == 'Trawlers|unknown Not Fishing' || $type == 'Purse Seines|trawlers' || $type == 'Purse Seines' || $type == 'Trollers' || $type == 'Set Longlines' || $type == 'Set Gillnets|trawlers') {
405
+			return 30;
406
+		} else {
407
+			return 0;
408
+		}
379 409
 	}
380 410
 
381 411
 	public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) {
@@ -412,11 +442,20 @@  discard block
 block discarded – undo
412 442
 		// assume 1st ! is valid
413 443
 		// find * ensure that it is at correct position
414 444
 		$end = strrpos ( $rawdata , '*' );
415
-		if ($end === FALSE) return -1; // check for NULLS!!!
445
+		if ($end === FALSE) {
446
+			return -1;
447
+		}
448
+		// check for NULLS!!!
416 449
 		$cs = substr( $rawdata, $end + 1 );
417
-		if ( strlen($cs) != 2 ) return -1; // correct cs length
450
+		if ( strlen($cs) != 2 ) {
451
+			return -1;
452
+		}
453
+		// correct cs length
418 454
 		$dcs = (int)hexdec( $cs );
419
-		for ( $alias=1; $alias<$end; $alias++) $chksum ^= ord( $rawdata[$alias] ); // perform XOR for NMEA checksum
455
+		for ( $alias=1; $alias<$end; $alias++) {
456
+			$chksum ^= ord( $rawdata[$alias] );
457
+		}
458
+		// perform XOR for NMEA checksum
420 459
 		if ( $chksum == $dcs ) { // NMEA checksum pass
421 460
 			$pcs = explode(',', $rawdata);
422 461
 			// !AI??? identifier
@@ -427,8 +466,14 @@  discard block
 block discarded – undo
427 466
 			$num_seq = (int)$pcs[1]; // number of sequences
428 467
 			$seq = (int)$pcs[2]; // get sequence
429 468
 			// get msg sequence id
430
-			if ($pcs[3] == '') $msg_sid = -1; // non-multipart message, set to -1
431
-			else $msg_sid = (int)$pcs[3]; // multipart message
469
+			if ($pcs[3] == '') {
470
+				$msg_sid = -1;
471
+			}
472
+			// non-multipart message, set to -1
473
+			else {
474
+				$msg_sid = (int)$pcs[3];
475
+			}
476
+			// multipart message
432 477
 			$ais_ch = $pcs[4]; // get AIS channel
433 478
 			// message sequence checking
434 479
 			if ($num_seq < 1 || $num_seq > 9) {
@@ -491,10 +536,18 @@  discard block
 block discarded – undo
491 536
 				//DEBUG echo "[$start $end $tst]\n";
492 537
 				$result = $this->process_ais_raw( $tst, "" );
493 538
 				$last_pos = $end + 1;
494
-			} else break;
539
+			} else {
540
+				break;
541
+			}
542
+		}
543
+		if ($last_pos > 0) {
544
+			$cbuf = substr($cbuf, $last_pos);
495 545
 		}
496
-		if ($last_pos > 0) $cbuf = substr($cbuf, $last_pos); // move...
497
-		if (strlen($cbuf) > 1024) $cbuf = ""; // prevent overflow simple mode...
546
+		// move...
547
+		if (strlen($cbuf) > 1024) {
548
+			$cbuf = "";
549
+		}
550
+		// prevent overflow simple mode...
498 551
 		return $result;
499 552
 	}
500 553
 
@@ -514,7 +567,9 @@  discard block
 block discarded – undo
514 567
 		if ($lat<0.0) {
515 568
 			$lat = -$lat;
516 569
 			$neg=true;
517
-		} else $neg=false;
570
+		} else {
571
+			$neg=false;
572
+		}
518 573
 		$latd = 0x00000000;
519 574
 		$latd = intval ($lat * 600000.0);
520 575
 		if ($neg==true) {
@@ -530,7 +585,9 @@  discard block
 block discarded – undo
530 585
 		if ($lon<0.0) {
531 586
 			$lon = -$lon;
532 587
 			$neg=true;
533
-		} else $neg=false;
588
+		} else {
589
+			$neg=false;
590
+		}
534 591
 		$lond = 0x00000000;
535 592
 		$lond = intval ($lon * 600000.0);
536 593
 		if ($neg==true) {
@@ -543,9 +600,14 @@  discard block
 block discarded – undo
543 600
 
544 601
 	private function char2bin($name, $max_len) {
545 602
 		$len = strlen($name);
546
-		if ($len > $max_len) $name = substr($name,0,$max_len);
547
-		if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len) * 6);
548
-		else $pad = '';
603
+		if ($len > $max_len) {
604
+			$name = substr($name,0,$max_len);
605
+		}
606
+		if ($len < $max_len) {
607
+			$pad = str_repeat('0', ($max_len - $len) * 6);
608
+		} else {
609
+			$pad = '';
610
+		}
549 611
 		$rv = '';
550 612
 		$ais_chars = array(
551 613
 		    '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
@@ -560,8 +622,11 @@  discard block
 block discarded – undo
560 622
 		$_a = str_split($name);
561 623
 		if (!empty($_a)) {
562 624
 			foreach ($_a as $_1) {
563
-				if (isset($ais_chars[$_1])) $dec = $ais_chars[$_1];
564
-				else $dec = 0;
625
+				if (isset($ais_chars[$_1])) {
626
+					$dec = $ais_chars[$_1];
627
+				} else {
628
+					$dec = 0;
629
+				}
565 630
 				$bin = str_pad(decbin( $dec ), 6, '0', STR_PAD_LEFT);
566 631
 				$rv .= $bin;
567 632
 				//echo "$_1 $dec ($bin)<br/>";
@@ -574,7 +639,9 @@  discard block
 block discarded – undo
574 639
 		$len_bit = strlen($_enc);
575 640
 		$rem6 = $len_bit % 6;
576 641
 		$pad6_len = 0;
577
-		if ($rem6) $pad6_len = 6 - $rem6;
642
+		if ($rem6) {
643
+			$pad6_len = 6 - $rem6;
644
+		}
578 645
 		//echo  $pad6_len.'<br>';
579 646
 		$_enc .= str_repeat("0", $pad6_len); // pad the text...
580 647
 		$len_enc = strlen($_enc) / 6;
@@ -583,8 +650,11 @@  discard block
 block discarded – undo
583 650
 		for ($i=0; $i<$len_enc; $i++) {
584 651
 			$offset = $i * 6;
585 652
 			$dec = bindec(substr($_enc,$offset,6));
586
-			if ($dec < 40) $dec += 48;
587
-			else $dec += 56;
653
+			if ($dec < 40) {
654
+				$dec += 48;
655
+			} else {
656
+				$dec += 56;
657
+			}
588 658
 			//echo chr($dec)." $dec<br/>";
589 659
 			$itu .= chr($dec);
590 660
 		}
@@ -597,26 +667,42 @@  discard block
 block discarded – undo
597 667
 		}
598 668
 		$hex_arr = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
599 669
 		$lsb = $chksum & 0x0F;
600
-		if ($lsb >=0 && $lsb <= 15 ) $lsbc = $hex_arr[$lsb];
601
-		else $lsbc = '0';
670
+		if ($lsb >=0 && $lsb <= 15 ) {
671
+			$lsbc = $hex_arr[$lsb];
672
+		} else {
673
+			$lsbc = '0';
674
+		}
602 675
 		$msb = (($chksum & 0xF0) >> 4) & 0x0F;
603
-		if ($msb >=0 && $msb <= 15 ) $msbc = $hex_arr[$msb];
604
-		else $msbc = '0';
676
+		if ($msb >=0 && $msb <= 15 ) {
677
+			$msbc = $hex_arr[$msb];
678
+		} else {
679
+			$msbc = '0';
680
+		}
605 681
 		$itu = '!'.$itu."*{$msbc}{$lsbc}\r\n";
606 682
 		return $itu;
607 683
 	}
608 684
 
609 685
 	public function parse($buffer) {
610 686
 		$data = $this->process_ais_buf($buffer);
611
-		if (!is_object($data)) return array();
687
+		if (!is_object($data)) {
688
+			return array();
689
+		}
612 690
 		$result = array();
613
-		if ($data->lon != 0) $result['longitude'] = $data->lon;
614
-		if ($data->lat != 0) $result['latitude'] = $data->lat;
691
+		if ($data->lon != 0) {
692
+			$result['longitude'] = $data->lon;
693
+		}
694
+		if ($data->lat != 0) {
695
+			$result['latitude'] = $data->lat;
696
+		}
615 697
 		$result['ident'] = trim($data->name);
616 698
 		$result['timestamp'] = $data->ts;
617 699
 		$result['mmsi'] = $data->mmsi;
618
-		if ($data->sog != -1.0) $result['speed'] = $data->sog;
619
-		if ($data->cog != 0) $result['heading'] = $data->cog;
700
+		if ($data->sog != -1.0) {
701
+			$result['speed'] = $data->sog;
702
+		}
703
+		if ($data->cog != 0) {
704
+			$result['heading'] = $data->cog;
705
+		}
620 706
 		/*
621 707
 		    $ro->cls = 0; // AIS class undefined, also indicate unparsed msg
622 708
 		    $ro->id = bindec(substr($_aisdata,0,6));
@@ -626,15 +712,25 @@  discard block
 block discarded – undo
626 712
 
627 713
 	public function mmsitype($mmsi) {
628 714
 		if (strlen($mmsi) == 9) {
629
-			if (substr($mmsi,0,3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS';
630
-			elseif (substr($mmsi,0,3) == '972') return 'MOB (Man Overboard) device';
631
-			elseif (substr($mmsi,0,3) == '970') return 'AIS SART (Search and Rescue Transmitter)';
632
-			elseif (substr($mmsi,0,3) == '111') return 'SAR (Search and Rescue) aircraft';
633
-			elseif (substr($mmsi,0,2) == '98') return 'Auxiliary craft associated with a parent ship';
634
-			elseif (substr($mmsi,0,2) == '99') return 'Aids to Navigation';
635
-			elseif (substr($mmsi,0,2) == '00') return 'Coastal stations';
636
-			elseif (substr($mmsi,0,1) == '0') return 'Group of ships';
637
-			else return 'Ship';
715
+			if (substr($mmsi,0,3) == '974') {
716
+				return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS';
717
+			} elseif (substr($mmsi,0,3) == '972') {
718
+				return 'MOB (Man Overboard) device';
719
+			} elseif (substr($mmsi,0,3) == '970') {
720
+				return 'AIS SART (Search and Rescue Transmitter)';
721
+			} elseif (substr($mmsi,0,3) == '111') {
722
+				return 'SAR (Search and Rescue) aircraft';
723
+			} elseif (substr($mmsi,0,2) == '98') {
724
+				return 'Auxiliary craft associated with a parent ship';
725
+			} elseif (substr($mmsi,0,2) == '99') {
726
+				return 'Aids to Navigation';
727
+			} elseif (substr($mmsi,0,2) == '00') {
728
+				return 'Coastal stations';
729
+			} elseif (substr($mmsi,0,1) == '0') {
730
+				return 'Group of ships';
731
+			} else {
732
+				return 'Ship';
733
+			}
638 734
 		}
639 735
 
640 736
 	
@@ -650,32 +746,61 @@  discard block
 block discarded – undo
650 746
 			//if ($globalDebug) echo '==== Line format not supported : '.$buffer."\n";
651 747
 			return array();
652 748
 		}
653
-		if ($data->lon != 0) $result['longitude'] = $data->lon;
654
-		if ($data->lat != 0) $result['latitude'] = $data->lat;
749
+		if ($data->lon != 0) {
750
+			$result['longitude'] = $data->lon;
751
+		}
752
+		if ($data->lat != 0) {
753
+			$result['latitude'] = $data->lat;
754
+		}
655 755
 		$result['ident'] = trim(str_replace('@','',$data->name));
656 756
 		$result['timestamp'] = $data->ts;
657 757
 		$result['mmsi'] = $data->mmsi;
658
-		if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') $result['mmsi'] = '3'.$result['mmsi'];
758
+		if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') {
759
+			$result['mmsi'] = '3'.$result['mmsi'];
760
+		}
659 761
 		$result['mmsi_type'] = $this->mmsitype($result['mmsi']);
660
-		if ($data->sog != -1.0) $result['speed'] = $data->sog;
661
-		if ($data->heading !== '') $result['heading'] = $data->heading;
662
-		elseif ($data->cog != 0) $result['heading'] = $data->cog;
663
-		if ($data->status != '') $result['status'] = $data->status;
664
-		if ($data->statusid !== '') $result['statusid'] = $data->statusid;
665
-		if ($data->type !== '') $result['type'] = $data->type;
666
-		if ($data->typeid !== '') $result['typeid'] = $data->typeid;
667
-		if ($data->imo !== '') $result['imo'] = $data->imo;
668
-		if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@','',$data->callsign));
762
+		if ($data->sog != -1.0) {
763
+			$result['speed'] = $data->sog;
764
+		}
765
+		if ($data->heading !== '') {
766
+			$result['heading'] = $data->heading;
767
+		} elseif ($data->cog != 0) {
768
+			$result['heading'] = $data->cog;
769
+		}
770
+		if ($data->status != '') {
771
+			$result['status'] = $data->status;
772
+		}
773
+		if ($data->statusid !== '') {
774
+			$result['statusid'] = $data->statusid;
775
+		}
776
+		if ($data->type !== '') {
777
+			$result['type'] = $data->type;
778
+		}
779
+		if ($data->typeid !== '') {
780
+			$result['typeid'] = $data->typeid;
781
+		}
782
+		if ($data->imo !== '') {
783
+			$result['imo'] = $data->imo;
784
+		}
785
+		if ($data->callsign !== '') {
786
+			$result['callsign'] = trim(str_replace('@','',$data->callsign));
787
+		}
669 788
 		if (is_numeric($data->eta_month) && $data->eta_month != 0 && is_numeric($data->eta_day) && $data->eta_day != 0 && $data->eta_hour !== '' && $data->eta_minute !== '') {
670 789
 			$eta_ts = strtotime(date('Y').'-'.sprintf("%02d",$data->eta_month).'-'.sprintf("%02d",$data->eta_day).' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00');
671
-			if ($eta_ts != '') $result['eta_ts'] = $eta_ts;
790
+			if ($eta_ts != '') {
791
+				$result['eta_ts'] = $eta_ts;
792
+			}
672 793
 		} elseif (is_numeric($data->eta_hour) && is_numeric($data->eta_minute)) {
673 794
 			$eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00');
674
-			if ($eta_ts != '') $result['eta_ts'] = $eta_ts;
795
+			if ($eta_ts != '') {
796
+				$result['eta_ts'] = $eta_ts;
797
+			}
675 798
 		}
676 799
 		if ($data->destination != '') {
677 800
 			$dest = trim(str_replace('@','',$data->destination));
678
-			if ($dest != '') $result['destination'] = $dest;
801
+			if ($dest != '') {
802
+				$result['destination'] = $dest;
803
+			}
679 804
 		}
680 805
 		$result['all'] = (array) $data;
681 806
 		/*
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Braces   +364 added lines, -147 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 $tracker = false;
13 13
 $marine = false;
14 14
 $usecoord = false;
15
-if (isset($_GET['test'])) exit();
15
+if (isset($_GET['test'])) {
16
+	exit();
17
+}
16 18
 if (isset($_GET['tracker'])) {
17 19
     $tracker = true;
18 20
 }
@@ -57,31 +59,62 @@  discard block
 block discarded – undo
57 59
 }
58 60
 header('Content-Type: text/javascript');
59 61
 
60
-if (!isset($globalJsonCompress)) $compress = true;
61
-else $compress = $globalJsonCompress;
62
+if (!isset($globalJsonCompress)) {
63
+	$compress = true;
64
+} else {
65
+	$compress = $globalJsonCompress;
66
+}
62 67
 
63 68
 $limit = 0;
64 69
 $from_archive = false;
65 70
 $min = true;
66 71
 $allhistory = false;
67 72
 $filter['source'] = array();
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
70
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
72
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
73
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
78
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
79
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
80
-if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true;
73
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
74
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
75
+}
76
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
77
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
78
+}
79
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
80
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
81
+}
82
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
83
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
84
+}
85
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
86
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
87
+}
88
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
89
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
90
+}
91
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
92
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
93
+}
94
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
95
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
96
+}
97
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
98
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
99
+}
100
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
101
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
102
+}
103
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
104
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
105
+}
106
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') {
107
+	$filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
108
+}
109
+if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') {
110
+	$filter['blocked'] = true;
111
+}
81 112
 
82 113
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
83 114
 	$min = true;
84
-} else $min = false;
115
+} else {
116
+	$min = false;
117
+}
85 118
 
86 119
 
87 120
 if (isset($_COOKIE['map_2d_limit'])) {
@@ -197,24 +230,38 @@  discard block
 block discarded – undo
197 230
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
198 231
 		}
199 232
 	}
200
-	if ($flightcnt == '') $flightcnt = 0;
201
-} else $flightcnt = 0;
233
+	if ($flightcnt == '') {
234
+		$flightcnt = 0;
235
+	}
236
+	} else {
237
+	$flightcnt = 0;
238
+}
202 239
 
203 240
 $sqltime = round(microtime(true)-$begintime,2);
204 241
 
205 242
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
206
-if ($currenttime != '') $currenttime = round($currenttime/1000);
243
+if ($currenttime != '') {
244
+	$currenttime = round($currenttime/1000);
245
+}
207 246
 
208
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation === FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
209
-else $usenextlatlon = true;
210
-if ($usenextlatlon === false) $currenttime = '';
247
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation === FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
248
+	$usenextlatlon = false;
249
+} else {
250
+	$usenextlatlon = true;
251
+}
252
+if ($usenextlatlon === false) {
253
+	$currenttime = '';
254
+}
211 255
 $j = 0;
212 256
 $prev_flightaware_id = '';
213 257
 $aircrafts_shadow = array();
214 258
 $output = '{';
215 259
 	$output .= '"type": "FeatureCollection",';
216
-		if ($min) $output .= '"minimal": "true",';
217
-		else $output .= '"minimal": "false",';
260
+		if ($min) {
261
+			$output .= '"minimal": "true",';
262
+		} else {
263
+			$output .= '"minimal": "false",';
264
+		}
218 265
 		//$output .= '"fc": "'.$flightcnt.'",';
219 266
 		$output .= '"sqt": "'.$sqltime.'",';
220 267
 
@@ -259,18 +306,29 @@  discard block
 block discarded – undo
259 306
 						}
260 307
 						$output .= '"properties": {';
261 308
 						if (isset($spotter_item['flightaware_id'])) {
262
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
263
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
309
+							if ($compress) {
310
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
311
+							} else {
312
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
313
+							}
264 314
 						} elseif (isset($spotter_item['famtrackid'])) {
265
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
266
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
315
+							if ($compress) {
316
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
317
+							} else {
318
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
319
+							}
267 320
 						} elseif (isset($spotter_item['fammarine_id'])) {
268
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
269
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
321
+							if ($compress) {
322
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
323
+							} else {
324
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
325
+							}
270 326
 						}
271 327
 						$output .= '"fc": "'.$flightcnt.'",';
272 328
 						$output .= '"sqt": "'.$sqltime.'",';
273
-						if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
329
+						if (isset($begindate)) {
330
+							$output .= '"archive_date": "'.$begindate.'",';
331
+						}
274 332
 
275 333
 /*
276 334
 							if ($min) $output .= '"minimal": "true",';
@@ -278,16 +336,25 @@  discard block
 block discarded – undo
278 336
 */
279 337
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
280 338
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
281
-							if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
282
-							else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
339
+							if ($compress) {
340
+								$output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
341
+							} else {
342
+								$output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
343
+							}
283 344
 							//'
284 345
 						} else {
285
-							if ($compress) $output .= '"c": "NA",';
286
-							else $output .= '"callsign": "NA",';
346
+							if ($compress) {
347
+								$output .= '"c": "NA",';
348
+							} else {
349
+								$output .= '"callsign": "NA",';
350
+							}
287 351
 						}
288 352
 						if (isset($spotter_item['registration'])) {
289
-							if ($compress) $output .= '"reg": '.json_encode($spotter_item['registration']).',';
290
-							else $output .= '"registration": '.json_encode($spotter_item['registration']).',';
353
+							if ($compress) {
354
+								$output .= '"reg": '.json_encode($spotter_item['registration']).',';
355
+							} else {
356
+								$output .= '"registration": '.json_encode($spotter_item['registration']).',';
357
+							}
291 358
 						}
292 359
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
293 360
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
@@ -298,20 +365,30 @@  discard block
 block discarded – undo
298 365
 							$output .= '"aircraft_name": "NA",';
299 366
 						}
300 367
 						if (isset($spotter_item['aircraft_icao'])) {
301
-							if ($compress) $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",';
302
-							else $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
368
+							if ($compress) {
369
+								$output .= '"ai": "'.$spotter_item['aircraft_icao'].'",';
370
+							} else {
371
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
372
+							}
303 373
 						}
304 374
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) {
305
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
306
-							else {
375
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
376
+								$spotter_item['aircraft_shadow'] = '';
377
+							} else {
307 378
 								$aircraft_icao = $spotter_item['aircraft_icao'];
308
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
309
-								else {
379
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
380
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
381
+								} else {
310 382
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
311
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
312
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
313
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
314
-									else $spotter_item['aircraft_shadow'] = '';
383
+									if (count($aircraft_info) > 0) {
384
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
385
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
386
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
387
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
388
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
389
+									} else {
390
+										$spotter_item['aircraft_shadow'] = '';
391
+									}
315 392
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
316 393
 								}
317 394
 							}
@@ -319,90 +396,171 @@  discard block
 block discarded – undo
319 396
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
320 397
 							if ($tracker) {
321 398
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
322
-									if ($compress) $output .= '"as": "ambulance.png",';
323
-									else $output .= '"aircraft_shadow": "ambulance.png",';
399
+									if ($compress) {
400
+										$output .= '"as": "ambulance.png",';
401
+									} else {
402
+										$output .= '"aircraft_shadow": "ambulance.png",';
403
+									}
324 404
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
325
-									if ($compress) $output .= '"as": "police.png",';
326
-									else $output .= '"aircraft_shadow": "police.png",';
405
+									if ($compress) {
406
+										$output .= '"as": "police.png",';
407
+									} else {
408
+										$output .= '"aircraft_shadow": "police.png",';
409
+									}
327 410
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
328
-									if ($compress) $output .= '"as": "ship.png",';
329
-									else $output .= '"aircraft_shadow": "ship.png",';
411
+									if ($compress) {
412
+										$output .= '"as": "ship.png",';
413
+									} else {
414
+										$output .= '"aircraft_shadow": "ship.png",';
415
+									}
330 416
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
331
-									if ($compress) $output .= '"as": "ship.png",';
332
-									else $output .= '"aircraft_shadow": "ship.png",';
417
+									if ($compress) {
418
+										$output .= '"as": "ship.png",';
419
+									} else {
420
+										$output .= '"aircraft_shadow": "ship.png",';
421
+									}
333 422
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
334
-									if ($compress) $output .= '"as": "ship.png",';
335
-									else $output .= '"aircraft_shadow": "ship.png",';
423
+									if ($compress) {
424
+										$output .= '"as": "ship.png",';
425
+									} else {
426
+										$output .= '"aircraft_shadow": "ship.png",';
427
+									}
336 428
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
337
-									if ($compress) $output .= '"as": "truck.png",';
338
-									else $output .= '"aircraft_shadow": "truck.png",';
429
+									if ($compress) {
430
+										$output .= '"as": "truck.png",';
431
+									} else {
432
+										$output .= '"aircraft_shadow": "truck.png",';
433
+									}
339 434
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
340
-									if ($compress) $output .= '"as": "truck.png",';
341
-									else $output .= '"aircraft_shadow": "truck.png",';
435
+									if ($compress) {
436
+										$output .= '"as": "truck.png",';
437
+									} else {
438
+										$output .= '"aircraft_shadow": "truck.png",';
439
+									}
342 440
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
343
-									if ($compress) $output .= '"as": "aircraft.png",';
344
-									else $output .= '"aircraft_shadow": "aircraft.png",';
441
+									if ($compress) {
442
+										$output .= '"as": "aircraft.png",';
443
+									} else {
444
+										$output .= '"aircraft_shadow": "aircraft.png",';
445
+									}
345 446
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
346
-									if ($compress) $output .= '"as": "aircraft.png",';
347
-									else $output .= '"aircraft_shadow": "aircraft.png",';
447
+									if ($compress) {
448
+										$output .= '"as": "aircraft.png",';
449
+									} else {
450
+										$output .= '"aircraft_shadow": "aircraft.png",';
451
+									}
348 452
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
349
-									if ($compress) $output .= '"as": "helico.png",';
350
-									else $output .= '"aircraft_shadow": "helico.png",';
453
+									if ($compress) {
454
+										$output .= '"as": "helico.png",';
455
+									} else {
456
+										$output .= '"aircraft_shadow": "helico.png",';
457
+									}
351 458
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
352
-									if ($compress) $output .= '"as": "rail.png",';
353
-									else $output .= '"aircraft_shadow": "rail.png",';
459
+									if ($compress) {
460
+										$output .= '"as": "rail.png",';
461
+									} else {
462
+										$output .= '"aircraft_shadow": "rail.png",';
463
+									}
354 464
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
355
-									if ($compress) $output .= '"as": "firetruck.png",';
356
-									else $output .= '"aircraft_shadow": "firetruck.png",';
465
+									if ($compress) {
466
+										$output .= '"as": "firetruck.png",';
467
+									} else {
468
+										$output .= '"aircraft_shadow": "firetruck.png",';
469
+									}
357 470
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
358
-									if ($compress) $output .= '"as": "bus.png",';
359
-									else $output .= '"aircraft_shadow": "bus.png",';
471
+									if ($compress) {
472
+										$output .= '"as": "bus.png",';
473
+									} else {
474
+										$output .= '"aircraft_shadow": "bus.png",';
475
+									}
360 476
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
361
-									if ($compress) $output .= '"as": "phone.png",';
362
-									else $output .= '"aircraft_shadow": "phone.png",';
477
+									if ($compress) {
478
+										$output .= '"as": "phone.png",';
479
+									} else {
480
+										$output .= '"aircraft_shadow": "phone.png",';
481
+									}
363 482
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
364
-									if ($compress) $output .= '"as": "jogger.png",';
365
-									else $output .= '"aircraft_shadow": "jogger.png",';
483
+									if ($compress) {
484
+										$output .= '"as": "jogger.png",';
485
+									} else {
486
+										$output .= '"aircraft_shadow": "jogger.png",';
487
+									}
366 488
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
367
-									if ($compress) $output .= '"as": "bike.png",';
368
-									else $output .= '"aircraft_shadow": "bike.png",';
489
+									if ($compress) {
490
+										$output .= '"as": "bike.png",';
491
+									} else {
492
+										$output .= '"aircraft_shadow": "bike.png",';
493
+									}
369 494
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
370
-									if ($compress) $output .= '"as": "motorcycle.png",';
371
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
495
+									if ($compress) {
496
+										$output .= '"as": "motorcycle.png",';
497
+									} else {
498
+										$output .= '"aircraft_shadow": "motorcycle.png",';
499
+									}
372 500
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
373
-									if ($compress) $output .= '"as": "balloon.png",';
374
-									else $output .= '"aircraft_shadow": "balloon.png",';
501
+									if ($compress) {
502
+										$output .= '"as": "balloon.png",';
503
+									} else {
504
+										$output .= '"aircraft_shadow": "balloon.png",';
505
+									}
375 506
 								} else {
376
-									if ($compress) $output .= '"as": "car.png",';
377
-									else $output .= '"aircraft_shadow": "car.png",';
507
+									if ($compress) {
508
+										$output .= '"as": "car.png",';
509
+									} else {
510
+										$output .= '"aircraft_shadow": "car.png",';
511
+									}
378 512
 								}
379 513
 							} elseif ($marine) {
380 514
 								if (isset($spotter_item['type']) && ($spotter_item['type']  == '50&#39; Performance Cruiser' || $spotter_item['type']  == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
381
-									if ($compress) $output .= '"as": "50perfcruiser.png",';
382
-									else $output .= '"aircraft_shadow": "50perfcruiser.png",';
515
+									if ($compress) {
516
+										$output .= '"as": "50perfcruiser.png",';
517
+									} else {
518
+										$output .= '"aircraft_shadow": "50perfcruiser.png",';
519
+									}
383 520
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Sailaway Cruiser 38') {
384
-									if ($compress) $output .= '"as": "cruiser38.png",';
385
-									else $output .= '"aircraft_shadow": "cruiser38.png",';
521
+									if ($compress) {
522
+										$output .= '"as": "cruiser38.png",';
523
+									} else {
524
+										$output .= '"aircraft_shadow": "cruiser38.png",';
525
+									}
386 526
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Mini Transat') {
387
-									if ($compress) $output .= '"as": "transat.png",';
388
-									else $output .= '"aircraft_shadow": "transat.png",';
527
+									if ($compress) {
528
+										$output .= '"as": "transat.png",';
529
+									} else {
530
+										$output .= '"aircraft_shadow": "transat.png",';
531
+									}
389 532
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == '52&#39; Cruising Cat') {
390
-									if ($compress) $output .= '"as": "catamaran.png",';
391
-									else $output .= '"aircraft_shadow": "catamaran.png",';
533
+									if ($compress) {
534
+										$output .= '"as": "catamaran.png",';
535
+									} else {
536
+										$output .= '"aircraft_shadow": "catamaran.png",';
537
+									}
392 538
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Caribbean Rose') {
393
-									if ($compress) $output .= '"as": "carib.png",';
394
-									else $output .= '"aircraft_shadow": "carib.png",';
539
+									if ($compress) {
540
+										$output .= '"as": "carib.png",';
541
+									} else {
542
+										$output .= '"aircraft_shadow": "carib.png",';
543
+									}
395 544
 								} else {
396
-									if ($compress) $output .= '"as": "ship.png",';
397
-									else $output .= '"aircraft_shadow": "ship.png",';
545
+									if ($compress) {
546
+										$output .= '"as": "ship.png",';
547
+									} else {
548
+										$output .= '"aircraft_shadow": "ship.png",';
549
+									}
398 550
 								}
399 551
 							} else {
400
-								if ($compress) $output .= '"as": "default.png",';
401
-								else $output .= '"aircraft_shadow": "default.png",';
552
+								if ($compress) {
553
+									$output .= '"as": "default.png",';
554
+								} else {
555
+									$output .= '"aircraft_shadow": "default.png",';
556
+								}
402 557
 							}
403 558
 						} else {
404
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
405
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
559
+							if ($compress) {
560
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
561
+							} else {
562
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
563
+							}
406 564
 						}
407 565
 						if (isset($spotter_item['airline_name'])) {
408 566
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -410,8 +568,11 @@  discard block
 block discarded – undo
410 568
 							$output .= '"airline_name": "NA",';
411 569
 						}
412 570
 						if (isset($spotter_item['departure_airport'])) {
413
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
414
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
571
+							if ($compress) {
572
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
573
+							} else {
574
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
575
+							}
415 576
 						}
416 577
 						if (isset($spotter_item['departure_airport_city'])) {
417 578
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -423,8 +584,11 @@  discard block
 block discarded – undo
423 584
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
424 585
 						}
425 586
 						if (isset($spotter_item['arrival_airport'])) {
426
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
427
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
587
+							if ($compress) {
588
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
589
+							} else {
590
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
591
+							}
428 592
 						}
429 593
 						if (isset($spotter_item['arrival_airport_city'])) {
430 594
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -443,11 +607,17 @@  discard block
 block discarded – undo
443 607
 						}
444 608
 						
445 609
 						if (isset($spotter_item['real_altitude'])) {
446
-							if ($compress) $output .= '"a": "'.($spotter_item['real_altitude']/100).'",';
447
-							else $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",';
610
+							if ($compress) {
611
+								$output .= '"a": "'.($spotter_item['real_altitude']/100).'",';
612
+							} else {
613
+								$output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",';
614
+							}
448 615
 						} elseif (isset($spotter_item['altitude'])) {
449
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
450
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
616
+							if ($compress) {
617
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
618
+							} else {
619
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
620
+							}
451 621
 						}
452 622
 						
453 623
 						$heading = $spotter_item['heading'];
@@ -471,19 +641,24 @@  discard block
 block discarded – undo
471 641
 							}
472 642
 						}
473 643
 						
474
-						if ($compress)$output .= '"h": "'.$heading.'",';
475
-						else $output .= '"heading": "'.$heading.'",';
644
+						if ($compress) {
645
+							$output .= '"h": "'.$heading.'",';
646
+						} else {
647
+							$output .= '"heading": "'.$heading.'",';
648
+						}
476 649
 						if ($currenttime != '') {
477 650
 							if (strtotime($spotter_item['date']) < $currenttime) {
478 651
 								if (isset($archivespeed)) {
479 652
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
480 653
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
481
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
482
-									else {
654
+									if (!isset($idistance) || $fdistance < $idistance) {
655
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
656
+									} else {
483 657
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
484 658
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
485
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
486
-										else {
659
+										if (!isset($idistance) || $fdistance < $idistance) {
660
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
661
+										} else {
487 662
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
488 663
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
489 664
 										}
@@ -491,12 +666,14 @@  discard block
 block discarded – undo
491 666
 								} elseif ($usenextlatlon) {
492 667
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
493 668
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
494
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
495
-									else {
669
+									if (!isset($idistance) || $fdistance < $idistance) {
670
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
671
+									} else {
496 672
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
497 673
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
498
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
499
-										else {
674
+										if (!isset($idistance) || $fdistance < $idistance) {
675
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
676
+										} else {
500 677
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
501 678
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
502 679
 										}
@@ -535,7 +712,9 @@  discard block
 block discarded – undo
535 712
 							}
536 713
 						}
537 714
 
538
-						if (!$min) $output .= '"image": "'.$image.'",';
715
+						if (!$min) {
716
+							$output .= '"image": "'.$image.'",';
717
+						}
539 718
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
540 719
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
541 720
 						}
@@ -543,8 +722,11 @@  discard block
 block discarded – undo
543 722
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
544 723
 						}
545 724
 						if (isset($spotter_item['squawk'])) {
546
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
547
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
725
+							if ($compress) {
726
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
727
+							} else {
728
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
729
+							}
548 730
 						}
549 731
 						if (isset($spotter_item['squawk_usage'])) {
550 732
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -575,14 +757,23 @@  discard block
 block discarded – undo
575 757
 						}
576 758
 						// type when not aircraft ?
577 759
 						if (isset($spotter_item['type'])) {
578
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
579
-							else $output .= '"type": "'.$spotter_item['type'].'"';
760
+							if ($compress) {
761
+								$output .= '"t": "'.$spotter_item['type'].'"';
762
+							} else {
763
+								$output .= '"type": "'.$spotter_item['type'].'"';
764
+							}
580 765
 						} elseif ($marine) {
581
-							if ($compress) $output .= '"t": "ship"';
582
-							else $output .= '"type": "ship"';
766
+							if ($compress) {
767
+								$output .= '"t": "ship"';
768
+							} else {
769
+								$output .= '"type": "ship"';
770
+							}
583 771
 						} else {
584
-							if ($compress) $output .= '"t": "aircraft"';
585
-							else $output .= '"type": "aircraft"';
772
+							if ($compress) {
773
+								$output .= '"t": "aircraft"';
774
+							} else {
775
+								$output .= '"type": "aircraft"';
776
+							}
586 777
 						}
587 778
 						$output .= '},';
588 779
 						$output .= '"geometry": {';
@@ -590,15 +781,19 @@  discard block
 block discarded – undo
590 781
 								$output .= '"coordinates": [';
591 782
 								if ($currenttime != '') {
592 783
 									if (strtotime($spotter_item['date']) < $currenttime) {
593
-										if (!isset($archivespeed)) $archivespeed = 1;
784
+										if (!isset($archivespeed)) {
785
+											$archivespeed = 1;
786
+										}
594 787
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
595 788
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
596
-										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
597
-										else {
789
+										if (!isset($idistance) || $fdistance < $idistance) {
790
+											$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
791
+										} else {
598 792
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
599 793
 											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
600
-											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
601
-											else {
794
+											if (!isset($idistance) || $fdistance < $idistance) {
795
+												$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
796
+											} else {
602 797
 												$output .= $spotter_item['longitude'].', ';
603 798
 												$output .= $spotter_item['latitude'];
604 799
 											}
@@ -676,7 +871,9 @@  discard block
 block discarded – undo
676 871
 			}
677 872
 */
678 873
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
679
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
874
+				if ($history == '' && isset($_COOKIE['history'])) {
875
+					$history = $_COOKIE['history'];
876
+				}
680 877
 				
681 878
 				if (
682 879
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -746,8 +943,11 @@  discard block
 block discarded – undo
746 943
 									$output_history .= ']}},';
747 944
 									$output .= $output_history;
748 945
 								}
749
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
750
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
946
+								if ($compress) {
947
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
948
+								} else {
949
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
950
+								}
751 951
 							}
752 952
 							$output_history .= '[';
753 953
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -768,10 +968,15 @@  discard block
 block discarded – undo
768 968
 							if ($d === false) {
769 969
 								if ($compress) {
770 970
 									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",';
771
-									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
772
-									elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
971
+									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') {
972
+										$output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
973
+									} elseif (isset($spotter_history_array[0]['mapmatching_engine'])) {
974
+										$output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
975
+									}
773 976
 									$output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": [';
774
-								} else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
977
+								} else {
978
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
979
+								}
775 980
 								$d = true;
776 981
 							}
777 982
 							$output_history .= '[';
@@ -794,7 +999,9 @@  discard block
 block discarded – undo
794 999
 							$output_historyd = '[';
795 1000
 							$output_historyd .=  $spotter_item['longitude'].', ';
796 1001
 							$output_historyd .=  $spotter_item['latitude'];
797
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
1002
+							if (isset($spotter_history['altitude'])) {
1003
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
1004
+							}
798 1005
 							$output_historyd .= '],';
799 1006
 							//$output_history = $output_historyd.$output_history;
800 1007
 							$output_history = $output_history.$output_historyd;
@@ -822,8 +1029,11 @@  discard block
 block discarded – undo
822 1029
 				        && $spotter_item['arrival_airport'] != 'NA' 
823 1030
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
824 1031
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
825
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
826
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
1032
+				    if ($compress) {
1033
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
1034
+				    } else {
1035
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
1036
+				    }
827 1037
 				    if (isset($spotter_item['departure_airport_latitude'])) {
828 1038
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
829 1039
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -856,8 +1066,11 @@  discard block
 block discarded – undo
856 1066
 				    	    || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
857 1067
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
858 1068
 				    $havedata = false;
859
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
860
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1069
+				    if ($compress) {
1070
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1071
+				    } else {
1072
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1073
+				    }
861 1074
 				    
862 1075
 				    //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
863 1076
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -882,7 +1095,9 @@  discard block
 block discarded – undo
882 1095
 					$output_dest  = substr($output_dest, 0, -1);
883 1096
 				    }
884 1097
 				    $output_dest .= ']}},';
885
-				    if ($havedata) $output .= $output_dest;
1098
+				    if ($havedata) {
1099
+				    	$output .= $output_dest;
1100
+				    }
886 1101
 				    unset($output_dest);
887 1102
 				}
888 1103
 			}
@@ -890,7 +1105,9 @@  discard block
 block discarded – undo
890 1105
 			$output .= ']';
891 1106
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
892 1107
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
893
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
1108
+			if (isset($begindate)) {
1109
+				$output .= '"archive_date": "'.$begindate.'",';
1110
+			}
894 1111
 			$output .= '"fc": "'.$j.'"';
895 1112
 		} else {
896 1113
 			$output .= '"features": ';
Please login to merge, or discard this patch.
require/class.SBS.php 1 patch
Braces   +249 added lines, -87 removed lines patch added patch discarded remove patch
@@ -19,10 +19,15 @@  discard block
 block discarded – undo
19 19
 		// Not yet finished, no CRC checks
20 20
 		$data = array();
21 21
 		$typehex = substr($buffer,0,1);
22
-		if ($typehex == '*' || $typehex == ':') $hex = substr($buffer,1);
22
+		if ($typehex == '*' || $typehex == ':') {
23
+			$hex = substr($buffer,1);
24
+		}
23 25
 		//elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer,13,-13);
24
-		elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer,13,-1);
25
-		else $hex = substr($buffer,1,-1);
26
+		elseif ($typehex == '@' || $typehex == '%') {
27
+			$hex = substr($buffer,13,-1);
28
+		} else {
29
+			$hex = substr($buffer,1,-1);
30
+		}
26 31
 		$bin = gmp_strval( gmp_init($hex,16), 2);
27 32
 		//if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) {
28 33
 		//if (strlen($hex) == 28) {
@@ -90,8 +95,9 @@  discard block
 block discarded – undo
90 95
 					//  131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits.
91 96
 					$cprlat = intval(substr($bin,54,17),2)/131072.0;
92 97
 					$cprlon = intval(substr($bin,71,17),2)/131072.0;
93
-					if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time());
94
-					elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) {
98
+					if ($oe == 0) {
99
+						$this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time());
100
+					} elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) {
95 101
 						$cprlat_odd = $cprlat;
96 102
 						$cprlon_odd = $cprlon;
97 103
 						$cprlat_even = $this::$latlon[$icao]['latitude'];
@@ -99,8 +105,12 @@  discard block
 block discarded – undo
99 105
 						$j = 59*$cprlat_even-60*$cprlat_odd+0.5;
100 106
 						$lat_even = (360.0/60)*($j%60+$cprlat_even);
101 107
 						$lat_odd = (360.0/59)*($j%59+$cprlat_odd);
102
-						if ($lat_even >= 270) $lat_even = $lat_even - 360;
103
-						if ($lat_odd >= 270) $lat_odd = $lat_odd - 360;
108
+						if ($lat_even >= 270) {
109
+							$lat_even = $lat_even - 360;
110
+						}
111
+						if ($lat_odd >= 270) {
112
+							$lat_odd = $lat_odd - 360;
113
+						}
104 114
 						// check latitude zone
105 115
 						if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) {
106 116
 							if ($this::$latlon[$icao]['created'] > time()) {
@@ -108,7 +118,9 @@  discard block
 block discarded – undo
108 118
 								$m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5);
109 119
 								$lon = (360.0/$ni)*($m%$ni+$cprlon_even);
110 120
 								$lat = $lat_even;
111
-								if ($lon > 180) $lon = $lon -360;
121
+								if ($lon > 180) {
122
+									$lon = $lon -360;
123
+								}
112 124
 								if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) {
113 125
 									//if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon;
114 126
 									$data['latitude'] = $lat;
@@ -119,14 +131,18 @@  discard block
 block discarded – undo
119 131
 								$m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5);
120 132
 								$lon = (360.0/$ni)*($m%$ni+$cprlon_odd);
121 133
 								$lat = $lat_odd;
122
-								if ($lon > 180) $lon = $lon -360;
134
+								if ($lon > 180) {
135
+									$lon = $lon -360;
136
+								}
123 137
 								if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) {
124 138
 									//if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n";
125 139
 									$data['latitude'] = $lat;
126 140
 									$data['longitude'] = $lon;
127 141
 								}
128 142
 							}
129
-						} else echo "Not cprNL";
143
+						} else {
144
+							echo "Not cprNL";
145
+						}
130 146
 						unset($this::$latlon[$icao]);
131 147
 					}
132 148
 				} elseif ($tc == 19) {
@@ -135,11 +151,17 @@  discard block
 block discarded – undo
135 151
 					$v_ew = intval(substr($bin,46,10),2);
136 152
 					$v_ns_dir = intval(substr($bin,56,1));
137 153
 					$v_ns = intval(substr($bin,57,10),2);
138
-					if ($v_ew_dir) $v_ew = -1*$v_ew;
139
-					if ($v_ns_dir) $v_ns = -1*$v_ns;
154
+					if ($v_ew_dir) {
155
+						$v_ew = -1*$v_ew;
156
+					}
157
+					if ($v_ns_dir) {
158
+						$v_ns = -1*$v_ns;
159
+					}
140 160
 					$speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew);
141 161
 					$heading = atan2($v_ew,$v_ns)*360.0/(2*pi());
142
-					if ($heading <0) $heading = $heading+360;
162
+					if ($heading <0) {
163
+						$heading = $heading+360;
164
+					}
143 165
 					$data['speed'] = $speed;
144 166
 					$data['heading'] = $heading;
145 167
 				}
@@ -154,72 +176,194 @@  discard block
 block discarded – undo
154 176
 	 * Lookup table to convert the latitude to index.
155 177
 	*/
156 178
 	private function cprNL($lat) {
157
-		if ($lat < 0) $lat = -$lat;             // Table is simmetric about the equator.
158
-		if ($lat < 10.47047130) return 59;
159
-		if ($lat < 14.82817437) return 58;
160
-		if ($lat < 18.18626357) return 57;
161
-		if ($lat < 21.02939493) return 56;
162
-		if ($lat < 23.54504487) return 55;
163
-		if ($lat < 25.82924707) return 54;
164
-		if ($lat < 27.93898710) return 53;
165
-		if ($lat < 29.91135686) return 52;
166
-		if ($lat < 31.77209708) return 51;
167
-		if ($lat < 33.53993436) return 50;
168
-		if ($lat < 35.22899598) return 49;
169
-		if ($lat < 36.85025108) return 48;
170
-		if ($lat < 38.41241892) return 47;
171
-		if ($lat < 39.92256684) return 46;
172
-		if ($lat < 41.38651832) return 45;
173
-		if ($lat < 42.80914012) return 44;
174
-		if ($lat < 44.19454951) return 43;
175
-		if ($lat < 45.54626723) return 42;
176
-		if ($lat < 46.86733252) return 41;
177
-		if ($lat < 48.16039128) return 40;
178
-		if ($lat < 49.42776439) return 39;
179
-		if ($lat < 50.67150166) return 38;
180
-		if ($lat < 51.89342469) return 37;
181
-		if ($lat < 53.09516153) return 36;
182
-		if ($lat < 54.27817472) return 35;
183
-		if ($lat < 55.44378444) return 34;
184
-		if ($lat < 56.59318756) return 33;
185
-		if ($lat < 57.72747354) return 32;
186
-		if ($lat < 58.84763776) return 31;
187
-		if ($lat < 59.95459277) return 30;
188
-		if ($lat < 61.04917774) return 29;
189
-		if ($lat < 62.13216659) return 28;
190
-		if ($lat < 63.20427479) return 27;
191
-		if ($lat < 64.26616523) return 26;
192
-		if ($lat < 65.31845310) return 25;
193
-		if ($lat < 66.36171008) return 24;
194
-		if ($lat < 67.39646774) return 23;
195
-		if ($lat < 68.42322022) return 22;
196
-		if ($lat < 69.44242631) return 21;
197
-		if ($lat < 70.45451075) return 20;
198
-		if ($lat < 71.45986473) return 19;
199
-		if ($lat < 72.45884545) return 18;
200
-		if ($lat < 73.45177442) return 17;
201
-		if ($lat < 74.43893416) return 16;
202
-		if ($lat < 75.42056257) return 15;
203
-		if ($lat < 76.39684391) return 14;
204
-		if ($lat < 77.36789461) return 13;
205
-		if ($lat < 78.33374083) return 12;
206
-		if ($lat < 79.29428225) return 11;
207
-		if ($lat < 80.24923213) return 10;
208
-		if ($lat < 81.19801349) return 9;
209
-		if ($lat < 82.13956981) return 8;
210
-		if ($lat < 83.07199445) return 7;
211
-		if ($lat < 83.99173563) return 6;
212
-		if ($lat < 84.89166191) return 5;
213
-		if ($lat < 85.75541621) return 4;
214
-		if ($lat < 86.53536998) return 3;
215
-		if ($lat < 87.00000000) return 2;
179
+		if ($lat < 0) {
180
+			$lat = -$lat;
181
+		}
182
+		// Table is simmetric about the equator.
183
+		if ($lat < 10.47047130) {
184
+			return 59;
185
+		}
186
+		if ($lat < 14.82817437) {
187
+			return 58;
188
+		}
189
+		if ($lat < 18.18626357) {
190
+			return 57;
191
+		}
192
+		if ($lat < 21.02939493) {
193
+			return 56;
194
+		}
195
+		if ($lat < 23.54504487) {
196
+			return 55;
197
+		}
198
+		if ($lat < 25.82924707) {
199
+			return 54;
200
+		}
201
+		if ($lat < 27.93898710) {
202
+			return 53;
203
+		}
204
+		if ($lat < 29.91135686) {
205
+			return 52;
206
+		}
207
+		if ($lat < 31.77209708) {
208
+			return 51;
209
+		}
210
+		if ($lat < 33.53993436) {
211
+			return 50;
212
+		}
213
+		if ($lat < 35.22899598) {
214
+			return 49;
215
+		}
216
+		if ($lat < 36.85025108) {
217
+			return 48;
218
+		}
219
+		if ($lat < 38.41241892) {
220
+			return 47;
221
+		}
222
+		if ($lat < 39.92256684) {
223
+			return 46;
224
+		}
225
+		if ($lat < 41.38651832) {
226
+			return 45;
227
+		}
228
+		if ($lat < 42.80914012) {
229
+			return 44;
230
+		}
231
+		if ($lat < 44.19454951) {
232
+			return 43;
233
+		}
234
+		if ($lat < 45.54626723) {
235
+			return 42;
236
+		}
237
+		if ($lat < 46.86733252) {
238
+			return 41;
239
+		}
240
+		if ($lat < 48.16039128) {
241
+			return 40;
242
+		}
243
+		if ($lat < 49.42776439) {
244
+			return 39;
245
+		}
246
+		if ($lat < 50.67150166) {
247
+			return 38;
248
+		}
249
+		if ($lat < 51.89342469) {
250
+			return 37;
251
+		}
252
+		if ($lat < 53.09516153) {
253
+			return 36;
254
+		}
255
+		if ($lat < 54.27817472) {
256
+			return 35;
257
+		}
258
+		if ($lat < 55.44378444) {
259
+			return 34;
260
+		}
261
+		if ($lat < 56.59318756) {
262
+			return 33;
263
+		}
264
+		if ($lat < 57.72747354) {
265
+			return 32;
266
+		}
267
+		if ($lat < 58.84763776) {
268
+			return 31;
269
+		}
270
+		if ($lat < 59.95459277) {
271
+			return 30;
272
+		}
273
+		if ($lat < 61.04917774) {
274
+			return 29;
275
+		}
276
+		if ($lat < 62.13216659) {
277
+			return 28;
278
+		}
279
+		if ($lat < 63.20427479) {
280
+			return 27;
281
+		}
282
+		if ($lat < 64.26616523) {
283
+			return 26;
284
+		}
285
+		if ($lat < 65.31845310) {
286
+			return 25;
287
+		}
288
+		if ($lat < 66.36171008) {
289
+			return 24;
290
+		}
291
+		if ($lat < 67.39646774) {
292
+			return 23;
293
+		}
294
+		if ($lat < 68.42322022) {
295
+			return 22;
296
+		}
297
+		if ($lat < 69.44242631) {
298
+			return 21;
299
+		}
300
+		if ($lat < 70.45451075) {
301
+			return 20;
302
+		}
303
+		if ($lat < 71.45986473) {
304
+			return 19;
305
+		}
306
+		if ($lat < 72.45884545) {
307
+			return 18;
308
+		}
309
+		if ($lat < 73.45177442) {
310
+			return 17;
311
+		}
312
+		if ($lat < 74.43893416) {
313
+			return 16;
314
+		}
315
+		if ($lat < 75.42056257) {
316
+			return 15;
317
+		}
318
+		if ($lat < 76.39684391) {
319
+			return 14;
320
+		}
321
+		if ($lat < 77.36789461) {
322
+			return 13;
323
+		}
324
+		if ($lat < 78.33374083) {
325
+			return 12;
326
+		}
327
+		if ($lat < 79.29428225) {
328
+			return 11;
329
+		}
330
+		if ($lat < 80.24923213) {
331
+			return 10;
332
+		}
333
+		if ($lat < 81.19801349) {
334
+			return 9;
335
+		}
336
+		if ($lat < 82.13956981) {
337
+			return 8;
338
+		}
339
+		if ($lat < 83.07199445) {
340
+			return 7;
341
+		}
342
+		if ($lat < 83.99173563) {
343
+			return 6;
344
+		}
345
+		if ($lat < 84.89166191) {
346
+			return 5;
347
+		}
348
+		if ($lat < 85.75541621) {
349
+			return 4;
350
+		}
351
+		if ($lat < 86.53536998) {
352
+			return 3;
353
+		}
354
+		if ($lat < 87.00000000) {
355
+			return 2;
356
+		}
216 357
 		return 1;
217 358
 	}
218 359
 
219 360
 	private function cprN($lat,$isodd) {
220 361
 		$nl = $this->cprNL($lat) - $isodd;
221
-		if ($nl > 1) return $nl;
222
-		else return 1;
362
+		if ($nl > 1) {
363
+			return $nl;
364
+		} else {
365
+			return 1;
366
+		}
223 367
 	}
224 368
 
225 369
 	private function parityCheck($msg, $bin) {
@@ -242,10 +386,13 @@  discard block
 block discarded – undo
242 386
 		$crc = 0;
243 387
 		$checksum = intval(substr($msg,22,6),16);
244 388
 		for ($j = 0; $j < strlen($bin); $j++) {
245
-			if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0);
389
+			if ($bin[$j]) {
390
+				$crc = $crc^intval($modes_checksum_table[$j],0);
391
+			}
246 392
 		}
247
-		if ($crc == $checksum) return true;
248
-		else {
393
+		if ($crc == $checksum) {
394
+			return true;
395
+		} else {
249 396
 			//echo "**** CRC ERROR ****\n";
250 397
 			return false;
251 398
 		}
@@ -295,22 +442,37 @@  discard block
 block discarded – undo
295 442
 			$msg['date_log'] = date('Y/m/d',$data['timestamp']);
296 443
 			$msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
297 444
 			$msg['callsign'] = '';
298
-			if (isset($data['altitude'])) $msg['altitude'] = $data['altitude'];
299
-			else $msg['altitude'] = '';
445
+			if (isset($data['altitude'])) {
446
+				$msg['altitude'] = $data['altitude'];
447
+			} else {
448
+				$msg['altitude'] = '';
449
+			}
300 450
 			$msg['speed'] = $data['speed'];
301
-			if (isset($data['heading'])) $msg['track'] = $data['heading'];
302
-			else $msg['track'] = '';
451
+			if (isset($data['heading'])) {
452
+				$msg['track'] = $data['heading'];
453
+			} else {
454
+				$msg['track'] = '';
455
+			}
303 456
 			$msg['latitude'] = $data['latitude'];
304 457
 			$msg['longitude'] = $data['longitude'];
305
-			if (isset($data['verticalrate'])) $msg['verticalrate'] = $data['verticalrate'];
306
-			else $msg['verticalrate'] = '';
307
-			if (isset($data['squawk'])) $msg['squawk'] = $data['squawk'];
308
-			else $msg['squawk'] = 0;
458
+			if (isset($data['verticalrate'])) {
459
+				$msg['verticalrate'] = $data['verticalrate'];
460
+			} else {
461
+				$msg['verticalrate'] = '';
462
+			}
463
+			if (isset($data['squawk'])) {
464
+				$msg['squawk'] = $data['squawk'];
465
+			} else {
466
+				$msg['squawk'] = 0;
467
+			}
309 468
 			$msg['alert'] = 0;
310 469
 			$msg['emergency'] = 0;
311 470
 			$msg['SPI'] = 0;
312
-			if (isset($data['ground'])) $msg['ground'] = 1;
313
-			else $msg['ground'] = 0;
471
+			if (isset($data['ground'])) {
472
+				$msg['ground'] = 1;
473
+			} else {
474
+				$msg['ground'] = 0;
475
+			}
314 476
 			$result[] = implode(',',$msg);
315 477
 		}
316 478
 		return $result;
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +614 added lines, -153 removed lines patch added patch discarded remove patch
@@ -57,7 +57,10 @@  discard block
 block discarded – undo
57 57
 <?php
58 58
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
59 59
 ?>
60
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
60
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
61
+	print '?tsk='.$tsk;
62
+}
63
+?>"></script>
61 64
 <script src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script>
62 65
 <script src="<?php echo $globalURL; ?>/js/map.3d.weather.js"></script>
63 66
 <?php
@@ -137,10 +140,22 @@  discard block
 block discarded – undo
137 140
 			<h1>Weather</h1>
138 141
 			<ul>
139 142
 			
140
-				<li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') print 'checked'; ?> /><?php echo _("Weather Winds"); ?></label></div></li>
141
-				<li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') print 'checked'; ?> /><?php echo _("Ocean surface currents"); ?></label></div></li>
142
-				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') print 'checked'; ?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
143
-				<!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') print 'checked'; ?> /><?php echo _("Weather Waves height background"); ?></label></div></li> -->
143
+				<li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') {
144
+	print 'checked';
145
+}
146
+?> /><?php echo _("Weather Winds"); ?></label></div></li>
147
+				<li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') {
148
+	print 'checked';
149
+}
150
+?> /><?php echo _("Ocean surface currents"); ?></label></div></li>
151
+				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') {
152
+	print 'checked';
153
+}
154
+?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
155
+				<!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') {
156
+	print 'checked';
157
+}
158
+?> /><?php echo _("Weather Waves height background"); ?></label></div></li> -->
144 159
 			
145 160
 <?php
146 161
 		if (isset($globalOpenWeatherMapKey) && $globalOpenWeatherMapKey != '') {
@@ -162,12 +177,18 @@  discard block
 block discarded – undo
162 177
 <?php
163 178
 		if (isset($globalMETAR) && isset($globalMETARcycle) && $globalMETAR && $globalMETARcycle) {
164 179
 ?>
165
-				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) print 'checked'; ?> ><?php echo _("Display 3D weather"); ?></label></div></li>
180
+				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) {
181
+	print 'checked';
182
+}
183
+?> ><?php echo _("Display 3D weather"); ?></label></div></li>
166 184
 			<!--	<li><div class="checkbox"><label><input type="checkbox" name="displayrain" value="1" onclick="clickDisplayRain(this)" ><?php echo _("Display rain on 3D map"); ?></label></div></li>-->
167 185
 <?php
168 186
 		}
169 187
 ?>
170
-				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') print 'checked'; ?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
188
+				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') {
189
+	print 'checked';
190
+}
191
+?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
171 192
 			</ul>
172 193
 <?php
173 194
 	}
@@ -183,13 +204,22 @@  discard block
 block discarded – undo
183 204
 <?php
184 205
 		if (!isset($globalAircraft) || $globalAircraft) {
185 206
 ?>
186
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li>
187
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li>
207
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
208
+	print 'checked';
209
+}
210
+?> /><?php echo _("Display waypoints"); ?></label></div></li>
211
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
212
+	print 'checked';
213
+}
214
+?> /><?php echo _("Display airspace"); ?></label></div></li>
188 215
 <?php
189 216
 		}
190 217
 		if (isset($globalMarine) && $globalMarine) {
191 218
 ?>
192
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
219
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
220
+	print 'checked';
221
+}
222
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
193 223
 <?php
194 224
 		}
195 225
 ?>
@@ -204,13 +234,22 @@  discard block
 block discarded – undo
204 234
 <?php
205 235
 		if (!isset($globalAircraft) || $globalAircraft) {
206 236
 ?>
207
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
208
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
237
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
238
+	print 'checked';
239
+}
240
+?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
241
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
242
+	print 'checked';
243
+}
244
+?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
209 245
 <?php
210 246
 		}
211 247
 		if (isset($globalMarine) && $globalMarine) {
212 248
 ?>
213
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
249
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
250
+	print 'checked';
251
+}
252
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
214 253
 <?php
215 254
 		}
216 255
 ?>
@@ -225,14 +264,32 @@  discard block
 block discarded – undo
225 264
 		<h1>NOTAM</h1>
226 265
 		<form>
227 266
 			<ul>
228
-				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li>
267
+				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') {
268
+	print 'checked';
269
+}
270
+?> /><?php echo _("Display NOTAM"); ?></label></div></li>
229 271
 				<li><?php echo _("NOTAM scope:"); ?>
230 272
 					<select class="selectpicker" onchange="notamscope(this);">
231
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
232
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
233
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
234
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
235
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
273
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
274
+	print ' selected';
275
+}
276
+?>>All</option>
277
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
278
+	print ' selected';
279
+}
280
+?>>Airport/Enroute warning</option>
281
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
282
+	print ' selected';
283
+}
284
+?>>Airport warning</option>
285
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
286
+	print ' selected';
287
+}
288
+?>>Navigation warning</option>
289
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
290
+	print ' selected';
291
+}
292
+?>>Enroute warning</option>
236 293
 					</select
237 294
 				</li>
238 295
 			</ul>
@@ -260,7 +317,10 @@  discard block
 block discarded – undo
260 317
 		    <div class="form-group">
261 318
 			<label><?php echo _("From:"); ?></label>
262 319
 			<div class='input-group date' id='datetimepicker1'>
263
-			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required />
320
+			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
321
+	print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC';
322
+}
323
+?>" required />
264 324
 			    <span class="input-group-addon">
265 325
 				<span class="glyphicon glyphicon-calendar"></span>
266 326
 			    </span>
@@ -269,7 +329,10 @@  discard block
 block discarded – undo
269 329
 		    <div class="form-group">
270 330
 			<label><?php echo _("To:"); ?></label>
271 331
 			<div class='input-group date' id='datetimepicker2'>
272
-			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" />
332
+			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') {
333
+	print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC';
334
+}
335
+?>" />
273 336
 			    <span class="input-group-addon">
274 337
 				<span class="glyphicon glyphicon-calendar"></span>
275 338
 			    </span>
@@ -301,8 +364,20 @@  discard block
 block discarded – undo
301 364
 		    </script>
302 365
 		<li><?php echo _("Playback speed:"); ?>
303 366
 		    <div class="range">
304
-			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
305
-			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
367
+			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
368
+	print $_POST['archivespeed'];
369
+} elseif (isset($_COOKIE['archive_speed'])) {
370
+	print $_COOKIE['archive_speed'];
371
+} else {
372
+	print '1';
373
+}
374
+?>">
375
+			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
376
+	print $_COOKIE['archive_speed'];
377
+} else {
378
+	print '1';
379
+}
380
+?></output>
306 381
 		    </div>
307 382
 		</li>
308 383
 		<?php
@@ -331,14 +406,20 @@  discard block
 block discarded – undo
331 406
 		    <li><?php echo _("Type of Map:"); ?>
332 407
 			    <?php
333 408
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
334
-					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
335
-					else $MapType = $_COOKIE['MapType'];
409
+					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
410
+						$MapType = $globalMapProvider;
411
+					} else {
412
+						$MapType = $_COOKIE['MapType'];
413
+					}
336 414
 			    ?>
337 415
 			<select  class="selectpicker" onchange="mapType(this);">
338 416
 			    <?php
339 417
 				} else {
340
-					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
341
-					else $MapType = $_COOKIE['MapType3D'];
418
+					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') {
419
+						$MapType = $globalMapProvider;
420
+					} else {
421
+						$MapType = $_COOKIE['MapType3D'];
422
+					}
342 423
 			    ?>
343 424
 			<select  class="selectpicker" onchange="mapType3D(this);">
344 425
 			    <?php
@@ -347,24 +428,48 @@  discard block
 block discarded – undo
347 428
 			    <?php
348 429
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
349 430
 			    ?>
350
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
431
+			    <option value="offline"<?php if ($MapType == 'offline') {
432
+	print ' selected';
433
+}
434
+?>>Natural Earth (local)</option>
351 435
 			    <?php
352 436
 				} else {
353 437
 				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
354 438
 			    ?>
355
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
439
+			    <option value="offline"<?php if ($MapType == 'offline') {
440
+	print ' selected';
441
+}
442
+?>>Natural Earth (local)</option>
356 443
 			    <?php
357 444
 				    }
358 445
 			    ?>
359
-			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
360
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
361
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
446
+			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') {
447
+	print ' selected';
448
+}
449
+?>>ArcGIS Streetmap</option>
450
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') {
451
+	print ' selected';
452
+}
453
+?>>ArcGIS Satellite</option>
454
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') {
455
+	print ' selected';
456
+}
457
+?>>ArcGIS Ocean</option>
362 458
 			    <?php
363 459
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
364 460
 			    ?>
365
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
366
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
367
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
461
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
462
+	print ' selected';
463
+}
464
+?>>Bing-Aerial</option>
465
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
466
+	print ' selected';
467
+}
468
+?>>Bing-Hybrid</option>
469
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
470
+	print ' selected';
471
+}
472
+?>>Bing-Road</option>
368 473
 			    <?php
369 474
 				    }
370 475
 			    ?>
@@ -374,59 +479,143 @@  discard block
 block discarded – undo
374 479
 			    <?php
375 480
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
376 481
 			    ?>
377
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here-Aerial') print ' selected'; ?>>Here-Aerial</option>
378
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here-Hybrid') print ' selected'; ?>>Here-Hybrid</option>
379
-			    <option value="Here-Road"<?php if ($MapType == 'Here-Road') print ' selected'; ?>>Here-Road</option>
482
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here-Aerial') {
483
+	print ' selected';
484
+}
485
+?>>Here-Aerial</option>
486
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here-Hybrid') {
487
+	print ' selected';
488
+}
489
+?>>Here-Hybrid</option>
490
+			    <option value="Here-Road"<?php if ($MapType == 'Here-Road') {
491
+	print ' selected';
492
+}
493
+?>>Here-Road</option>
380 494
 			    <?php
381 495
 					}
382 496
 			    ?>
383 497
 			    <?php
384 498
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
385 499
 			    ?>
386
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
387
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
388
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
389
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
500
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
501
+	print ' selected';
502
+}
503
+?>>Google Roadmap</option>
504
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
505
+	print ' selected';
506
+}
507
+?>>Google Satellite</option>
508
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
509
+	print ' selected';
510
+}
511
+?>>Google Hybrid</option>
512
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
513
+	print ' selected';
514
+}
515
+?>>Google Terrain</option>
390 516
 			    <?php
391 517
 					}
392 518
 			    ?>
393 519
 			    <?php
394 520
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
395 521
 			    ?>
396
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
397
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
398
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
522
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
523
+	print ' selected';
524
+}
525
+?>>MapQuest-OSM</option>
526
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
527
+	print ' selected';
528
+}
529
+?>>MapQuest-Aerial</option>
530
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
531
+	print ' selected';
532
+}
533
+?>>MapQuest-Hybrid</option>
399 534
 			    <?php
400 535
 					}
401 536
 			    ?>
402
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
537
+			    <option value="offline"<?php if ($MapType == 'offline') {
538
+	print ' selected';
539
+}
540
+?>>Natural Earth</option>
403 541
 			    <?php
404 542
 				    }
405 543
 			    ?>
406
-			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
544
+			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') {
545
+	print ' selected';
546
+}
547
+?>>National Geographic Street</option>
407 548
 			    <?php
408 549
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
409
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
410
-					else $MapBoxId = $_COOKIE['MapTypeId'];
550
+					if (!isset($_COOKIE['MapTypeId'])) {
551
+						$MapBoxId = 'default';
552
+					} else {
553
+						$MapBoxId = $_COOKIE['MapTypeId'];
554
+					}
411 555
 			    ?>
412
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
413
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
414
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
415
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
416
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
417
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
418
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
419
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
420
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
421
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
422
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
423
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
424
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
556
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
557
+	print ' selected';
558
+}
559
+?>>Mapbox GL</option>
560
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
561
+	print ' selected';
562
+}
563
+?>>Mapbox default</option>
564
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
565
+	print ' selected';
566
+}
567
+?>>Mapbox streets</option>
568
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
569
+	print ' selected';
570
+}
571
+?>>Mapbox light</option>
572
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
573
+	print ' selected';
574
+}
575
+?>>Mapbox dark</option>
576
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
577
+	print ' selected';
578
+}
579
+?>>Mapbox satellite</option>
580
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
581
+	print ' selected';
582
+}
583
+?>>Mapbox streets-satellite</option>
584
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
585
+	print ' selected';
586
+}
587
+?>>Mapbox streets-basic</option>
588
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
589
+	print ' selected';
590
+}
591
+?>>Mapbox comic</option>
592
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
593
+	print ' selected';
594
+}
595
+?>>Mapbox outdoors</option>
596
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
597
+	print ' selected';
598
+}
599
+?>>Mapbox pencil</option>
600
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
601
+	print ' selected';
602
+}
603
+?>>Mapbox pirates</option>
604
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
605
+	print ' selected';
606
+}
607
+?>>Mapbox emerald</option>
425 608
 			    <?php
426 609
 				    }
427 610
 			    ?>
428
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
429
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
611
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
612
+	print ' selected';
613
+}
614
+?>>OpenStreetMap</option>
615
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
616
+	print ' selected';
617
+}
618
+?>>Yandex</option>
430 619
 			    <?php
431 620
 				}
432 621
 			    ?>
@@ -437,10 +626,22 @@  discard block
 block discarded – undo
437 626
 ?>
438 627
 		    <li><?php echo _("Type of Terrain:"); ?>
439 628
 			<select  class="selectpicker" onchange="terrainType(this);">
440
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
441
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
442
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
443
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
629
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
630
+	print ' selected';
631
+}
632
+?>>stk terrain</option>
633
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
634
+	print ' selected';
635
+}
636
+?>>ellipsoid</option>
637
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
638
+	print ' selected';
639
+}
640
+?>>vr terrain</option>
641
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
642
+	print ' selected';
643
+}
644
+?>>ArticDEM</option>
444 645
 			</select>
445 646
 		    </li>
446 647
 <?php
@@ -450,64 +651,124 @@  discard block
 block discarded – undo
450 651
 <?php
451 652
     if (isset($globalMap3D) && $globalMap3D) {
452 653
 ?>
453
-		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
654
+		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') {
655
+	print 'checked';
656
+}
657
+?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
454 658
 <?php
455 659
     }
456 660
 ?>
457 661
 <?php
458 662
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
459 663
 ?>
460
-		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
664
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
665
+	print 'checked';
666
+}
667
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
461 668
 
462 669
 <?php
463 670
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
464 671
 ?>
465
-		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
466
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
467
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
468
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
469
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
672
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
673
+	print 'checked';
674
+}
675
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
676
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
677
+	print 'checked';
678
+}
679
+?> ><?php echo _("Display flight path"); ?></label></div></li>
680
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) {
681
+	print 'checked';
682
+}
683
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
684
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) {
685
+	print 'checked';
686
+}
687
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
688
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
689
+	print 'checked';
690
+}
691
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
470 692
 <?php
471 693
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
472 694
 ?>
473
-		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li>
695
+		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) {
696
+	print 'checked';
697
+}
698
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
474 699
 <?php
475 700
 	}
476 701
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
477 702
 ?>
478
-		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
703
+		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
704
+	print 'checked';
705
+}
706
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
479 707
 <?php
480 708
 	}
481 709
     }
482 710
     if (!isset($globalAircraft) || $globalAircraft === TRUE) {
483 711
 ?>
484
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
712
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) {
713
+	print 'checked';
714
+}
715
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
485 716
 <?php
486 717
     }
487 718
 ?>
488
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
489
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
490
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
719
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) {
720
+	print 'checked';
721
+}
722
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
723
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) {
724
+	print 'checked';
725
+}
726
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
727
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) {
728
+	print 'checked';
729
+}
730
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
491 731
 <?php
492 732
 	if (isset($globalFires) && $globalFires) {
493 733
 ?>
494
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
734
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) {
735
+	print 'checked';
736
+}
737
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
495 738
 <?php
496 739
 	}
497 740
 	if (isset($globalMap3D) && $globalMap3D) {
498 741
 ?>
499
-		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
742
+		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) {
743
+	print 'checked';
744
+}
745
+?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
500 746
 <?php
501 747
 	}
502 748
 ?>
503
-		    <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) print 'checked'; ?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li>
749
+		    <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) {
750
+	print 'checked';
751
+}
752
+?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li>
504 753
 <?php
505 754
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
506 755
 ?>
507
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
508
-		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
509
-		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
510
-		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
756
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
757
+	print 'checked';
758
+}
759
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
760
+		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) {
761
+	print 'checked';
762
+}
763
+?> ><?php echo _("Use shadows"); ?></label></div></li>
764
+		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) {
765
+	print 'checked';
766
+}
767
+?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
768
+		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) {
769
+	print 'checked';
770
+}
771
+?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
511 772
 <?php
512 773
     }
513 774
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -520,17 +781,25 @@  discard block
 block discarded – undo
520 781
 			if (function_exists('array_column')) {
521 782
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
522 783
 		    ?>
523
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
784
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
785
+	print 'checked';
786
+}
787
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
524 788
 		    <?php
525 789
 			    }
526 790
 			} elseif (isset($globalSources)) {
527 791
 			    $dispolar = false;
528 792
 			    foreach ($globalSources as $testsource) {
529
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
793
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
794
+			        	$dispolar = true;
795
+			        }
530 796
 			    }
531 797
 			    if ($dispolar) {
532 798
 		    ?>
533
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
799
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
800
+	print 'checked';
801
+}
802
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
534 803
 		    <?php
535 804
 			    }
536 805
 		        }
@@ -541,7 +810,14 @@  discard block
 block discarded – undo
541 810
 		    <?php
542 811
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
543 812
 		    ?>
544
-		    <li><?php echo _("Max number of flights to display in 2D:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) print $_COOKIE['map_2d_limit']; elseif (isset($globalMap2DAircraftsLimit)) print $globalMap2DAircraftsLimit; else print 15000; ?>" onchange="map2dlimit(this.value);" /></li>
813
+		    <li><?php echo _("Max number of flights to display in 2D:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) {
814
+	print $_COOKIE['map_2d_limit'];
815
+} elseif (isset($globalMap2DAircraftsLimit)) {
816
+	print $globalMap2DAircraftsLimit;
817
+} else {
818
+	print 15000;
819
+}
820
+?>" onchange="map2dlimit(this.value);" /></li>
545 821
 		    <?php
546 822
 			}
547 823
 		    ?>
@@ -549,11 +825,21 @@  discard block
 block discarded – undo
549 825
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
550 826
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
551 827
 		    ?>
552
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
828
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
829
+	print 'checked';
830
+}
831
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
553 832
 		    <?php 
554 833
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
555 834
 		    ?>
556
-			<li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
835
+			<li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
836
+	print $_COOKIE['IconColor'];
837
+} elseif (isset($globalAircraftIconColor)) {
838
+	print $globalAircraftIconColor;
839
+} else {
840
+	print '1a3151';
841
+}
842
+?>"></li>
557 843
 		    <?php
558 844
 				}
559 845
 			    }
@@ -564,7 +850,14 @@  discard block
 block discarded – undo
564 850
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
565 851
 		    ?>
566 852
 		    <li><?php echo _("Marine icon color:"); ?>
567
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
853
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
854
+	print $_COOKIE['MarineIconColor'];
855
+} elseif (isset($globalMarineIconColor)) {
856
+	print $globalMarineIconColor;
857
+} else {
858
+	print '1a3151';
859
+}
860
+?>">
568 861
 		    </li>
569 862
 		    <?php
570 863
 			    }
@@ -575,7 +868,14 @@  discard block
 block discarded – undo
575 868
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
576 869
 		    ?>
577 870
 		    <li><?php echo _("Tracker icon color:"); ?>
578
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
871
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
872
+	print $_COOKIE['TrackerIconColor'];
873
+} elseif (isset($globalTrackerIconColor)) {
874
+	print $globalTrackerIconColor;
875
+} else {
876
+	print '1a3151';
877
+}
878
+?>">
579 879
 		    </li>
580 880
 		    <?php
581 881
 			    }
@@ -586,8 +886,22 @@  discard block
 block discarded – undo
586 886
 		    ?>
587 887
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
588 888
 			<div class="range">
589
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
590
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
889
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
890
+	print $_COOKIE['AirportZoom'];
891
+} elseif (isset($globalAirportZoom)) {
892
+	print $globalAirportZoom;
893
+} else {
894
+	print '7';
895
+}
896
+?>">
897
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
898
+	print $_COOKIE['AirportZoom'];
899
+} elseif (isset($globalAirportZoom)) {
900
+	print $globalAirportZoom;
901
+} else {
902
+	print '7';
903
+}
904
+?></output>
591 905
 			</div>
592 906
 		    </li>
593 907
 		    <?php
@@ -598,18 +912,48 @@  discard block
 block discarded – undo
598 912
 ?>
599 913
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
600 914
 			<div class="range">
601
-			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?>">
602
-			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output>
915
+			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) {
916
+	print $_COOKIE['resolutionScale'];
917
+} else {
918
+	print '1';
919
+}
920
+?>">
921
+			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) {
922
+	print $_COOKIE['resolutionScale'];
923
+} else {
924
+	print '1';
925
+}
926
+?></output>
603 927
 			</div>
604 928
 		    </li>
605 929
 <?php
606 930
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
607 931
 ?>
608
-		    <!-- <li><?php echo _("Max number of flights to display in 3D:"); ?> <input type="number" name="3dlimit" value="<?php if (isset($_COOKIE['map_3d_limit'])) print $_COOKIE['map_3d_limit']; elseif (isset($globalMap3DAircraftsLimit)) print $globalMap3DAircraftsLimit; else print 300; ?>" onchange="map3dlimit(this.value);" /></li> -->
609
-		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> > <?php echo _("Use airlines liveries"); ?></li>
610
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
932
+		    <!-- <li><?php echo _("Max number of flights to display in 3D:"); ?> <input type="number" name="3dlimit" value="<?php if (isset($_COOKIE['map_3d_limit'])) {
933
+	print $_COOKIE['map_3d_limit'];
934
+} elseif (isset($globalMap3DAircraftsLimit)) {
935
+	print $globalMap3DAircraftsLimit;
936
+} else {
937
+	print 300;
938
+}
939
+?>" onchange="map3dlimit(this.value);" /></li> -->
940
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
941
+	print 'checked';
942
+}
943
+?> > <?php echo _("Use airlines liveries"); ?></li>
944
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
945
+	print 'checked';
946
+}
947
+?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
611 948
 		    <!--<li><?php echo _("Aircraft icon color:"); ?>-->
612
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>">
949
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
950
+	print $_COOKIE['IconColor'];
951
+} elseif (isset($globalAircraftIconColor)) {
952
+	print $globalAircraftIconColor;
953
+} else {
954
+	print 'ff0000';
955
+}
956
+?>">
613 957
 		    </li>
614 958
 <?php
615 959
 	}
@@ -617,9 +961,19 @@  discard block
 block discarded – undo
617 961
 <?php
618 962
 	if (isset($globalMarine) && $globalMarine === TRUE) {
619 963
 ?>
620
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?>&nbsp;
964
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
965
+	print 'checked';
966
+}
967
+?> ><?php echo _("Force Marine color"); ?>&nbsp;
621 968
 		    <!--<li><?php echo _("Marine icon color:"); ?>-->
622
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
969
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
970
+	print $_COOKIE['MarineIconColor'];
971
+} elseif (isset($globalMarineIconColor)) {
972
+	print $globalMarineIconColor;
973
+} else {
974
+	print 'ff0000';
975
+}
976
+?>">
623 977
 		    </li>
624 978
 <?php
625 979
 	}
@@ -627,9 +981,19 @@  discard block
 block discarded – undo
627 981
 <?php
628 982
 	if (isset($globalTracker) && $globalTracker === TRUE) {
629 983
 ?>
630
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?>&nbsp;
984
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
985
+	print 'checked';
986
+}
987
+?> ><?php echo _("Force Tracker color"); ?>&nbsp;
631 988
 		    <!--<li><?php echo _("Tracker icon color:"); ?>-->
632
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>">
989
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
990
+	print $_COOKIE['TrackerIconColor'];
991
+} elseif (isset($globalTrackerIconColor)) {
992
+	print $globalTrackerIconColor;
993
+} else {
994
+	print 'ff0000';
995
+}
996
+?>">
633 997
 		    </li>
634 998
 <?php
635 999
 	}
@@ -637,29 +1001,62 @@  discard block
 block discarded – undo
637 1001
 ?>
638 1002
 		    <li><?php echo _("Distance unit:"); ?>
639 1003
 			<select class="selectpicker" onchange="unitdistance(this);">
640
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
641
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
642
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
1004
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
1005
+	echo ' selected';
1006
+}
1007
+?>>km</option>
1008
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1009
+	echo ' selected';
1010
+}
1011
+?>>nm</option>
1012
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
1013
+	echo ' selected';
1014
+}
1015
+?>>mi</option>
643 1016
 		        </select>
644 1017
 		    </li>
645 1018
 		    <li><?php echo _("Altitude unit:"); ?>
646 1019
 			<select class="selectpicker" onchange="unitaltitude(this);">
647
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
648
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
1020
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
1021
+	echo ' selected';
1022
+}
1023
+?>>m</option>
1024
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
1025
+	echo ' selected';
1026
+}
1027
+?>>feet</option>
649 1028
 		        </select>
650 1029
 		    </li>
651 1030
 		    <li><?php echo _("Speed unit:"); ?>
652 1031
 			<select class="selectpicker" onchange="unitspeed(this);">
653
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
654
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
655
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
1032
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
1033
+	echo ' selected';
1034
+}
1035
+?>>km/h</option>
1036
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
1037
+	echo ' selected';
1038
+}
1039
+?>>mph</option>
1040
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
1041
+	echo ' selected';
1042
+}
1043
+?>>knots</option>
656 1044
 		        </select>
657 1045
 		    </li>
658 1046
 		    <li><?php echo _("Coordinate unit:"); ?>
659 1047
 			<select class="selectpicker" onchange="unitcoordinate(this);">
660
-			    <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) echo ' selected'; ?>>DD</option>
661
-			    <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) echo ' selected'; ?>>DMS</option>
662
-			    <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) echo ' selected'; ?>>DM</option>
1048
+			    <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) {
1049
+	echo ' selected';
1050
+}
1051
+?>>DD</option>
1052
+			    <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) {
1053
+	echo ' selected';
1054
+}
1055
+?>>DMS</option>
1056
+			    <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) {
1057
+	echo ' selected';
1058
+}
1059
+?>>DM</option>
663 1060
 		        </select>
664 1061
 		    </li>
665 1062
 
@@ -677,9 +1074,18 @@  discard block
 block discarded – undo
677 1074
 		    <?php
678 1075
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
679 1076
 		    ?>
680
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
681
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
682
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
1077
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) {
1078
+	print 'checked';
1079
+}
1080
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
1081
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) {
1082
+	print 'checked';
1083
+}
1084
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
1085
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) {
1086
+	print 'checked';
1087
+}
1088
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
683 1089
 		    <?php
684 1090
 			}
685 1091
 		    ?>
@@ -687,12 +1093,21 @@  discard block
 block discarded – undo
687 1093
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
688 1094
 		    ?>
689 1095
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
690
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
1096
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) {
1097
+	print 'checked';
1098
+}
1099
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
691 1100
 			<?php } ?>
692 1101
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
693
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
1102
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) {
1103
+	print 'checked';
1104
+}
1105
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
694 1106
 			<?php } ?>
695
-			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
1107
+			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') {
1108
+	print 'checked';
1109
+}
1110
+?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
696 1111
 		    <?php
697 1112
 			}
698 1113
 		    ?>
@@ -708,7 +1123,9 @@  discard block
 block discarded – undo
708 1123
 				}
709 1124
 				foreach($allairlinenames as $airline) {
710 1125
 					$airline_name = $airline['airline_name'];
711
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
1126
+					if (strlen($airline_name) > 30) {
1127
+						$airline_name = substr($airline_name,0,30).'...';
1128
+					}
712 1129
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
713 1130
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
714 1131
 					} else {
@@ -726,7 +1143,10 @@  discard block
 block discarded – undo
726 1143
 		    <li><?php echo _("Display alliance:"); ?>
727 1144
 		    <br/>
728 1145
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
729
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
1146
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
1147
+	echo ' selected';
1148
+}
1149
+?>><?php echo _("All"); ?></option>
730 1150
 			    <?php
731 1151
 				foreach($allalliancenames as $alliance) {
732 1152
 					$alliance_name = $alliance['alliance'];
@@ -785,10 +1205,22 @@  discard block
 block discarded – undo
785 1205
 		    ?>
786 1206
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
787 1207
 			<select class="selectpicker" onchange="airlinestype(this);">
788
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
789
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
790
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
791
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
1208
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
1209
+	echo ' selected';
1210
+}
1211
+?>><?php echo _("All"); ?></option>
1212
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
1213
+	echo ' selected';
1214
+}
1215
+?>><?php echo _("Passenger"); ?></option>
1216
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
1217
+	echo ' selected';
1218
+}
1219
+?>><?php echo _("Cargo"); ?></option>
1220
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
1221
+	echo ' selected';
1222
+}
1223
+?>><?php echo _("Military"); ?></option>
792 1224
 			</select>
793 1225
 		    </li>
794 1226
 		    <?php
@@ -802,7 +1234,10 @@  discard block
 block discarded – undo
802 1234
 		    ?>
803 1235
 		    <li>
804 1236
 			<?php echo _("Display vessels with MMSI:"); ?>
805
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
1237
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
1238
+	print $_COOKIE['filter_mmsi'];
1239
+}
1240
+?>" />
806 1241
 		    </li>
807 1242
 			<?php
808 1243
 				if (isset($globalVM) && $globalVM) {
@@ -833,7 +1268,10 @@  discard block
 block discarded – undo
833 1268
 		    ?>
834 1269
 		    <li>
835 1270
 			<?php echo _("Display with ident:"); ?>
836
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1271
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1272
+	print $_COOKIE['filter_ident'];
1273
+}
1274
+?>" />
837 1275
 		    </li>
838 1276
 		</ul>
839 1277
 	    </form>
@@ -849,7 +1287,10 @@  discard block
 block discarded – undo
849 1287
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
850 1288
 	    <form>
851 1289
 		<ul>
852
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
1290
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
1291
+	print 'checked';
1292
+}
1293
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
853 1294
 		    <li><?php echo _("Type:"); ?>
854 1295
 			<select class="selectpicker" multiple onchange="sattypes(this);">
855 1296
 			    <?php
@@ -857,25 +1298,45 @@  discard block
 block discarded – undo
857 1298
 				$types = $Satellite->get_tle_types();
858 1299
 				foreach ($types as $type) {
859 1300
 					$type_name = $type['tle_type'];
860
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
861
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
862
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
863
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
864
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
865
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
866
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
867
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
868
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
869
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
870
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
871
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
872
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
873
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
874
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
875
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
876
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
877
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
878
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1301
+					if ($type_name == 'musson') {
1302
+						$type_name = 'Russian LEO Navigation';
1303
+					} else if ($type_name == 'nnss') {
1304
+						$type_name = 'Navi Navigation Satellite System';
1305
+					} else if ($type_name == 'sbas') {
1306
+						$type_name = 'Satellite-Based Augmentation System';
1307
+					} else if ($type_name == 'glo-ops') {
1308
+						$type_name = 'Glonass Operational';
1309
+					} else if ($type_name == 'gps-ops') {
1310
+						$type_name = 'GPS Operational';
1311
+					} else if ($type_name == 'argos') {
1312
+						$type_name = 'ARGOS Data Collection System';
1313
+					} else if ($type_name == 'tdrss') {
1314
+						$type_name = 'Tracking and Data Relay Satellite System';
1315
+					} else if ($type_name == 'sarsat') {
1316
+						$type_name = 'Search & Rescue';
1317
+					} else if ($type_name == 'dmc') {
1318
+						$type_name = 'Disaster Monitoring';
1319
+					} else if ($type_name == 'resource') {
1320
+						$type_name = 'Earth Resources';
1321
+					} else if ($type_name == 'stations') {
1322
+						$type_name = 'Space Stations';
1323
+					} else if ($type_name == 'geo') {
1324
+						$type_name = 'Geostationary';
1325
+					} else if ($type_name == 'amateur') {
1326
+						$type_name = 'Amateur Radio';
1327
+					} else if ($type_name == 'x-comm') {
1328
+						$type_name = 'Experimental';
1329
+					} else if ($type_name == 'other-comm') {
1330
+						$type_name = 'Other Comm';
1331
+					} else if ($type_name == 'science') {
1332
+						$type_name = 'Space & Earth Science';
1333
+					} else if ($type_name == 'military') {
1334
+						$type_name = 'Miscellaneous Military';
1335
+					} else if ($type_name == 'radar') {
1336
+						$type_name = 'Radar Calibration';
1337
+					} else if ($type_name == 'tle-new') {
1338
+						$type_name = 'Last 30 days launches';
1339
+					}
879 1340
 					
880 1341
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
881 1342
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
scripts/update_db.php 1 patch
Braces   +33 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@  discard block
 block discarded – undo
15 15
 	if(function_exists('exec')) {
16 16
 		exec("ps ux", $output, $result);
17 17
 		$j = 0;
18
-		foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
18
+		foreach ($output as $line) {
19
+			if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
20
+		}
19 21
 		if ($j > 1) {
20 22
 			echo "Script is already runnning...";
21 23
 			die();
@@ -25,7 +27,9 @@  discard block
 block discarded – undo
25 27
 require(dirname(__FILE__).'/../install/class.update_db.php');
26 28
 $update_db = new update_db();
27 29
 
28
-if ($update_db->check() === false) die();
30
+if ($update_db->check() === false) {
31
+	die();
32
+}
29 33
 
30 34
 if ((!isset($globalMasterServer) || !$globalMasterServer) && (!isset($globalOffline) || $globalOffline === FALSE)) {
31 35
 	if (isset($globalNOTAM) && $globalNOTAM && $update_db->check_last_notam_update()) {
@@ -36,14 +40,18 @@  discard block
 block discarded – undo
36 40
 			$update_db->update_notam();
37 41
 		}
38 42
 		$update_db->insert_last_notam_update();
39
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
43
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
44
+		echo "NOTAM are only updated once a day.\n";
45
+	}
40 46
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && ($update_db->check_last_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
41 47
 		$update_db->update_all();
42 48
 	//	require_once(dirname(__FILE__).'/../require/class.Spotter.php');
43 49
 	//	$Spotter = new Spotter();
44 50
 	//	$Spotter->updateFieldsFromOtherTables();
45 51
 		$update_db->insert_last_update();
46
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
52
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
53
+		echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
54
+	}
47 55
 	if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) {
48 56
 		echo "Check if new airspace version exist...";
49 57
 		echo $update_db->update_airspace_fam();
@@ -52,8 +60,11 @@  discard block
 block discarded – undo
52 60
 	if (isset($globalGeoid) && $globalGeoid && $update_db->check_last_geoid_update()) {
53 61
 		echo "Check if new geoid version exist...";
54 62
 		$error = $update_db->update_geoid_fam();
55
-		if ($error == '') $update_db->insert_last_geoid_update();
56
-		else echo $error;
63
+		if ($error == '') {
64
+			$update_db->insert_last_geoid_update();
65
+		} else {
66
+			echo $error;
67
+		}
57 68
 	}
58 69
 	if (isset($globalMarine) && $globalMarine && (!isset($globalVM) || $globalVM === FALSE) && $update_db->check_last_marine_identity_update()) {
59 70
 		echo "Check if new marine identity version exist...";
@@ -71,13 +82,17 @@  discard block
 block discarded – undo
71 82
 			//echo "Done";
72 83
 		}
73 84
 		$update_db->insert_last_owner_update();
74
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
85
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
86
+		echo "Owner are only updated every 15 days.\n";
87
+	}
75 88
 
76 89
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && ($update_db->check_last_airlines_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
77 90
 		echo "Updating airlines...\n";
78 91
 		echo $update_db->update_airlines_fam();
79 92
 		$update_db->insert_last_airlines_update();
80
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Airlines are only updated every 15 days.\n";
93
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
94
+		echo "Airlines are only updated every 15 days.\n";
95
+	}
81 96
 
82 97
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && (isset($globalAccidents) && $globalAccidents && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
83 98
 		require_once(dirname(__FILE__).'/../require/class.Accident.php');
@@ -86,7 +101,9 @@  discard block
 block discarded – undo
86 101
 		if ($Accident->check_last_accidents_update()) {
87 102
 			$Accident->download_update();
88 103
 			$Accident->insert_last_accidents_update();
89
-		} else echo "Accidents are updated once a day.\n";
104
+		} else {
105
+			echo "Accidents are updated once a day.\n";
106
+		}
90 107
 	}
91 108
   
92 109
 }
@@ -99,7 +116,9 @@  discard block
 block discarded – undo
99 116
 		if ($METAR->check_last_update()) {
100 117
 			$METAR->addMETARCycle();
101 118
 			$METAR->insert_last_update();
102
-		} else echo "METAR are only updated every 30 minutes.\n";
119
+		} else {
120
+			echo "METAR are only updated every 30 minutes.\n";
121
+		}
103 122
 	}
104 123
 
105 124
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
@@ -107,8 +126,10 @@  discard block
 block discarded – undo
107 126
 		//$update_db->update_oneworld();
108 127
 		$update_db->update_skyteam();
109 128
 		$update_db->insert_last_schedules_update();
110
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n";
111
-}
129
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
130
+		echo "Schedules are only updated every 15 days.\n";
131
+	}
132
+	}
112 133
 
113 134
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
114 135
 	echo "Updating statistics and archive old data...\n";
Please login to merge, or discard this patch.