Completed
Push — master ( 994417...89e41e )
by Yannick
34:04 queued 01:34
created
index.php 2 patches
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
48 48
 </tr></table></div>
49 49
 <?php
50
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
50
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
51 51
 ?>
52 52
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
53 53
 <?php
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
72 72
 <?php
73 73
 	}
74
-    }
74
+	}
75 75
 ?>
76 76
 
77 77
 <div id="sidebar" class="sidebar collapsed">
@@ -82,34 +82,34 @@  discard block
 block discarded – undo
82 82
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
83 83
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
84 84
 <?php
85
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
85
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
86 86
 	if (isset($globalArchive) && $globalArchive == TRUE) {
87 87
 ?>
88 88
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
89 89
 <?php
90 90
 	}
91
-    }
91
+	}
92 92
 ?>
93 93
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
94 94
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
95 95
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
96 96
 <?php
97
-    if (isset($globalMap3D) && $globalMap3D) {
97
+	if (isset($globalMap3D) && $globalMap3D) {
98 98
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
99 99
 ?>
100 100
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
101 101
 <?php
102
-	    if (isset($globalSatellite) && $globalSatellite) {
102
+		if (isset($globalSatellite) && $globalSatellite) {
103 103
 ?>
104 104
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
105 105
 <?php
106
-	    }
106
+		}
107 107
 	} else {
108 108
 ?>
109 109
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
110 110
 <?php
111 111
 	}
112
-    }
112
+	}
113 113
 ?>
114 114
     </ul>
115 115
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 ?>
185 185
         </div>
186 186
 <?php
187
-    if (isset($globalArchive) && $globalArchive == TRUE) {
187
+	if (isset($globalArchive) && $globalArchive == TRUE) {
188 188
 ?>
189 189
         <div class="sidebar-pane" id="archive">
190 190
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	    </form>
244 244
 	</div>
245 245
 <?php
246
-    }
246
+	}
247 247
 ?>
248 248
         <div class="sidebar-pane" id="settings">
249 249
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -254,56 +254,56 @@  discard block
 block discarded – undo
254 254
 			    <?php
255 255
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
256 256
 				else $MapType = $_COOKIE['MapType'];
257
-			    ?>
257
+				?>
258 258
 			    <?php
259 259
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
260
-			    ?>
260
+				?>
261 261
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
262 262
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
263 263
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
264 264
 			    <?php
265 265
 				}
266
-			    ?>
266
+				?>
267 267
 			    <?php
268
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
269
-			    ?>
268
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
269
+				?>
270 270
 			    <?php
271
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
272
-			    ?>
271
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
272
+				?>
273 273
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
274 274
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
275 275
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
276 276
 			    <?php
277
-				    }
278
-			    ?>
277
+					}
278
+				?>
279 279
 			    <?php
280
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
281
-			    ?>
280
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
281
+				?>
282 282
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
283 283
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
284 284
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
285 285
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
286 286
 			    <?php
287
-				    }
288
-			    ?>
287
+					}
288
+				?>
289 289
 			    <?php
290
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
291
-			    ?>
290
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
291
+				?>
292 292
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
293 293
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
294 294
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
295 295
 			    <?php
296
-				    }
297
-			    ?>
296
+					}
297
+				?>
298 298
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
299 299
 			    <?php
300 300
 				}
301
-			    ?>
301
+				?>
302 302
 			    <?php
303
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
303
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
304 304
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
305 305
 					else $MapBoxId = $_COOKIE['MapTypeId'];
306
-			    ?>
306
+				?>
307 307
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
308 308
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
309 309
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
318 318
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
319 319
 			    <?php
320
-				    }
321
-			    ?>
320
+					}
321
+				?>
322 322
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
323 323
 			</select>
324 324
 		    </li>
325 325
 <?php
326
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
326
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
327 327
 ?>
328 328
 		    <li><?php echo _("Type of Terrain:"); ?>
329 329
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 			</select>
335 335
 		    </li>
336 336
 <?php
337
-    }
337
+	}
338 338
 ?>
339 339
 <?php
340
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
340
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
341 341
 ?>
342 342
 <?php
343 343
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 		    <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>
355 355
 <?php
356 356
 	}
357
-    }
357
+	}
358 358
 ?>
359 359
 		    <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>
360 360
 		    <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>
@@ -366,81 +366,81 @@  discard block
 block discarded – undo
366 366
 		    <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>
367 367
 <?php
368 368
 	}
369
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
369
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
370 370
 ?>
371 371
 		    <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>
372 372
 <?php
373
-    }
374
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
373
+	}
374
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
375 375
 ?>
376 376
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
377 377
 <?php
378
-    }
378
+	}
379 379
 ?>
380 380
 		    <?php
381 381
 			if (function_exists('array_column')) {
382
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
383
-		    ?>
382
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
383
+			?>
384 384
 		    <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>
385 385
 		    <?php
386
-			    }
386
+				}
387 387
 			} elseif (isset($globalSources)) {
388
-			    $dispolar = false;
389
-			    foreach ($globalSources as $testsource) {
390
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
391
-			    }
392
-			    if ($dispolar) {
393
-		    ?>
388
+				$dispolar = false;
389
+				foreach ($globalSources as $testsource) {
390
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
391
+				}
392
+				if ($dispolar) {
393
+			?>
394 394
 		    <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>
395 395
 		    <?php
396
-			    }
397
-		        }
398
-		    ?>
396
+				}
397
+				}
398
+			?>
399 399
 <?php
400
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
400
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
401 401
 ?>
402 402
 
403 403
 		    <?php
404 404
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
405
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
406
-		    ?>
405
+					if (extension_loaded('gd') && function_exists('gd_info')) {
406
+			?>
407 407
 		    <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>
408 408
 		    <?php 
409 409
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
410
-		    ?>
410
+			?>
411 411
 		    <li><?php echo _("Aircraft icon color:"); ?>
412 412
 			<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 '1a3151'; ?>">
413 413
 		    </li>
414 414
 		    <?php
415 415
 				}
416
-			    }
417
-		        }
418
-		    ?>
416
+				}
417
+				}
418
+			?>
419 419
 		    <?php
420 420
 			if (isset($globalMarine) && $globalMarine === TRUE) {
421
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
422
-		    ?>
421
+				if (extension_loaded('gd') && function_exists('gd_info')) {
422
+			?>
423 423
 		    <li><?php echo _("Marine icon color:"); ?>
424 424
 			<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'; ?>">
425 425
 		    </li>
426 426
 		    <?php
427
-			    }
428
-		        }
429
-		    ?>
427
+				}
428
+				}
429
+			?>
430 430
 		    <?php
431 431
 			if (isset($globalTracker) && $globalTracker === TRUE) {
432
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
433
-		    ?>
432
+				if (extension_loaded('gd') && function_exists('gd_info')) {
433
+			?>
434 434
 		    <li><?php echo _("Tracker icon color:"); ?>
435 435
 			<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'; ?>">
436 436
 		    </li>
437 437
 		    <?php
438
-			    }
439
-		        }
440
-		    ?>
438
+				}
439
+				}
440
+			?>
441 441
 		    <?php
442 442
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
443
-		    ?>
443
+			?>
444 444
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
445 445
 			<div class="range">
446 446
 			    <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'; ?>">
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 		    </li>
450 450
 		    <?php
451 451
 			}
452
-		    ?>
452
+			?>
453 453
 <?php
454
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
454
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
455 455
 ?>
456 456
 <?php
457 457
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 		    </li>
484 484
 <?php
485 485
 	}
486
-    }
486
+	}
487 487
 ?>
488 488
 		    <li><?php echo _("Distance unit:"); ?>
489 489
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -516,19 +516,19 @@  discard block
 block discarded – undo
516 516
 		    <ul>
517 517
 		    <?php
518 518
 			if (!isset($globalAircraft) || $globalAircraft) {
519
-		    ?>
519
+			?>
520 520
 		    <?php
521 521
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
522
-		    ?>
522
+			?>
523 523
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
524 524
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
525 525
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
526 526
 		    <?php
527 527
 			}
528
-		    ?>
528
+			?>
529 529
 		    <?php
530 530
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
531
-		    ?>
531
+			?>
532 532
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
533 533
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
534 534
 			<?php } ?>
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 			<?php } ?>
538 538
 		    <?php
539 539
 			}
540
-		    ?>
540
+			?>
541 541
 		    <li><?php echo _("Display airlines:"); ?>
542 542
 		    <br/>
543 543
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -557,14 +557,14 @@  discard block
 block discarded – undo
557 557
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
558 558
 					}
559 559
 				}
560
-			    ?>
560
+				?>
561 561
 			</select>
562 562
 		    </li>
563 563
 		    <?php
564 564
 			$Spotter = new Spotter();
565 565
 			$allalliancenames = $Spotter->getAllAllianceNames();
566 566
 			if (!empty($allalliancenames)) {
567
-		    ?>
567
+			?>
568 568
 		    <li><?php echo _("Display alliance:"); ?>
569 569
 		    <br/>
570 570
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -578,18 +578,18 @@  discard block
 block discarded – undo
578 578
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
579 579
 					}
580 580
 				}
581
-			    ?>
581
+				?>
582 582
 			</select>
583 583
 		    </li>
584 584
 		    <?php
585 585
 			}
586
-		    ?>
586
+			?>
587 587
 		    <?php
588 588
 			}
589
-		    ?>
589
+			?>
590 590
 		    <?php
591 591
 			if (isset($globalAPRS) && $globalAPRS) {
592
-		    ?>
592
+			?>
593 593
 		    <li><?php echo _("Display APRS sources name:"); ?>
594 594
 			<select class="selectpicker" multiple onchange="sources(this);">
595 595
 			    <?php
@@ -613,18 +613,18 @@  discard block
 block discarded – undo
613 613
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
614 614
 					}
615 615
 				}
616
-			    ?>
616
+				?>
617 617
 			</select>
618 618
 		    </li>
619 619
 		    <?php
620 620
 			}
621
-		    ?>
621
+			?>
622 622
 		    <?php
623 623
 			if (!isset($globalAircraft) || $globalAircraft) {
624
-		    ?>
624
+			?>
625 625
 		    <?php
626
-			    if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
627
-		    ?>
626
+				if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
627
+			?>
628 628
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
629 629
 			<select class="selectpicker" onchange="airlinestype(this);">
630 630
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -634,21 +634,21 @@  discard block
 block discarded – undo
634 634
 			</select>
635 635
 		    </li>
636 636
 		    <?php
637
-			    }
638
-		    ?>
637
+				}
638
+			?>
639 639
 		    <?php
640 640
 			}
641
-		    ?>
641
+			?>
642 642
 		    <?php
643 643
 			if (isset($globalMarine) && $globalMarine) {
644
-		    ?>
644
+			?>
645 645
 		    <li>
646 646
 			<?php echo _("Display vessels with MMSI:"); ?>
647 647
 			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
648 648
 		    </li>
649 649
 		    <?php
650 650
 			}
651
-		    ?>
651
+			?>
652 652
 		    <li>
653 653
 			<?php echo _("Display with ident:"); ?>
654 654
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 	    </form>
662 662
     	</div>
663 663
 <?php
664
-    if (isset($globalSatellite) && $globalSatellite) {
664
+	if (isset($globalSatellite) && $globalSatellite) {
665 665
 ?>
666 666
         <div class="sidebar-pane" id="satellites">
667 667
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -701,14 +701,14 @@  discard block
 block discarded – undo
701 701
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
702 702
 					}
703 703
 				}
704
-			    ?>
704
+				?>
705 705
 			</select>
706 706
 		    </li>
707 707
 		</ul>
708 708
 	    </form>
709 709
 	</div>
710 710
 <?php
711
-    }
711
+	}
712 712
 ?>
713 713
     </div>
714 714
 </div>
Please login to merge, or discard this patch.
Braces   +449 added lines, -113 removed lines patch added patch discarded remove patch
@@ -163,11 +163,26 @@  discard block
 block discarded – undo
163 163
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
164 164
 				<li><?php echo _("NOTAM scope:"); ?>
165 165
 					<select class="selectpicker" onchange="notamscope(this);">
166
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
167
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
168
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
169
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
170
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
166
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
167
+	print ' selected';
168
+}
169
+?>>All</option>
170
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
171
+	print ' selected';
172
+}
173
+?>>Airport/Enroute warning</option>
174
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
175
+	print ' selected';
176
+}
177
+?>>Airport warning</option>
178
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
179
+	print ' selected';
180
+}
181
+?>>Navigation warning</option>
182
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
183
+	print ' selected';
184
+}
185
+?>>Enroute warning</option>
171 186
 					</select
172 187
 				</li>
173 188
 			</ul>
@@ -195,7 +210,12 @@  discard block
 block discarded – undo
195 210
 		        <div class="form-group">
196 211
 			    <label>From (UTC):</label>
197 212
 		            <div class='input-group date' id='datetimepicker1'>
198
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
213
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
214
+	print $_POST['start_date'];
215
+} elseif (isset($_COOKIE['archive_begin'])) {
216
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
217
+}
218
+?>" required />
199 219
 		                <span class="input-group-addon">
200 220
             			    <span class="glyphicon glyphicon-calendar"></span>
201 221
 		                </span>
@@ -204,7 +224,12 @@  discard block
 block discarded – undo
204 224
 		        <div class="form-group">
205 225
 			    <label>To (UTC):</label>
206 226
 		            <div class='input-group date' id='datetimepicker2'>
207
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
227
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
228
+	print $_POST['end_date'];
229
+} elseif (isset($_COOKIE['archive_end'])) {
230
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
231
+}
232
+?>" />
208 233
             			<span class="input-group-addon">
209 234
 		                    <span class="glyphicon glyphicon-calendar"></span>
210 235
             			</span>
@@ -229,8 +254,20 @@  discard block
 block discarded – undo
229 254
 			</script>
230 255
 		    <li><?php echo _("Playback speed:"); ?>
231 256
 			<div class="range">
232
-			    <input type="range" min="0" max="50" step="1" 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'; ?>">
233
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
257
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
258
+	print $_POST['archivespeed'];
259
+} elseif (isset($_COOKIE['archive_speed'])) {
260
+	print $_COOKIE['archive_speed'];
261
+} else {
262
+	print '1';
263
+}
264
+?>">
265
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
266
+	print $_COOKIE['archive_speed'];
267
+} else {
268
+	print '1';
269
+}
270
+?></output>
234 271
 			</div>
235 272
 		    </li>
236 273
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -252,15 +289,27 @@  discard block
 block discarded – undo
252 289
 		    <li><?php echo _("Type of Map:"); ?>
253 290
 			<select  class="selectpicker" onchange="mapType(this);">
254 291
 			    <?php
255
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
256
-				else $MapType = $_COOKIE['MapType'];
292
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
293
+					$MapType = $globalMapProvider;
294
+				} else {
295
+					$MapType = $_COOKIE['MapType'];
296
+				}
257 297
 			    ?>
258 298
 			    <?php
259 299
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
260 300
 			    ?>
261
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
262
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
263
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
301
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
302
+	print ' selected';
303
+}
304
+?>>Bing-Aerial</option>
305
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
306
+	print ' selected';
307
+}
308
+?>>Bing-Hybrid</option>
309
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
310
+	print ' selected';
311
+}
312
+?>>Bing-Road</option>
264 313
 			    <?php
265 314
 				}
266 315
 			    ?>
@@ -270,56 +319,131 @@  discard block
 block discarded – undo
270 319
 			    <?php
271 320
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
272 321
 			    ?>
273
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
274
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
275
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
322
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
323
+	print ' selected';
324
+}
325
+?>>Here-Aerial</option>
326
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
327
+	print ' selected';
328
+}
329
+?>>Here-Hybrid</option>
330
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
331
+	print ' selected';
332
+}
333
+?>>Here-Road</option>
276 334
 			    <?php
277 335
 				    }
278 336
 			    ?>
279 337
 			    <?php
280 338
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
281 339
 			    ?>
282
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
283
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
284
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
285
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
340
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
341
+	print ' selected';
342
+}
343
+?>>Google Roadmap</option>
344
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
345
+	print ' selected';
346
+}
347
+?>>Google Satellite</option>
348
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
349
+	print ' selected';
350
+}
351
+?>>Google Hybrid</option>
352
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
353
+	print ' selected';
354
+}
355
+?>>Google Terrain</option>
286 356
 			    <?php
287 357
 				    }
288 358
 			    ?>
289 359
 			    <?php
290 360
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
291 361
 			    ?>
292
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
293
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
294
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
362
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
363
+	print ' selected';
364
+}
365
+?>>MapQuest-OSM</option>
366
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
367
+	print ' selected';
368
+}
369
+?>>MapQuest-Aerial</option>
370
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
371
+	print ' selected';
372
+}
373
+?>>MapQuest-Hybrid</option>
295 374
 			    <?php
296 375
 				    }
297 376
 			    ?>
298
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
377
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
378
+	print ' selected';
379
+}
380
+?>>Yandex</option>
299 381
 			    <?php
300 382
 				}
301 383
 			    ?>
302 384
 			    <?php
303 385
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
304
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
305
-					else $MapBoxId = $_COOKIE['MapTypeId'];
386
+					if (!isset($_COOKIE['MapTypeId'])) {
387
+						$MapBoxId = 'default';
388
+					} else {
389
+						$MapBoxId = $_COOKIE['MapTypeId'];
390
+					}
306 391
 			    ?>
307
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
308
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
309
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
310
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
311
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
312
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
313
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
314
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
315
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
316
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
317
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
318
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
392
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
393
+	print ' selected';
394
+}
395
+?>>Mapbox default</option>
396
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
397
+	print ' selected';
398
+}
399
+?>>Mapbox streets</option>
400
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
401
+	print ' selected';
402
+}
403
+?>>Mapbox light</option>
404
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
405
+	print ' selected';
406
+}
407
+?>>Mapbox dark</option>
408
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
409
+	print ' selected';
410
+}
411
+?>>Mapbox satellite</option>
412
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
413
+	print ' selected';
414
+}
415
+?>>Mapbox streets-satellite</option>
416
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
417
+	print ' selected';
418
+}
419
+?>>Mapbox streets-basic</option>
420
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
421
+	print ' selected';
422
+}
423
+?>>Mapbox comic</option>
424
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
425
+	print ' selected';
426
+}
427
+?>>Mapbox outdoors</option>
428
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
429
+	print ' selected';
430
+}
431
+?>>Mapbox pencil</option>
432
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
433
+	print ' selected';
434
+}
435
+?>>Mapbox pirates</option>
436
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
437
+	print ' selected';
438
+}
439
+?>>Mapbox emerald</option>
319 440
 			    <?php
320 441
 				    }
321 442
 			    ?>
322
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
443
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
444
+	print ' selected';
445
+}
446
+?>>OpenStreetMap</option>
323 447
 			</select>
324 448
 		    </li>
325 449
 <?php
@@ -327,10 +451,22 @@  discard block
 block discarded – undo
327 451
 ?>
328 452
 		    <li><?php echo _("Type of Terrain:"); ?>
329 453
 			<select  class="selectpicker" onchange="terrainType(this);">
330
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
331
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
332
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
333
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
454
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
455
+	print ' selected';
456
+}
457
+?>>stk terrain</option>
458
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
459
+	print ' selected';
460
+}
461
+?>>ellipsoid</option>
462
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
463
+	print ' selected';
464
+}
465
+?>>vr terrain</option>
466
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
467
+	print ' selected';
468
+}
469
+?>>ArticDEM</option>
334 470
 			</select>
335 471
 		    </li>
336 472
 <?php
@@ -342,33 +478,69 @@  discard block
 block discarded – undo
342 478
 <?php
343 479
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
344 480
 ?>
345
-		    <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>
346
-		    <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>
347
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
348
-		    <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>
349
-		    <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>
481
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
482
+	print 'checked';
483
+}
484
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
485
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
486
+	print 'checked';
487
+}
488
+?> ><?php echo _("Display flight path"); ?></label></div></li>
489
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) {
490
+	print 'checked';
491
+}
492
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
493
+		    <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)) {
494
+	print 'checked';
495
+}
496
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
497
+		    <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)) {
498
+	print 'checked';
499
+}
500
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
350 501
 <?php
351 502
 	}
352 503
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
353 504
 ?>
354
-		    <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>
505
+		    <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)) {
506
+	print 'checked';
507
+}
508
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
355 509
 <?php
356 510
 	}
357 511
     }
358 512
 ?>
359
-		    <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>
360
-		    <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>
361
-		    <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>
362
-		    <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>
513
+		    <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'])) {
514
+	print 'checked';
515
+}
516
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
517
+		    <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))) {
518
+	print 'checked';
519
+}
520
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
521
+		    <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))) {
522
+	print 'checked';
523
+}
524
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
525
+		    <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))) {
526
+	print 'checked';
527
+}
528
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
363 529
 <?php
364 530
 	if (isset($globalFires)) {
365 531
 ?>
366
-		    <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>
532
+		    <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))) {
533
+	print 'checked';
534
+}
535
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
367 536
 <?php
368 537
 	}
369 538
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
370 539
 ?>
371
-		    <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>
540
+		    <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')) {
541
+	print 'checked';
542
+}
543
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
372 544
 <?php
373 545
     }
374 546
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -381,17 +553,25 @@  discard block
 block discarded – undo
381 553
 			if (function_exists('array_column')) {
382 554
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
383 555
 		    ?>
384
-		    <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>
556
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
557
+	print 'checked';
558
+}
559
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
385 560
 		    <?php
386 561
 			    }
387 562
 			} elseif (isset($globalSources)) {
388 563
 			    $dispolar = false;
389 564
 			    foreach ($globalSources as $testsource) {
390
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
565
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
566
+			        	$dispolar = true;
567
+			        }
391 568
 			    }
392 569
 			    if ($dispolar) {
393 570
 		    ?>
394
-		    <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>
571
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
572
+	print 'checked';
573
+}
574
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
395 575
 		    <?php
396 576
 			    }
397 577
 		        }
@@ -404,12 +584,22 @@  discard block
 block discarded – undo
404 584
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
405 585
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
406 586
 		    ?>
407
-		    <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>
587
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
588
+	print 'checked';
589
+}
590
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
408 591
 		    <?php 
409 592
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
410 593
 		    ?>
411 594
 		    <li><?php echo _("Aircraft icon color:"); ?>
412
-			<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 '1a3151'; ?>">
595
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
596
+	print $_COOKIE['IconColor'];
597
+} elseif (isset($globalAircraftIconColor)) {
598
+	print $globalAircraftIconColor;
599
+} else {
600
+	print '1a3151';
601
+}
602
+?>">
413 603
 		    </li>
414 604
 		    <?php
415 605
 				}
@@ -421,7 +611,14 @@  discard block
 block discarded – undo
421 611
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
422 612
 		    ?>
423 613
 		    <li><?php echo _("Marine icon color:"); ?>
424
-			<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'; ?>">
614
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
615
+	print $_COOKIE['MarineIconColor'];
616
+} elseif (isset($globalMarineIconColor)) {
617
+	print $globalMarineIconColor;
618
+} else {
619
+	print '1a3151';
620
+}
621
+?>">
425 622
 		    </li>
426 623
 		    <?php
427 624
 			    }
@@ -432,7 +629,14 @@  discard block
 block discarded – undo
432 629
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
433 630
 		    ?>
434 631
 		    <li><?php echo _("Tracker icon color:"); ?>
435
-			<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'; ?>">
632
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
633
+	print $_COOKIE['TrackerIconColor'];
634
+} elseif (isset($globalTrackerIconColor)) {
635
+	print $globalTrackerIconColor;
636
+} else {
637
+	print '1a3151';
638
+}
639
+?>">
436 640
 		    </li>
437 641
 		    <?php
438 642
 			    }
@@ -443,8 +647,22 @@  discard block
 block discarded – undo
443 647
 		    ?>
444 648
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
445 649
 			<div class="range">
446
-			    <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'; ?>">
447
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
650
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
651
+	print $_COOKIE['AirportZoom'];
652
+} elseif (isset($globalAirportZoom)) {
653
+	print $globalAirportZoom;
654
+} else {
655
+	print '7';
656
+}
657
+?>">
658
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
659
+	print $_COOKIE['AirportZoom'];
660
+} elseif (isset($globalAirportZoom)) {
661
+	print $globalAirportZoom;
662
+} else {
663
+	print '7';
664
+}
665
+?></output>
448 666
 			</div>
449 667
 		    </li>
450 668
 		    <?php
@@ -456,10 +674,23 @@  discard block
 block discarded – undo
456 674
 <?php
457 675
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
458 676
 ?>
459
-		    <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>
460
-		    <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"); ?></li>
677
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
678
+	print 'checked';
679
+}
680
+?> ><?php echo _("Use airlines liveries"); ?></li>
681
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
682
+	print 'checked';
683
+}
684
+?> ><?php echo _("Force Aircraft color"); ?></li>
461 685
 		    <li><?php echo _("Aircraft icon color:"); ?>
462
-			<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'; ?>">
686
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
687
+	print $_COOKIE['IconColor'];
688
+} elseif (isset($globalAircraftIconColor)) {
689
+	print $globalAircraftIconColor;
690
+} else {
691
+	print 'ff0000';
692
+}
693
+?>">
463 694
 		    </li>
464 695
 <?php
465 696
 	}
@@ -467,9 +698,19 @@  discard block
 block discarded – undo
467 698
 <?php
468 699
 	if (isset($globalMarine) && $globalMarine === TRUE) {
469 700
 ?>
470
-		    <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"); ?></li>
701
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
702
+	print 'checked';
703
+}
704
+?> ><?php echo _("Force Marine color"); ?></li>
471 705
 		    <li><?php echo _("Marine icon color:"); ?>
472
-			<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'; ?>">
706
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
707
+	print $_COOKIE['MarineIconColor'];
708
+} elseif (isset($globalMarineIconColor)) {
709
+	print $globalMarineIconColor;
710
+} else {
711
+	print 'ff0000';
712
+}
713
+?>">
473 714
 		    </li>
474 715
 <?php
475 716
 	}
@@ -477,9 +718,19 @@  discard block
 block discarded – undo
477 718
 <?php
478 719
 	if (isset($globalTracker) && $globalTracker === TRUE) {
479 720
 ?>
480
-		    <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"); ?></li>
721
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
722
+	print 'checked';
723
+}
724
+?> ><?php echo _("Force Tracker color"); ?></li>
481 725
 		    <li><?php echo _("Tracker icon color:"); ?>
482
-			<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'; ?>">
726
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
727
+	print $_COOKIE['TrackerIconColor'];
728
+} elseif (isset($globalTrackerIconColor)) {
729
+	print $globalTrackerIconColor;
730
+} else {
731
+	print 'ff0000';
732
+}
733
+?>">
483 734
 		    </li>
484 735
 <?php
485 736
 	}
@@ -487,22 +738,46 @@  discard block
 block discarded – undo
487 738
 ?>
488 739
 		    <li><?php echo _("Distance unit:"); ?>
489 740
 			<select class="selectpicker" onchange="unitdistance(this);">
490
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
491
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
492
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
741
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
742
+	echo ' selected';
743
+}
744
+?>>km</option>
745
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
746
+	echo ' selected';
747
+}
748
+?>>nm</option>
749
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
750
+	echo ' selected';
751
+}
752
+?>>mi</option>
493 753
 		        </select>
494 754
 		    </li>
495 755
 		    <li><?php echo _("Altitude unit:"); ?>
496 756
 			<select class="selectpicker" onchange="unitaltitude(this);">
497
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
498
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
757
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
758
+	echo ' selected';
759
+}
760
+?>>m</option>
761
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
762
+	echo ' selected';
763
+}
764
+?>>feet</option>
499 765
 		        </select>
500 766
 		    </li>
501 767
 		    <li><?php echo _("Speed unit:"); ?>
502 768
 			<select class="selectpicker" onchange="unitspeed(this);">
503
-			    <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>
504
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
505
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
769
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
770
+	echo ' selected';
771
+}
772
+?>>km/h</option>
773
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
774
+	echo ' selected';
775
+}
776
+?>>mph</option>
777
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
778
+	echo ' selected';
779
+}
780
+?>>knots</option>
506 781
 		        </select>
507 782
 		    </li>
508 783
 
@@ -520,9 +795,18 @@  discard block
 block discarded – undo
520 795
 		    <?php
521 796
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
522 797
 		    ?>
523
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
524
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
525
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
798
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
799
+	print 'checked';
800
+}
801
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
802
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
803
+	print 'checked';
804
+}
805
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
806
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
807
+	print 'checked';
808
+}
809
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
526 810
 		    <?php
527 811
 			}
528 812
 		    ?>
@@ -530,10 +814,16 @@  discard block
 block discarded – undo
530 814
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
531 815
 		    ?>
532 816
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
533
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
817
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
818
+	print 'checked';
819
+}
820
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
534 821
 			<?php } ?>
535 822
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
536
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
823
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
824
+	print 'checked';
825
+}
826
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
537 827
 			<?php } ?>
538 828
 		    <?php
539 829
 			}
@@ -550,7 +840,9 @@  discard block
 block discarded – undo
550 840
 				}
551 841
 				foreach($allairlinenames as $airline) {
552 842
 					$airline_name = $airline['airline_name'];
553
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
843
+					if (strlen($airline_name) > 30) {
844
+						$airline_name = substr($airline_name,0,30).'...';
845
+					}
554 846
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
555 847
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
556 848
 					} else {
@@ -568,7 +860,10 @@  discard block
 block discarded – undo
568 860
 		    <li><?php echo _("Display alliance:"); ?>
569 861
 		    <br/>
570 862
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
571
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
863
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
864
+	echo ' selected';
865
+}
866
+?>><?php echo _("All"); ?></option>
572 867
 			    <?php
573 868
 				foreach($allalliancenames as $alliance) {
574 869
 					$alliance_name = $alliance['alliance'];
@@ -627,10 +922,22 @@  discard block
 block discarded – undo
627 922
 		    ?>
628 923
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
629 924
 			<select class="selectpicker" onchange="airlinestype(this);">
630
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
631
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
632
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
633
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
925
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
926
+	echo ' selected';
927
+}
928
+?>><?php echo _("All"); ?></option>
929
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
930
+	echo ' selected';
931
+}
932
+?>><?php echo _("Passenger"); ?></option>
933
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
934
+	echo ' selected';
935
+}
936
+?>><?php echo _("Cargo"); ?></option>
937
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
938
+	echo ' selected';
939
+}
940
+?>><?php echo _("Military"); ?></option>
634 941
 			</select>
635 942
 		    </li>
636 943
 		    <?php
@@ -644,14 +951,20 @@  discard block
 block discarded – undo
644 951
 		    ?>
645 952
 		    <li>
646 953
 			<?php echo _("Display vessels with MMSI:"); ?>
647
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
954
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
955
+	print $_COOKIE['filter_mmsi'];
956
+}
957
+?>" />
648 958
 		    </li>
649 959
 		    <?php
650 960
 			}
651 961
 		    ?>
652 962
 		    <li>
653 963
 			<?php echo _("Display with ident:"); ?>
654
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
964
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
965
+	print $_COOKIE['filter_ident'];
966
+}
967
+?>" />
655 968
 		    </li>
656 969
 		</ul>
657 970
 	    </form>
@@ -667,7 +980,10 @@  discard block
 block discarded – undo
667 980
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
668 981
 	    <form>
669 982
 		<ul>
670
-		    <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>
983
+		    <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'])) {
984
+	print 'checked';
985
+}
986
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
671 987
 		    <li><?php echo _("Type:"); ?>
672 988
 			<select class="selectpicker" multiple onchange="sattypes(this);">
673 989
 			    <?php
@@ -675,25 +991,45 @@  discard block
 block discarded – undo
675 991
 				$types = $Satellite->get_tle_types();
676 992
 				foreach ($types as $type) {
677 993
 					$type_name = $type['tle_type'];
678
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
679
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
680
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
681
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
682
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
683
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
684
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
685
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
686
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
687
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
688
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
689
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
690
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
691
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
692
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
693
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
694
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
695
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
696
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
994
+					if ($type_name == 'musson') {
995
+						$type_name = 'Russian LEO Navigation';
996
+					} else if ($type_name == 'nnss') {
997
+						$type_name = 'Navi Navigation Satellite System';
998
+					} else if ($type_name == 'sbas') {
999
+						$type_name = 'Satellite-Based Augmentation System';
1000
+					} else if ($type_name == 'glo-ops') {
1001
+						$type_name = 'Glonass Operational';
1002
+					} else if ($type_name == 'gps-ops') {
1003
+						$type_name = 'GPS Operational';
1004
+					} else if ($type_name == 'argos') {
1005
+						$type_name = 'ARGOS Data Collection System';
1006
+					} else if ($type_name == 'tdrss') {
1007
+						$type_name = 'Tracking and Data Relay Satellite System';
1008
+					} else if ($type_name == 'sarsat') {
1009
+						$type_name = 'Search & Rescue';
1010
+					} else if ($type_name == 'dmc') {
1011
+						$type_name = 'Disaster Monitoring';
1012
+					} else if ($type_name == 'resource') {
1013
+						$type_name = 'Earth Resources';
1014
+					} else if ($type_name == 'stations') {
1015
+						$type_name = 'Space Stations';
1016
+					} else if ($type_name == 'geo') {
1017
+						$type_name = 'Geostationary';
1018
+					} else if ($type_name == 'amateur') {
1019
+						$type_name = 'Amateur Radio';
1020
+					} else if ($type_name == 'x-comm') {
1021
+						$type_name = 'Experimental';
1022
+					} else if ($type_name == 'other-comm') {
1023
+						$type_name = 'Other Comm';
1024
+					} else if ($type_name == 'science') {
1025
+						$type_name = 'Space & Earth Science';
1026
+					} else if ($type_name == 'military') {
1027
+						$type_name = 'Miscellaneous Military';
1028
+					} else if ($type_name == 'radar') {
1029
+						$type_name = 'Radar Calibration';
1030
+					} else if ($type_name == 'tle-new') {
1031
+						$type_name = 'Last 30 days launches';
1032
+					}
697 1033
 					
698 1034
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
699 1035
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
require/class.MarineLive.php 2 patches
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 
92 92
 	/**
93
-	* Gets all the spotter information based on the latest data entry
94
-	*
95
-	* @return Array the spotter information
96
-	*
97
-	*/
93
+	 * Gets all the spotter information based on the latest data entry
94
+	 *
95
+	 * @return Array the spotter information
96
+	 *
97
+	 */
98 98
 	public function getLiveMarineData($limit = '', $sort = '', $filter = array())
99 99
 	{
100 100
 		global $globalDBdriver, $globalLiveInterval;
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
 	}
138 138
 
139 139
 	/**
140
-	* Gets Minimal Live Spotter data
141
-	*
142
-	* @return Array the spotter information
143
-	*
144
-	*/
140
+	 * Gets Minimal Live Spotter data
141
+	 *
142
+	 * @return Array the spotter information
143
+	 *
144
+	 */
145 145
 	public function getMinLiveMarineData($filter = array())
146 146
 	{
147 147
 		global $globalDBdriver, $globalLiveInterval;
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 
173 173
 	/**
174
-	* Gets Minimal Live Spotter data since xx seconds
175
-	*
176
-	* @return Array the spotter information
177
-	*
178
-	*/
174
+	 * Gets Minimal Live Spotter data since xx seconds
175
+	 *
176
+	 * @return Array the spotter information
177
+	 *
178
+	 */
179 179
 	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false)
180 180
 	{
181 181
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
 	}
247 247
 
248 248
 	/**
249
-	* Gets number of latest data entry
250
-	*
251
-	* @return String number of entry
252
-	*
253
-	*/
249
+	 * Gets number of latest data entry
250
+	 *
251
+	 * @return String number of entry
252
+	 *
253
+	 */
254 254
 	public function getLiveMarineCount($filter = array())
255 255
 	{
256 256
 		global $globalDBdriver, $globalLiveInterval;
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
 	}
276 276
 
277 277
 	/**
278
-	* Gets all the spotter information based on the latest data entry and coord
279
-	*
280
-	* @return Array the spotter information
281
-	*
282
-	*/
278
+	 * Gets all the spotter information based on the latest data entry and coord
279
+	 *
280
+	 * @return Array the spotter information
281
+	 *
282
+	 */
283 283
 	public function getLiveMarineDatabyCoord($coord, $filter = array())
284 284
 	{
285 285
 		global $globalDBdriver, $globalLiveInterval;
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
 	}
304 304
 
305 305
 	/**
306
-	* Gets all the spotter information based on the latest data entry and coord
307
-	*
308
-	* @return Array the spotter information
309
-	*
310
-	*/
306
+	 * Gets all the spotter information based on the latest data entry and coord
307
+	 *
308
+	 * @return Array the spotter information
309
+	 *
310
+	 */
311 311
 	public function getMinLiveMarineDatabyCoord($coord, $filter = array())
312 312
 	{
313 313
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
 	}
377 377
 
378 378
 	/**
379
-	* Gets all the spotter information based on a user's latitude and longitude
380
-	*
381
-	* @return Array the spotter information
382
-	*
383
-	*/
379
+	 * Gets all the spotter information based on a user's latitude and longitude
380
+	 *
381
+	 * @return Array the spotter information
382
+	 *
383
+	 */
384 384
 	public function getLatestMarineForLayar($lat, $lng, $radius, $interval)
385 385
 	{
386 386
 		$Marine = new Marine($this->db);
@@ -393,75 +393,75 @@  discard block
 block discarded – undo
393 393
 		if ($lng != '')
394 394
 		{
395 395
 			if (!is_numeric($lng))
396
-                        {
397
-                                return false;
398
-                        }
399
-                }
400
-
401
-                if ($radius != '')
402
-                {
403
-                        if (!is_numeric($radius))
404
-                        {
405
-                                return false;
406
-                        }
407
-                }
396
+						{
397
+								return false;
398
+						}
399
+				}
400
+
401
+				if ($radius != '')
402
+				{
403
+						if (!is_numeric($radius))
404
+						{
405
+								return false;
406
+						}
407
+				}
408 408
 		$additional_query = '';
409 409
 		if ($interval != '')
410
-                {
411
-                        if (!is_string($interval))
412
-                        {
413
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
414
-			        return false;
415
-                        } else {
416
-                if ($interval == '1m')
417
-                {
418
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
419
-                } else if ($interval == '15m'){
420
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
421
-                } 
422
-            }
423
-                } else {
424
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
425
-        }
426
-
427
-                $query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
410
+				{
411
+						if (!is_string($interval))
412
+						{
413
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
414
+					return false;
415
+						} else {
416
+				if ($interval == '1m')
417
+				{
418
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
419
+				} else if ($interval == '15m'){
420
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
421
+				} 
422
+			}
423
+				} else {
424
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
425
+		}
426
+
427
+				$query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
428 428
                    WHERE marine_live.latitude <> '' 
429 429
                                    AND marine_live.longitude <> '' 
430 430
                    ".$additional_query."
431 431
                    HAVING distance < :radius  
432 432
                                    ORDER BY distance";
433 433
 
434
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
434
+				$spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
435 435
 
436
-                return $spotter_array;
437
-        }
436
+				return $spotter_array;
437
+		}
438 438
 
439 439
     
440
-        /**
441
-	* Gets all the spotter information based on a particular callsign
442
-	*
443
-	* @return Array the spotter information
444
-	*
445
-	*/
440
+		/**
441
+		 * Gets all the spotter information based on a particular callsign
442
+		 *
443
+		 * @return Array the spotter information
444
+		 *
445
+		 */
446 446
 	public function getLastLiveMarineDataByIdent($ident)
447 447
 	{
448 448
 		$Marine = new Marine($this->db);
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
452
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
452
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
453 453
 
454 454
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
458 458
 
459
-        /**
460
-	* Gets all the spotter information based on a particular callsign
461
-	*
462
-	* @return Array the spotter information
463
-	*
464
-	*/
459
+		/**
460
+		 * Gets all the spotter information based on a particular callsign
461
+		 *
462
+		 * @return Array the spotter information
463
+		 *
464
+		 */
465 465
 	public function getDateLiveMarineDataByIdent($ident,$date)
466 466
 	{
467 467
 		$Marine = new Marine($this->db);
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 	}
475 475
 
476 476
 	/**
477
-	* Gets all the spotter information based on a particular MMSI
478
-	*
479
-	* @return Array the spotter information
480
-	*
481
-	*/
477
+	 * Gets all the spotter information based on a particular MMSI
478
+	 *
479
+	 * @return Array the spotter information
480
+	 *
481
+	 */
482 482
 	public function getDateLiveMarineDataByMMSI($mmsi,$date)
483 483
 	{
484 484
 		$Marine = new Marine($this->db);
@@ -490,51 +490,51 @@  discard block
 block discarded – undo
490 490
 		return $spotter_array;
491 491
 	}
492 492
 
493
-        /**
494
-	* Gets last spotter information based on a particular callsign
495
-	*
496
-	* @return Array the spotter information
497
-	*
498
-	*/
493
+		/**
494
+		 * Gets last spotter information based on a particular callsign
495
+		 *
496
+		 * @return Array the spotter information
497
+		 *
498
+		 */
499 499
 	public function getLastLiveMarineDataById($id)
500 500
 	{
501 501
 		$Marine = new Marine($this->db);
502 502
 		date_default_timezone_set('UTC');
503 503
 
504 504
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
505
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
505
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
506 506
 
507 507
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
508 508
 
509 509
 		return $spotter_array;
510 510
 	}
511 511
 
512
-        /**
513
-	* Gets last spotter information based on a particular callsign
514
-	*
515
-	* @return Array the spotter information
516
-	*
517
-	*/
512
+		/**
513
+		 * Gets last spotter information based on a particular callsign
514
+		 *
515
+		 * @return Array the spotter information
516
+		 *
517
+		 */
518 518
 	public function getDateLiveMarineDataById($id,$date)
519 519
 	{
520 520
 		$Marine = new Marine($this->db);
521 521
 		date_default_timezone_set('UTC');
522 522
 
523 523
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
524
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
525
-                $date = date('c',$date);
524
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
525
+				$date = date('c',$date);
526 526
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
527 527
 
528 528
 		return $spotter_array;
529 529
 	}
530 530
 
531 531
 
532
-        /**
533
-	* Gets all the spotter information based on a particular id
534
-	*
535
-	* @return Array the spotter information
536
-	*
537
-	*/
532
+		/**
533
+		 * Gets all the spotter information based on a particular id
534
+		 *
535
+		 * @return Array the spotter information
536
+		 *
537
+		 */
538 538
 	public function getAllLiveMarineDataById($id,$liveinterval = false)
539 539
 	{
540 540
 		global $globalDBdriver, $globalLiveInterval;
@@ -562,18 +562,18 @@  discard block
 block discarded – undo
562 562
 		return $spotter_array;
563 563
 	}
564 564
 
565
-        /**
566
-	* Gets all the spotter information based on a particular ident
567
-	*
568
-	* @return Array the spotter information
569
-	*
570
-	*/
565
+		/**
566
+		 * Gets all the spotter information based on a particular ident
567
+		 *
568
+		 * @return Array the spotter information
569
+		 *
570
+		 */
571 571
 	public function getAllLiveMarineDataByIdent($ident)
572 572
 	{
573 573
 		date_default_timezone_set('UTC');
574 574
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
575 575
 		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
576
-    		try {
576
+			try {
577 577
 			
578 578
 			$sth = $this->db->prepare($query);
579 579
 			$sth->execute(array(':ident' => $ident));
@@ -587,23 +587,23 @@  discard block
 block discarded – undo
587 587
 
588 588
 
589 589
 	/**
590
-	* Deletes all info in the table
591
-	*
592
-	* @return String success or false
593
-	*
594
-	*/
590
+	 * Deletes all info in the table
591
+	 *
592
+	 * @return String success or false
593
+	 *
594
+	 */
595 595
 	public function deleteLiveMarineData()
596 596
 	{
597 597
 		global $globalDBdriver;
598 598
 		if ($globalDBdriver == 'mysql') {
599 599
 			//$query  = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date";
600 600
 			$query  = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date';
601
-            		//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
601
+					//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
602 602
 		} else {
603 603
 			$query  = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date";
604 604
 		}
605 605
         
606
-    		try {
606
+			try {
607 607
 			
608 608
 			$sth = $this->db->prepare($query);
609 609
 			$sth->execute();
@@ -615,18 +615,18 @@  discard block
 block discarded – undo
615 615
 	}
616 616
 
617 617
 	/**
618
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
619
-	*
620
-	* @return String success or false
621
-	*
622
-	*/
618
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
619
+	 *
620
+	 * @return String success or false
621
+	 *
622
+	 */
623 623
 	public function deleteLiveMarineDataNotUpdated()
624 624
 	{
625 625
 		global $globalDBdriver, $globalDebug;
626 626
 		if ($globalDBdriver == 'mysql') {
627 627
 			//$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0';
628
-    			$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
629
-    			try {
628
+				$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
629
+				try {
630 630
 				
631 631
 				$sth = $this->db->prepare($query);
632 632
 				$sth->execute();
@@ -634,8 +634,8 @@  discard block
 block discarded – undo
634 634
 				return "error";
635 635
 			}
636 636
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
637
-                        $i = 0;
638
-                        $j =0;
637
+						$i = 0;
638
+						$j =0;
639 639
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
640 640
 			foreach($all as $row)
641 641
 			{
@@ -643,20 +643,20 @@  discard block
 block discarded – undo
643 643
 				$j++;
644 644
 				if ($j == 30) {
645 645
 					if ($globalDebug) echo ".";
646
-				    	try {
646
+						try {
647 647
 						
648 648
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
649 649
 						$sth->execute();
650 650
 					} catch(PDOException $e) {
651 651
 						return "error";
652 652
 					}
653
-                                	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
654
-                                	$j = 0;
653
+									$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
654
+									$j = 0;
655 655
 				}
656 656
 				$query_delete .= "'".$row['fammarine_id']."',";
657 657
 			}
658 658
 			if ($i > 0) {
659
-    				try {
659
+					try {
660 660
 					
661 661
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
662 662
 					$sth->execute();
@@ -667,9 +667,9 @@  discard block
 block discarded – undo
667 667
 			return "success";
668 668
 		} elseif ($globalDBdriver == 'pgsql') {
669 669
 			//$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0";
670
-    			//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
671
-    			$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
672
-    			try {
670
+				//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
671
+				$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
672
+				try {
673 673
 				
674 674
 				$sth = $this->db->prepare($query);
675 675
 				$sth->execute();
@@ -713,17 +713,17 @@  discard block
 block discarded – undo
713 713
 	}
714 714
 
715 715
 	/**
716
-	* Deletes all info in the table for an ident
717
-	*
718
-	* @return String success or false
719
-	*
720
-	*/
716
+	 * Deletes all info in the table for an ident
717
+	 *
718
+	 * @return String success or false
719
+	 *
720
+	 */
721 721
 	public function deleteLiveMarineDataByIdent($ident)
722 722
 	{
723 723
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
724 724
 		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
725 725
         
726
-    		try {
726
+			try {
727 727
 			
728 728
 			$sth = $this->db->prepare($query);
729 729
 			$sth->execute(array(':ident' => $ident));
@@ -735,17 +735,17 @@  discard block
 block discarded – undo
735 735
 	}
736 736
 
737 737
 	/**
738
-	* Deletes all info in the table for an id
739
-	*
740
-	* @return String success or false
741
-	*
742
-	*/
738
+	 * Deletes all info in the table for an id
739
+	 *
740
+	 * @return String success or false
741
+	 *
742
+	 */
743 743
 	public function deleteLiveMarineDataById($id)
744 744
 	{
745 745
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
746 746
 		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
747 747
         
748
-    		try {
748
+			try {
749 749
 			
750 750
 			$sth = $this->db->prepare($query);
751 751
 			$sth->execute(array(':id' => $id));
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 
759 759
 
760 760
 	/**
761
-	* Gets the aircraft ident within the last hour
762
-	*
763
-	* @return String the ident
764
-	*
765
-	*/
761
+	 * Gets the aircraft ident within the last hour
762
+	 *
763
+	 * @return String the ident
764
+	 *
765
+	 */
766 766
 	public function getIdentFromLastHour($ident)
767 767
 	{
768 768
 		global $globalDBdriver, $globalTimezone;
@@ -788,14 +788,14 @@  discard block
 block discarded – undo
788 788
 			$ident_result = $row['ident'];
789 789
 		}
790 790
 		return $ident_result;
791
-        }
791
+		}
792 792
 
793 793
 	/**
794
-	* Check recent aircraft
795
-	*
796
-	* @return String the ident
797
-	*
798
-	*/
794
+	 * Check recent aircraft
795
+	 *
796
+	 * @return String the ident
797
+	 *
798
+	 */
799 799
 	public function checkIdentRecent($ident)
800 800
 	{
801 801
 		global $globalDBdriver, $globalTimezone;
@@ -821,14 +821,14 @@  discard block
 block discarded – undo
821 821
 			$ident_result = $row['fammarine_id'];
822 822
 		}
823 823
 		return $ident_result;
824
-        }
824
+		}
825 825
 
826 826
 	/**
827
-	* Check recent aircraft by id
828
-	*
829
-	* @return String the ident
830
-	*
831
-	*/
827
+	 * Check recent aircraft by id
828
+	 *
829
+	 * @return String the ident
830
+	 *
831
+	 */
832 832
 	public function checkIdRecent($id)
833 833
 	{
834 834
 		global $globalDBdriver, $globalTimezone;
@@ -854,14 +854,14 @@  discard block
 block discarded – undo
854 854
 			$ident_result = $row['fammarine_id'];
855 855
 		}
856 856
 		return $ident_result;
857
-        }
857
+		}
858 858
 
859 859
 	/**
860
-	* Check recent aircraft by mmsi
861
-	*
862
-	* @return String the ident
863
-	*
864
-	*/
860
+	 * Check recent aircraft by mmsi
861
+	 *
862
+	 * @return String the ident
863
+	 *
864
+	 */
865 865
 	public function checkMMSIRecent($mmsi)
866 866
 	{
867 867
 		global $globalDBdriver, $globalTimezone;
@@ -887,19 +887,19 @@  discard block
 block discarded – undo
887 887
 			$ident_result = $row['fammarine_id'];
888 888
 		}
889 889
 		return $ident_result;
890
-        }
890
+		}
891 891
 
892 892
 	/**
893
-	* Adds a new spotter data
894
-	*
895
-	* @param String $fammarine_id the ID from flightaware
896
-	* @param String $ident the flight ident
897
-	* @param String $aircraft_icao the aircraft type
898
-	* @param String $departure_airport_icao the departure airport
899
-	* @param String $arrival_airport_icao the arrival airport
900
-	* @return String success or false
901
-	*
902
-	*/
893
+	 * Adds a new spotter data
894
+	 *
895
+	 * @param String $fammarine_id the ID from flightaware
896
+	 * @param String $ident the flight ident
897
+	 * @param String $aircraft_icao the aircraft type
898
+	 * @param String $departure_airport_icao the departure airport
899
+	 * @param String $arrival_airport_icao the arrival airport
900
+	 * @return String success or false
901
+	 *
902
+	 */
903 903
 	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
904 904
 	{
905 905
 		global $globalURL, $globalArchive, $globalDebug;
@@ -970,10 +970,10 @@  discard block
 block discarded – undo
970 970
 		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
971 971
 		
972 972
 
973
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
974
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
975
-            	if ($arrival_date == '') $arrival_date = NULL;
976
-            	$query = '';
973
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
974
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
975
+				if ($arrival_date == '') $arrival_date = NULL;
976
+				$query = '';
977 977
 		if ($globalArchive) {
978 978
 			if ($globalDebug) echo '-- Delete previous data -- ';
979 979
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30 30
 		if (isset($filter[0]['source'])) {
31
-			$filters = array_merge($filters,$filter);
31
+			$filters = array_merge($filters, $filter);
32 32
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
34 34
 		$filter_query_join = '';
35 35
 		$filter_query_where = '';
36
-		foreach($filters as $flt) {
36
+		foreach ($filters as $flt) {
37 37
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
38 38
 				if (isset($flt['source'])) {
39
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
39
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
40 40
 				} else {
41
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
41
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
42 42
 				}
43 43
 			}
44 44
 		}
45 45
 		if (isset($filter['source']) && !empty($filter['source'])) {
46
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
46
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
47 47
 		}
48 48
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
49 49
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
 					$filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'";
76 76
 				}
77 77
 			}
78
-			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id";
78
+			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id";
79 79
 		}
80 80
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
81
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
81
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
82 82
 		}
83 83
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
84 84
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
85 85
 		if ($filter_query_where != '') {
86
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
86
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
87 87
 		}
88 88
 		$filter_query = $filter_query_join.$filter_query_where;
89 89
 		return $filter_query;
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 		if ($limit != '')
107 107
 		{
108 108
 			$limit_array = explode(',', $limit);
109
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
110
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
109
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
110
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
111 111
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
112 112
 			{
113 113
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
123 123
 			}
124 124
 		}
125
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
125
+		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
126 126
 
127 127
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
128 128
 		if ($globalDBdriver == 'mysql') {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		} else {
132 132
 			$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query;
133 133
 		}
134
-		$spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true);
134
+		$spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true);
135 135
 
136 136
 		return $spotter_array;
137 137
 	}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		global $globalDBdriver, $globalLiveInterval;
148 148
 		date_default_timezone_set('UTC');
149 149
 
150
-		$filter_query = $this->getFilter($filter,true,true);
150
+		$filter_query = $this->getFilter($filter, true, true);
151 151
 
152 152
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
153 153
 		if ($globalDBdriver == 'mysql') {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		try {
162 162
 			$sth = $this->db->prepare($query);
163 163
 			$sth->execute();
164
-		} catch(PDOException $e) {
164
+		} catch (PDOException $e) {
165 165
 			echo $e->getMessage();
166 166
 			die;
167 167
 		}
@@ -176,19 +176,19 @@  discard block
 block discarded – undo
176 176
 	* @return Array the spotter information
177 177
 	*
178 178
 	*/
179
-	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false)
179
+	public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false)
180 180
 	{
181 181
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
182 182
 		date_default_timezone_set('UTC');
183 183
 		$usecoord = false;
184 184
 		if (is_array($coord) && !empty($coord)) {
185
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
186
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
187
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
188
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
185
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
186
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
187
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
188
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
189 189
 			$usecoord = true;
190 190
 		}
191
-		$filter_query = $this->getFilter($filter,true,true);
191
+		$filter_query = $this->getFilter($filter, true, true);
192 192
 
193 193
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194 194
 		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		try {
238 238
 			$sth = $this->db->prepare($query);
239 239
 			$sth->execute();
240
-		} catch(PDOException $e) {
240
+		} catch (PDOException $e) {
241 241
 			echo $e->getMessage();
242 242
 			die;
243 243
 		}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	public function getLiveMarineCount($filter = array())
255 255
 	{
256 256
 		global $globalDBdriver, $globalLiveInterval;
257
-		$filter_query = $this->getFilter($filter,true,true);
257
+		$filter_query = $this->getFilter($filter, true, true);
258 258
 
259 259
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
260 260
 		if ($globalDBdriver == 'mysql') {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 		try {
266 266
 			$sth = $this->db->prepare($query);
267 267
 			$sth->execute();
268
-		} catch(PDOException $e) {
268
+		} catch (PDOException $e) {
269 269
 			echo $e->getMessage();
270 270
 			die;
271 271
 		}
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 		$filter_query = $this->getFilter($filter);
289 289
 
290 290
 		if (is_array($coord)) {
291
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
292
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
293
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
294
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
291
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
292
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
293
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
294
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
295 295
 		} else return array();
296 296
 		if ($globalDBdriver == 'mysql') {
297 297
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id'.$filter_query;
@@ -313,13 +313,13 @@  discard block
 block discarded – undo
313 313
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
314 314
 		$Marine = new Marine($this->db);
315 315
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
316
-		$filter_query = $this->getFilter($filter,true,true);
316
+		$filter_query = $this->getFilter($filter, true, true);
317 317
 
318 318
 		if (is_array($coord)) {
319
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
320
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
321
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
322
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
319
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
320
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
321
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
322
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
323 323
 		} else return array();
324 324
 		/*
325 325
 		if ($globalDBdriver == 'mysql') {
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
 		*/
335 335
 		if ($globalDBdriver == 'mysql') {
336 336
 			if (isset($globalArchive) && $globalArchive === TRUE) {
337
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
337
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
338 338
 				    FROM marine_live 
339 339
 				    '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date 
340 340
 				    AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
341 341
 				    AND marine_live.latitude <> 0 AND marine_live.longitude <> 0';
342 342
 			} else {
343
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
343
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
344 344
 				    FROM marine_live 
345 345
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
346 346
 				    FROM marine_live l 
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
 			}
353 353
 		} else {
354 354
 			if (isset($globalArchive) && $globalArchive === TRUE) {
355
-				$query  = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
355
+				$query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
356 356
 				    FROM marine_live 
357 357
 				    ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date 
358 358
 				    AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
359 359
 				    AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
360 360
 				    AND marine_live.latitude <> '0' AND marine_live.longitude <> '0'";
361 361
 			} else {
362
-				$query  = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
362
+				$query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
363 363
 				    FROM marine_live 
364 364
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
365 365
 				    FROM marine_live l 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
                 if ($interval == '1m')
417 417
                 {
418 418
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
419
-                } else if ($interval == '15m'){
419
+                } else if ($interval == '15m') {
420 420
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
421 421
                 } 
422 422
             }
@@ -424,14 +424,14 @@  discard block
 block discarded – undo
424 424
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
425 425
         }
426 426
 
427
-                $query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
427
+                $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
428 428
                    WHERE marine_live.latitude <> '' 
429 429
                                    AND marine_live.longitude <> '' 
430 430
                    ".$additional_query."
431 431
                    HAVING distance < :radius  
432 432
                                    ORDER BY distance";
433 433
 
434
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
434
+                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
435 435
 
436 436
                 return $spotter_array;
437 437
         }
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
452
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
452
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
453 453
 
454
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
454
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
 	* @return Array the spotter information
463 463
 	*
464 464
 	*/
465
-	public function getDateLiveMarineDataByIdent($ident,$date)
465
+	public function getDateLiveMarineDataByIdent($ident, $date)
466 466
 	{
467 467
 		$Marine = new Marine($this->db);
468 468
 		date_default_timezone_set('UTC');
469 469
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
470 470
 		$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
471
-		$date = date('c',$date);
472
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
471
+		$date = date('c', $date);
472
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
473 473
 		return $spotter_array;
474 474
 	}
475 475
 
@@ -479,14 +479,14 @@  discard block
 block discarded – undo
479 479
 	* @return Array the spotter information
480 480
 	*
481 481
 	*/
482
-	public function getDateLiveMarineDataByMMSI($mmsi,$date)
482
+	public function getDateLiveMarineDataByMMSI($mmsi, $date)
483 483
 	{
484 484
 		$Marine = new Marine($this->db);
485 485
 		date_default_timezone_set('UTC');
486 486
 		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
487 487
 		$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
488
-		$date = date('c',$date);
489
-		$spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date));
488
+		$date = date('c', $date);
489
+		$spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date));
490 490
 		return $spotter_array;
491 491
 	}
492 492
 
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 		date_default_timezone_set('UTC');
503 503
 
504 504
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
505
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
505
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
506 506
 
507
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
507
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true);
508 508
 
509 509
 		return $spotter_array;
510 510
 	}
@@ -515,15 +515,15 @@  discard block
 block discarded – undo
515 515
 	* @return Array the spotter information
516 516
 	*
517 517
 	*/
518
-	public function getDateLiveMarineDataById($id,$date)
518
+	public function getDateLiveMarineDataById($id, $date)
519 519
 	{
520 520
 		$Marine = new Marine($this->db);
521 521
 		date_default_timezone_set('UTC');
522 522
 
523 523
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
524
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
525
-                $date = date('c',$date);
526
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
524
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
525
+                $date = date('c', $date);
526
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
527 527
 
528 528
 		return $spotter_array;
529 529
 	}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	* @return Array the spotter information
536 536
 	*
537 537
 	*/
538
-	public function getAllLiveMarineDataById($id,$liveinterval = false)
538
+	public function getAllLiveMarineDataById($id, $liveinterval = false)
539 539
 	{
540 540
 		global $globalDBdriver, $globalLiveInterval;
541 541
 		date_default_timezone_set('UTC');
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 		try {
555 555
 			$sth = $this->db->prepare($query);
556 556
 			$sth->execute(array(':id' => $id));
557
-		} catch(PDOException $e) {
557
+		} catch (PDOException $e) {
558 558
 			echo $e->getMessage();
559 559
 			die;
560 560
 		}
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
 	{
573 573
 		date_default_timezone_set('UTC');
574 574
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
575
-		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
575
+		$query = self::$global_query.' WHERE marine_live.ident = :ident';
576 576
     		try {
577 577
 			
578 578
 			$sth = $this->db->prepare($query);
579 579
 			$sth->execute(array(':ident' => $ident));
580
-		} catch(PDOException $e) {
580
+		} catch (PDOException $e) {
581 581
 			echo $e->getMessage();
582 582
 			die;
583 583
 		}
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 			
608 608
 			$sth = $this->db->prepare($query);
609 609
 			$sth->execute();
610
-		} catch(PDOException $e) {
610
+		} catch (PDOException $e) {
611 611
 			return "error";
612 612
 		}
613 613
 
@@ -630,14 +630,14 @@  discard block
 block discarded – undo
630 630
 				
631 631
 				$sth = $this->db->prepare($query);
632 632
 				$sth->execute();
633
-			} catch(PDOException $e) {
633
+			} catch (PDOException $e) {
634 634
 				return "error";
635 635
 			}
636 636
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
637 637
                         $i = 0;
638
-                        $j =0;
638
+                        $j = 0;
639 639
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
640
-			foreach($all as $row)
640
+			foreach ($all as $row)
641 641
 			{
642 642
 				$i++;
643 643
 				$j++;
@@ -645,9 +645,9 @@  discard block
 block discarded – undo
645 645
 					if ($globalDebug) echo ".";
646 646
 				    	try {
647 647
 						
648
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
648
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
649 649
 						$sth->execute();
650
-					} catch(PDOException $e) {
650
+					} catch (PDOException $e) {
651 651
 						return "error";
652 652
 					}
653 653
                                 	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
@@ -658,9 +658,9 @@  discard block
 block discarded – undo
658 658
 			if ($i > 0) {
659 659
     				try {
660 660
 					
661
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
661
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
662 662
 					$sth->execute();
663
-				} catch(PDOException $e) {
663
+				} catch (PDOException $e) {
664 664
 					return "error";
665 665
 				}
666 666
 			}
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 				
674 674
 				$sth = $this->db->prepare($query);
675 675
 				$sth->execute();
676
-			} catch(PDOException $e) {
676
+			} catch (PDOException $e) {
677 677
 				return "error";
678 678
 			}
679 679
 /*			$query_delete = "DELETE FROM marine_live WHERE fammarine_id IN (";
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 	public function deleteLiveMarineDataByIdent($ident)
722 722
 	{
723 723
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
724
-		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
724
+		$query = 'DELETE FROM marine_live WHERE ident = :ident';
725 725
         
726 726
     		try {
727 727
 			
728 728
 			$sth = $this->db->prepare($query);
729 729
 			$sth->execute(array(':ident' => $ident));
730
-		} catch(PDOException $e) {
730
+		} catch (PDOException $e) {
731 731
 			return "error";
732 732
 		}
733 733
 
@@ -743,13 +743,13 @@  discard block
 block discarded – undo
743 743
 	public function deleteLiveMarineDataById($id)
744 744
 	{
745 745
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
746
-		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
746
+		$query = 'DELETE FROM marine_live WHERE fammarine_id = :id';
747 747
         
748 748
     		try {
749 749
 			
750 750
 			$sth = $this->db->prepare($query);
751 751
 			$sth->execute(array(':id' => $id));
752
-		} catch(PDOException $e) {
752
+		} catch (PDOException $e) {
753 753
 			return "error";
754 754
 		}
755 755
 
@@ -767,13 +767,13 @@  discard block
 block discarded – undo
767 767
 	{
768 768
 		global $globalDBdriver, $globalTimezone;
769 769
 		if ($globalDBdriver == 'mysql') {
770
-			$query  = 'SELECT marine_live.ident FROM marine_live 
770
+			$query = 'SELECT marine_live.ident FROM marine_live 
771 771
 				WHERE marine_live.ident = :ident 
772 772
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
773 773
 				AND marine_live.date < UTC_TIMESTAMP()';
774 774
 			$query_data = array(':ident' => $ident);
775 775
 		} else {
776
-			$query  = "SELECT marine_live.ident FROM marine_live 
776
+			$query = "SELECT marine_live.ident FROM marine_live 
777 777
 				WHERE marine_live.ident = :ident 
778 778
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
779 779
 				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -782,8 +782,8 @@  discard block
 block discarded – undo
782 782
 		
783 783
 		$sth = $this->db->prepare($query);
784 784
 		$sth->execute($query_data);
785
-		$ident_result='';
786
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
785
+		$ident_result = '';
786
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
787 787
 		{
788 788
 			$ident_result = $row['ident'];
789 789
 		}
@@ -800,13 +800,13 @@  discard block
 block discarded – undo
800 800
 	{
801 801
 		global $globalDBdriver, $globalTimezone;
802 802
 		if ($globalDBdriver == 'mysql') {
803
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
803
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
804 804
 				WHERE marine_live.ident = :ident 
805 805
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
806 806
 //				AND marine_live.date < UTC_TIMESTAMP()";
807 807
 			$query_data = array(':ident' => $ident);
808 808
 		} else {
809
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
809
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
810 810
 				WHERE marine_live.ident = :ident 
811 811
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
812 812
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -815,8 +815,8 @@  discard block
 block discarded – undo
815 815
 		
816 816
 		$sth = $this->db->prepare($query);
817 817
 		$sth->execute($query_data);
818
-		$ident_result='';
819
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
818
+		$ident_result = '';
819
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
820 820
 		{
821 821
 			$ident_result = $row['fammarine_id'];
822 822
 		}
@@ -833,13 +833,13 @@  discard block
 block discarded – undo
833 833
 	{
834 834
 		global $globalDBdriver, $globalTimezone;
835 835
 		if ($globalDBdriver == 'mysql') {
836
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
836
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
837 837
 				WHERE marine_live.fammarine_id = :id 
838 838
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
839 839
 //				AND marine_live.date < UTC_TIMESTAMP()";
840 840
 			$query_data = array(':id' => $id);
841 841
 		} else {
842
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
842
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
843 843
 				WHERE marine_live.fammarine_id = :id 
844 844
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
845 845
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
 		
849 849
 		$sth = $this->db->prepare($query);
850 850
 		$sth->execute($query_data);
851
-		$ident_result='';
852
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
851
+		$ident_result = '';
852
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
853 853
 		{
854 854
 			$ident_result = $row['fammarine_id'];
855 855
 		}
@@ -866,13 +866,13 @@  discard block
 block discarded – undo
866 866
 	{
867 867
 		global $globalDBdriver, $globalTimezone;
868 868
 		if ($globalDBdriver == 'mysql') {
869
-			$query  = 'SELECT marine_live.fammarine_id FROM marine_live 
869
+			$query = 'SELECT marine_live.fammarine_id FROM marine_live 
870 870
 				WHERE marine_live.mmsi = :mmsi 
871 871
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
872 872
 //				AND marine_live.date < UTC_TIMESTAMP()";
873 873
 			$query_data = array(':mmsi' => $mmsi);
874 874
 		} else {
875
-			$query  = "SELECT marine_live.fammarine_id FROM marine_live 
875
+			$query = "SELECT marine_live.fammarine_id FROM marine_live 
876 876
 				WHERE marine_live.mmsi = :mmsi 
877 877
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
878 878
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -881,8 +881,8 @@  discard block
 block discarded – undo
881 881
 		
882 882
 		$sth = $this->db->prepare($query);
883 883
 		$sth->execute($query_data);
884
-		$ident_result='';
885
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
884
+		$ident_result = '';
885
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
886 886
 		{
887 887
 			$ident_result = $row['fammarine_id'];
888 888
 		}
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 	* @return String success or false
901 901
 	*
902 902
 	*/
903
-	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
903
+	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '')
904 904
 	{
905 905
 		global $globalURL, $globalArchive, $globalDebug;
906 906
 		$Common = new Common();
@@ -952,26 +952,26 @@  discard block
 block discarded – undo
952 952
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
953 953
 
954 954
         
955
-		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
956
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
957
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
958
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
959
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
960
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
961
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
962
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
963
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
964
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
965
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
966
-		$status = filter_var($status,FILTER_SANITIZE_STRING);
967
-		$imo = filter_var($imo,FILTER_SANITIZE_STRING);
968
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
969
-		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
970
-		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
955
+		$fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING);
956
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
957
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
958
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
959
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
960
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
961
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
962
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
963
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
964
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
965
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
966
+		$status = filter_var($status, FILTER_SANITIZE_STRING);
967
+		$imo = filter_var($imo, FILTER_SANITIZE_STRING);
968
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
969
+		$arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING);
970
+		$arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING);
971 971
 		
972 972
 
973
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
974
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
973
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
974
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
975 975
             	if ($arrival_date == '') $arrival_date = NULL;
976 976
             	$query = '';
977 977
 		if ($globalArchive) {
@@ -981,19 +981,19 @@  discard block
 block discarded – undo
981 981
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) 
982 982
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)';
983 983
 
984
-		$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':status' => $status,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date);
984
+		$query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':status' => $status, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date);
985 985
 		try {
986 986
 			$sth = $this->db->prepare($query);
987 987
 			$sth->execute($query_values);
988 988
 			$sth->closeCursor();
989
-		} catch(PDOException $e) {
989
+		} catch (PDOException $e) {
990 990
 			return "error : ".$e->getMessage();
991 991
 		}
992 992
 		
993 993
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
994 994
 			if ($globalDebug) echo '(Add to Marine archive : ';
995 995
 			$MarineArchive = new MarineArchive($this->db);
996
-			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$noarchive,$format_source, $source_name, $over_country);
996
+			$result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $noarchive, $format_source, $source_name, $over_country);
997 997
 			if ($globalDebug) echo $result.')';
998 998
 		}
999 999
 		return "success";
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 
1002 1002
 	public function getOrderBy()
1003 1003
 	{
1004
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC"));
1004
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC"));
1005 1005
 		return $orderby;
1006 1006
 	}
1007 1007
 
Please login to merge, or discard this patch.
live-czml.php 2 patches
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
     $s3 = sin($bank/2);
49 49
     $c1c2 = $c1*$c2;
50 50
     $s1s2 = $s1*$s2;
51
-    $w =$c1c2*$c3 - $s1s2*$s3;
52
-    $x =$c1c2*$s3 + $s1s2*$c3;
53
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
51
+    $w = $c1c2*$c3 - $s1s2*$s3;
52
+    $x = $c1c2*$s3 + $s1s2*$c3;
53
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
54
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
55
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
56 56
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
57 57
 
58 58
 }
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 $min = false;
74 74
 $allhistory = false;
75 75
 $filter['source'] = array();
76
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
77
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
78
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
79
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
80
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
81
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
83
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
84
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
85
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
86
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
76
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
77
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
78
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
79
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
80
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
81
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
82
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
83
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
84
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
85
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
86
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
87 87
 /*
88 88
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
89 89
 	$min = true;
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
 	$from_archive = true;
131 131
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
132 132
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
133
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
134
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
135
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
136
-	$begindate = date('Y-m-d H:i:s',$begindate);
137
-	$enddate = date('Y-m-d H:i:s',$enddate);
138
-	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
133
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
134
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
135
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
136
+	$begindate = date('Y-m-d H:i:s', $begindate);
137
+	$enddate = date('Y-m-d H:i:s', $enddate);
138
+	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
139 139
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
140 140
 	$from_archive = true;
141 141
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
@@ -145,34 +145,34 @@  discard block
 block discarded – undo
145 145
 	$begindate = $_COOKIE['archive_begin'];
146 146
 	$enddate = $_COOKIE['archive_end'];
147 147
 
148
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
149
-	$begindate = date('Y-m-d H:i:s',$begindate);
150
-	$enddate = date('Y-m-d H:i:s',$enddate);
148
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
149
+	$begindate = date('Y-m-d H:i:s', $begindate);
150
+	$enddate = date('Y-m-d H:i:s', $enddate);
151 151
 //	echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
152
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
152
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
153 153
 } elseif ($tracker) {
154 154
 	$coord = array();
155 155
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
156
-		$coord = explode(',',$_GET['coord']);
156
+		$coord = explode(',', $_GET['coord']);
157 157
 	}
158
-	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true);
158
+	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true);
159 159
 } elseif ($marine) {
160 160
 	$coord = array();
161 161
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
162
-		$coord = explode(',',$_GET['coord']);
162
+		$coord = explode(',', $_GET['coord']);
163 163
 	}
164
-	$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true);
164
+	$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true);
165 165
 } else {
166 166
 	$coord = array();
167 167
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
168
-		$coord = explode(',',$_GET['coord']);
168
+		$coord = explode(',', $_GET['coord']);
169 169
 	}
170
-	$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
170
+	$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
171 171
 }
172 172
 //print_r($spotter_array);
173 173
 if (!empty($spotter_array) && isset($coord)) {
174 174
 	if (isset($_GET['archive'])) {
175
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
175
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
176 176
 	} elseif ($tracker) {
177 177
 		$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
178 178
 	} elseif ($marine) {
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
 	if ($flightcnt == '') $flightcnt = 0;
184 184
 } else $flightcnt = 0;
185 185
 
186
-$sqltime = round(microtime(true)-$begintime,2);
186
+$sqltime = round(microtime(true) - $begintime, 2);
187 187
 $minitime = time();
188 188
 $maxitime = 0;
189
-$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT);
189
+$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT);
190 190
 $modelsdb = array();
191 191
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
192
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
193
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
194
-			if (isset($row[1]) ){
192
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
193
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
194
+			if (isset($row[1])) {
195 195
 				$model = $row[0];
196 196
 				$modelsdb[$model] = $row[1];
197 197
 			}
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 }
202 202
 $modelsdb2 = array();
203 203
 if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) {
204
-	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) {
205
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
206
-			if (isset($row[1]) ){
204
+	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) {
205
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
206
+			if (isset($row[1])) {
207 207
 				$model = $row[0];
208 208
 				$modelsdb2[$model] = $row[1];
209 209
 			}
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 if (!empty($spotter_array) && is_array($spotter_array))
242 242
 {
243 243
 	$nblatlong = 0;
244
-	foreach($spotter_array as $spotter_item)
244
+	foreach ($spotter_array as $spotter_item)
245 245
 	{
246 246
 		$j++;
247 247
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 			$output .= '"lastupdate": "'.$lastupdate.'",';
284 284
 			$output .= '"format": "'.$spotter_item['format_source'].'",';
285 285
 			if ($tracker) {
286
-				$output.= '"type": "tracker"';
286
+				$output .= '"type": "tracker"';
287 287
 			} elseif ($marine) {
288
-				$output.= '"type": "marine"';
288
+				$output .= '"type": "marine"';
289 289
 			} else {
290 290
 				if (isset($globalMap3DLiveries) && $globalMap3DLiveries) {
291 291
 					$aircraft_icao = $spotter_item['aircraft_icao'];
@@ -299,14 +299,14 @@  discard block
 block discarded – undo
299 299
 						if (isset($airline_icao)) {
300 300
 							$imagefile = $aircraft_icao.'-'.$airline_icao.'.png';
301 301
 							if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) {
302
-								$output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
302
+								$output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
303 303
 							}
304 304
 						}
305 305
 					}
306
-					if ($ident != '') $output.= '"ident": "'.$ident.'",';
306
+					if ($ident != '') $output .= '"ident": "'.$ident.'",';
307 307
 				}
308
-				$output.= '"gltf2": %gltf2%,';
309
-				$output.= '"type": "flight"';
308
+				$output .= '"gltf2": %gltf2%,';
309
+				$output .= '"type": "flight"';
310 310
 			}
311 311
 			$output .= '},';
312 312
 
@@ -659,8 +659,8 @@  discard block
 block discarded – undo
659 659
 					$output .= '},';
660 660
 				}
661 661
 			}
662
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
663
-			else $output = str_replace('%onground%','false',$output);
662
+			if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output);
663
+			else $output = str_replace('%onground%', 'false', $output);
664 664
 
665 665
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
666 666
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 			$output .= '"cartographicDegrees": [';
676 676
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
677 677
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
678
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
678
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
679 679
 			$output .= $spotter_item['longitude'].', ';
680 680
 			$output .= $spotter_item['latitude'];
681 681
 			$prevlong = $spotter_item['longitude'];
@@ -703,8 +703,8 @@  discard block
 block discarded – undo
703 703
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
704 704
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
705 705
 		} else {
706
-			$nblatlong = $nblatlong+1;
707
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
706
+			$nblatlong = $nblatlong + 1;
707
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
708 708
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
709 709
 			if ($spotter_item['ground_speed'] == 0) {
710 710
 				$output .= $prevlong.', ';
@@ -744,17 +744,17 @@  discard block
 block discarded – undo
744 744
 }
745 745
 $output .= ']';
746 746
 if (isset($globalArchive) && $globalArchive === TRUE) {
747
-	if ((time()-$globalLiveInterval) > $minitime) {
748
-		if (time()-$globalLiveInterval > $maxitime) {
749
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
747
+	if ((time() - $globalLiveInterval) > $minitime) {
748
+		if (time() - $globalLiveInterval > $maxitime) {
749
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
750 750
 		} else {
751
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
751
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
752 752
 		}
753 753
 	}
754
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
755
-} else $output = str_replace('%minitime%',date("c",$minitime),$output);
756
-$output = str_replace('%maxitime%',date("c",$maxitime),$output);
757
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
758
-else $output = str_replace('%gltf2%','false',$output);
754
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
755
+} else $output = str_replace('%minitime%', date("c", $minitime), $output);
756
+$output = str_replace('%maxitime%', date("c", $maxitime), $output);
757
+if ($gltf2) $output = str_replace('%gltf2%', 'true', $output);
758
+else $output = str_replace('%gltf2%', 'false', $output);
759 759
 print $output;
760 760
 ?>
Please login to merge, or discard this patch.
Braces   +119 added lines, -43 removed lines patch added patch discarded remove patch
@@ -8,8 +8,12 @@  discard block
 block discarded – undo
8 8
 }
9 9
 $tracker = false;
10 10
 $marine = false;
11
-if (isset($_GET['tracker'])) $tracker = true;
12
-if (isset($_GET['marine'])) $marine = true;
11
+if (isset($_GET['tracker'])) {
12
+	$tracker = true;
13
+}
14
+if (isset($_GET['marine'])) {
15
+	$marine = true;
16
+}
13 17
 if ($tracker) {
14 18
 	require_once('require/class.Tracker.php');
15 19
 	require_once('require/class.TrackerLive.php');
@@ -66,24 +70,49 @@  discard block
 block discarded – undo
66 70
 }
67 71
 header('Content-Type: text/javascript');
68 72
 
69
-if (!isset($globalJsonCompress)) $compress = true;
70
-else $compress = $globalJsonCompress;
73
+if (!isset($globalJsonCompress)) {
74
+	$compress = true;
75
+} else {
76
+	$compress = $globalJsonCompress;
77
+}
71 78
 
72 79
 $from_archive = false;
73 80
 $min = false;
74 81
 $allhistory = false;
75 82
 $filter['source'] = array();
76
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
77
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
78
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
79
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
80
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
81
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
83
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
84
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
85
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
86
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
83
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
84
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
85
+}
86
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
87
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
88
+}
89
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
90
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
91
+}
92
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
93
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
94
+}
95
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
96
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
97
+}
98
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
99
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
100
+}
101
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
102
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
103
+}
104
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
105
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
106
+}
107
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
108
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
109
+}
110
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
111
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
112
+}
113
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
114
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
115
+}
87 116
 /*
88 117
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
89 118
 	$min = true;
@@ -180,8 +209,12 @@  discard block
 block discarded – undo
180 209
 	} else {
181 210
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
182 211
 	}
183
-	if ($flightcnt == '') $flightcnt = 0;
184
-} else $flightcnt = 0;
212
+	if ($flightcnt == '') {
213
+		$flightcnt = 0;
214
+	}
215
+	} else {
216
+	$flightcnt = 0;
217
+}
185 218
 
186 219
 $sqltime = round(microtime(true)-$begintime,2);
187 220
 $minitime = time();
@@ -217,7 +250,9 @@  discard block
 block discarded – undo
217 250
 $prev_flightaware_id = '';
218 251
 $speed = 1;
219 252
 $gltf2 = false;
220
-if (isset($archivespeed)) $speed = $archivespeed;
253
+if (isset($archivespeed)) {
254
+	$speed = $archivespeed;
255
+}
221 256
 $output = '[';
222 257
 if ($tracker) {
223 258
 	$output .= '{"id" : "document", "name" : "tracker","version" : "1.0"';
@@ -253,9 +288,13 @@  discard block
 block discarded – undo
253 288
 			$image = "images/placeholder_thumb.png";
254 289
 		}
255 290
 
256
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
257
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
258
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
291
+                if (isset($spotter_item['flightaware_id'])) {
292
+                	$id = $spotter_item['flightaware_id'];
293
+                } elseif (isset($spotter_item['famtrackid'])) {
294
+                	$id = $spotter_item['famtrackid'];
295
+                } elseif (isset($spotter_item['fammarine_id'])) {
296
+                	$id = $spotter_item['fammarine_id'];
297
+                }
259 298
                 if ($prev_flightaware_id != $id) {
260 299
 			if ($prev_flightaware_id != '') {
261 300
 				/*
@@ -303,7 +342,9 @@  discard block
 block discarded – undo
303 342
 							}
304 343
 						}
305 344
 					}
306
-					if ($ident != '') $output.= '"ident": "'.$ident.'",';
345
+					if ($ident != '') {
346
+						$output.= '"ident": "'.$ident.'",';
347
+					}
307 348
 				}
308 349
 				$output.= '"gltf2": %gltf2%,';
309 350
 				$output.= '"type": "flight"';
@@ -335,7 +376,9 @@  discard block
 block discarded – undo
335 376
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
336 377
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
337 378
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
338
-						} else $aircraft_shadow = '';
379
+						} else {
380
+							$aircraft_shadow = '';
381
+						}
339 382
 	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
340 383
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
341 384
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
@@ -343,7 +386,9 @@  discard block
 block discarded – undo
343 386
 						}
344 387
 						$output .= '},';
345 388
 					}
346
-				} else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
389
+				} else {
390
+					$output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
391
+				}
347 392
 			} elseif ($one3dmodel) {
348 393
 				if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') {
349 394
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : 1.0,"minimumPixelSize": 20';
@@ -383,7 +428,9 @@  discard block
 block discarded – undo
383 428
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
384 429
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
385 430
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
386
-						} else $aircraft_shadow = '';
431
+						} else {
432
+							$aircraft_shadow = '';
433
+						}
387 434
 						if ($aircraft_shadow != '') {
388 435
 							if (isset($modelsdb[$aircraft_shadow])) {
389 436
 								$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20';
@@ -520,7 +567,9 @@  discard block
 block discarded – undo
520 567
 								}
521 568
 								$output .= '},';
522 569
 								//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
523
-								if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
570
+								if ($spotter_item['aircraft_icao'] != '') {
571
+									$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
572
+								}
524 573
 								$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
525 574
 							}
526 575
 						} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -542,7 +591,9 @@  discard block
 block discarded – undo
542 591
 							}
543 592
 							$output .= '},';
544 593
 							//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
545
-							if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
594
+							if ($spotter_item['aircraft_icao'] != '') {
595
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
596
+							}
546 597
 							$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
547 598
 						}
548 599
 					} else {
@@ -555,7 +606,9 @@  discard block
 block discarded – undo
555 606
 						}
556 607
 						$output .= '},';
557 608
 						//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
558
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
609
+						if ($spotter_item['aircraft_icao'] != '') {
610
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
611
+						}
559 612
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
560 613
 					}
561 614
 				} elseif ($tracker && isset($spotter_item['type'])) {
@@ -659,8 +712,11 @@  discard block
 block discarded – undo
659 712
 					$output .= '},';
660 713
 				}
661 714
 			}
662
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
663
-			else $output = str_replace('%onground%','false',$output);
715
+			if (isset($onground) && $onground) {
716
+				$output = str_replace('%onground%','true',$output);
717
+			} else {
718
+				$output = str_replace('%onground%','false',$output);
719
+			}
664 720
 
665 721
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
666 722
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -673,8 +729,12 @@  discard block
 block discarded – undo
673 729
 	//		$output .= '"interpolationDegree" : 5,';
674 730
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
675 731
 			$output .= '"cartographicDegrees": [';
676
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
677
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
732
+			if ($minitime > strtotime($spotter_item['date'])) {
733
+				$minitime = strtotime($spotter_item['date']);
734
+			}
735
+			if ($maxitime < strtotime($spotter_item['date'])) {
736
+				$maxitime = strtotime($spotter_item['date']);
737
+			}
678 738
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
679 739
 			$output .= $spotter_item['longitude'].', ';
680 740
 			$output .= $spotter_item['latitude'];
@@ -697,7 +757,9 @@  discard block
 block discarded – undo
697 757
 					$output .= ', '.round($spotter_item['altitude']*30.48);
698 758
 					$prevalt = round($spotter_item['altitude']*30.48);
699 759
 				}
700
-			} else $output .= ', 0';
760
+			} else {
761
+				$output .= ', 0';
762
+			}
701 763
 			//$orientation = '"orientation" : { ';
702 764
 			//$orientation .= '"unitQuaternion": [';
703 765
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
@@ -705,13 +767,18 @@  discard block
 block discarded – undo
705 767
 		} else {
706 768
 			$nblatlong = $nblatlong+1;
707 769
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
708
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
770
+			if ($maxitime < strtotime($spotter_item['date'])) {
771
+				$maxitime = strtotime($spotter_item['date']);
772
+			}
709 773
 			if ($spotter_item['ground_speed'] == 0) {
710 774
 				$output .= $prevlong.', ';
711 775
 				$output .= $prevlat;
712 776
 				//if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt;
713
-				if (!$marine) $output .= ', '.$prevalt;
714
-				else $output .= ', 0';
777
+				if (!$marine) {
778
+					$output .= ', '.$prevalt;
779
+				} else {
780
+					$output .= ', 0';
781
+				}
715 782
 			} else {
716 783
 				$output .= $spotter_item['longitude'].', ';
717 784
 				$output .= $spotter_item['latitude'];
@@ -724,14 +791,17 @@  discard block
 block discarded – undo
724 791
 							$output .= ', 0';
725 792
 						}
726 793
 					} else {
727
-						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048);
728
-						elseif ($tracker) {
794
+						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
795
+							$output .= ', '.round($spotter_item['real_altitude']*0.3048);
796
+						} elseif ($tracker) {
729 797
 							$output .= ', '.round($spotter_item['altitude']*0.3048);
730 798
 						} else {
731 799
 							$output .= ', '.round($spotter_item['altitude']*30.48);
732 800
 						}
733 801
 					}
734
-				} else $output .= ', 0';
802
+				} else {
803
+					$output .= ', 0';
804
+				}
735 805
 			}
736 806
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
737 807
 			//$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
@@ -750,11 +820,17 @@  discard block
 block discarded – undo
750 820
 		} else {
751 821
 			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
752 822
 		}
823
+	} else {
824
+		$output = str_replace('%minitime%',date("c",$minitime),$output);
753 825
 	}
754
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
755
-} else $output = str_replace('%minitime%',date("c",$minitime),$output);
826
+	} else {
827
+	$output = str_replace('%minitime%',date("c",$minitime),$output);
828
+}
756 829
 $output = str_replace('%maxitime%',date("c",$maxitime),$output);
757
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
758
-else $output = str_replace('%gltf2%','false',$output);
830
+if ($gltf2) {
831
+	$output = str_replace('%gltf2%','true',$output);
832
+} else {
833
+	$output = str_replace('%gltf2%','false',$output);
834
+}
759 835
 print $output;
760 836
 ?>
Please login to merge, or discard this patch.
live-geojson.php 2 patches
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -55,24 +55,24 @@  discard block
 block discarded – undo
55 55
 $min = true;
56 56
 $allhistory = false;
57 57
 $filter['source'] = array();
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
60
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
62
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
63
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
67
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
68
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
58
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
59
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
60
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
61
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
62
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
63
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
64
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
65
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
66
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
67
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
68
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
69 69
 
70 70
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
71 71
 	$min = true;
72 72
 } else $min = false;
73 73
 
74 74
 if (isset($_GET['ident'])) {
75
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
75
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
76 76
 	if ($tracker) {
77 77
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
78 78
 	} elseif ($marine) {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 	$allhistory = true;
88 88
 } elseif (isset($_GET['flightaware_id'])) {
89
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
89
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
90 90
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
91 91
 	if (empty($spotter_array)) {
92 92
 		$from_archive = true;
@@ -94,44 +94,44 @@  discard block
 block discarded – undo
94 94
 	}
95 95
 	$allhistory = true;
96 96
 } elseif (isset($_GET['famtrack_id'])) {
97
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
97
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
98 98
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
99 99
 	$allhistory = true;
100 100
 } elseif (isset($_GET['fammarine_id'])) {
101
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
101
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
102 102
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
103 103
 	$allhistory = true;
104 104
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
105 105
 //} elseif (isset($_GET['coord'])) {
106 106
 	$usecoord = true;
107
-	$coord = explode(',',$_GET['coord']);
107
+	$coord = explode(',', $_GET['coord']);
108 108
 	if ($tracker) {
109
-		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
109
+		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter);
110 110
 	} elseif ($marine) {
111
-		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter);
111
+		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter);
112 112
 	} else {
113
-		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
113
+		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
114 114
 	}
115 115
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) {
116 116
 	$usecoord = true;
117
-	$coord = explode(',',$_GET['coord']);
117
+	$coord = explode(',', $_GET['coord']);
118 118
 	if ($tracker) {
119
-		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
119
+		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
120 120
 	} elseif ($marine) {
121
-		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
121
+		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
122 122
 	} else {
123
-		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
123
+		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
124 124
 	}
125 125
 } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) {
126 126
 	$from_archive = true;
127 127
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
128 128
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
129
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
130
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
131
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
132
-	$begindate = date('Y-m-d H:i:s',$begindate);
133
-	$enddate = date('Y-m-d H:i:s',$enddate);
134
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
129
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
130
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
131
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
132
+	$begindate = date('Y-m-d H:i:s', $begindate);
133
+	$enddate = date('Y-m-d H:i:s', $enddate);
134
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
135 135
 } elseif ($min) {
136 136
 	if ($tracker) {
137 137
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -143,17 +143,17 @@  discard block
 block discarded – undo
143 143
 #	$min = true;
144 144
 } else {
145 145
 	if ($tracker) {
146
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
146
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
147 147
 	} elseif ($marine) {
148
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
148
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
149 149
 	} else {
150
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
150
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
151 151
 	}
152 152
 }
153 153
 
154 154
 if ($usecoord) {
155 155
 	if (isset($_GET['archive'])) {
156
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
156
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
157 157
 	} else {
158 158
 		if ($tracker) {
159 159
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 	if ($flightcnt == '') $flightcnt = 0;
167 167
 } else $flightcnt = 0;
168 168
 
169
-$sqltime = round(microtime(true)-$begintime,2);
169
+$sqltime = round(microtime(true) - $begintime, 2);
170 170
 
171
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
171
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
172 172
 if ($currenttime != '') $currenttime = round($currenttime/1000);
173 173
 
174 174
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		if (!empty($spotter_array) && is_array($spotter_array))
188 188
 		{
189 189
 			$output .= '"features": [';
190
-			foreach($spotter_array as $spotter_item)
190
+			foreach ($spotter_array as $spotter_item)
191 191
 			{
192 192
 				$j++;
193 193
 				date_default_timezone_set('UTC');
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 */
244 244
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
245 245
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
246
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
247
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
246
+							if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
247
+							else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",';
248 248
 							//"
249 249
 						} else {
250 250
 							if ($compress) $output .= '"c": "NA",';
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
254 254
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
255 255
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
256
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
256
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
257 257
 						} elseif (isset($spotter_item['aircraft_type'])) {
258 258
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
259 259
 						} elseif (!$min) {
@@ -396,26 +396,26 @@  discard block
 block discarded – undo
396 396
 						if ($currenttime != '') {
397 397
 							if (strtotime($spotter_item['date']) < $currenttime) {
398 398
 								if (isset($archivespeed)) {
399
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
399
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
400 400
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
401 401
 								} elseif ($usenextlatlon) {
402
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
402
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
403 403
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
404 404
 								}
405 405
 							}
406 406
 						} else {
407 407
 							if (isset($archivespeed)) {
408
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
408
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
409 409
 								$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
410 410
 							} elseif ($usenextlatlon) {
411
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
411
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
412 412
 								$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
413 413
 							}
414 414
 						}
415 415
 
416 416
 						if (!$min) $output .= '"image": "'.$image.'",';
417 417
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
418
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
418
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
419 419
 						}
420 420
 						if (isset($spotter_item['image_source_website'])) {
421 421
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
438 438
 						}
439 439
 						if (isset($spotter_item['acars'])) {
440
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
440
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
441 441
 						}
442 442
 						// type when not aircraft ?
443 443
 						if (isset($spotter_item['type'])) {
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 								if ($currenttime != '') {
458 458
 									if (strtotime($spotter_item['date']) < $currenttime) {
459 459
 										if (!isset($archivespeed)) $archivespeed = 1;
460
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date']));
460
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, $currenttime - strtotime($spotter_item['date']));
461 461
 										$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
462 462
 									} else {
463 463
 										$output .= $spotter_item['longitude'].', ';
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
                 
527 527
 			}
528 528
 */
529
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
529
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
530 530
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
531 531
 				
532 532
 				if (
@@ -534,11 +534,11 @@  discard block
 block discarded – undo
534 534
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
535 535
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
536 536
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
537
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
537
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
538 538
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
539
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
539
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
540 540
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
541
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
541
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
542 542
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
543 543
 				    ) {
544 544
 					if ($tracker) {
@@ -575,9 +575,9 @@  discard block
 block discarded – undo
575 575
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
576 576
 							}
577 577
 							$output_history .= '[';
578
-							$output_history .=  $spotter_history['longitude'].', ';
579
-							$output_history .=  $spotter_history['latitude'].', ';
580
-							$output_history .=  $spotter_history['altitude']*30.48;
578
+							$output_history .= $spotter_history['longitude'].', ';
579
+							$output_history .= $spotter_history['latitude'].', ';
580
+							$output_history .= $spotter_history['altitude']*30.48;
581 581
 							$output_history .= '],';
582 582
 							/*
583 583
 							if ($from_archive === false) {
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
596 596
 							} else $d = true;
597 597
 							$output_history .= '[';
598
-							$output_history .=  $spotter_history['longitude'].', ';
599
-							$output_history .=  $spotter_history['latitude'];
598
+							$output_history .= $spotter_history['longitude'].', ';
599
+							$output_history .= $spotter_history['latitude'];
600 600
 							$output_history .= '],';
601 601
 							/*
602 602
 							if ($from_archive === false) {
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
 					
613 613
 						if ($from_archive === false) {
614 614
 							$output_historyd = '[';
615
-							$output_historyd .=  $spotter_item['longitude'].', ';
616
-							$output_historyd .=  $spotter_item['latitude'];
617
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
615
+							$output_historyd .= $spotter_item['longitude'].', ';
616
+							$output_historyd .= $spotter_item['latitude'];
617
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
618 618
 							$output_historyd .= '],';
619 619
 							//$output_history = $output_historyd.$output_history;
620 620
 							$output_history = $output_history.$output_historyd;
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 					}
629 629
 				}
630 630
 				
631
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
631
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
632 632
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
633 633
 				     && (isset($spotter_item['departure_airport']) 
634 634
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 
663 663
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
664 664
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
665
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
665
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
666 666
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
667 667
 				     && (isset($spotter_item['arrival_airport']) 
668 668
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 			$output  = substr($output, 0, -1);
694 694
 			$output .= ']';
695 695
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
696
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
696
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
697 697
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
698 698
 			$output .= '"fc": "'.$j.'"';
699 699
 		} else {
Please login to merge, or discard this patch.
Braces   +300 added lines, -117 removed lines patch added patch discarded remove patch
@@ -48,28 +48,55 @@  discard block
 block discarded – undo
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
51
-if (!isset($globalJsonCompress)) $compress = true;
52
-else $compress = $globalJsonCompress;
51
+if (!isset($globalJsonCompress)) {
52
+	$compress = true;
53
+} else {
54
+	$compress = $globalJsonCompress;
55
+}
53 56
 
54 57
 $from_archive = false;
55 58
 $min = true;
56 59
 $allhistory = false;
57 60
 $filter['source'] = array();
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
60
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
62
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
63
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
67
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
68
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
61
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
62
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
63
+}
64
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
65
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
66
+}
67
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
68
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
69
+}
70
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
71
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
72
+}
73
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
74
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
75
+}
76
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
77
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
78
+}
79
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
80
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
81
+}
82
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
83
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
84
+}
85
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
86
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
87
+}
88
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
89
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
90
+}
91
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
92
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
93
+}
69 94
 
70 95
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
71 96
 	$min = true;
72
-} else $min = false;
97
+} else {
98
+	$min = false;
99
+}
73 100
 
74 101
 if (isset($_GET['ident'])) {
75 102
 	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
@@ -163,24 +190,38 @@  discard block
 block discarded – undo
163 190
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
164 191
 		}
165 192
 	}
166
-	if ($flightcnt == '') $flightcnt = 0;
167
-} else $flightcnt = 0;
193
+	if ($flightcnt == '') {
194
+		$flightcnt = 0;
195
+	}
196
+	} else {
197
+	$flightcnt = 0;
198
+}
168 199
 
169 200
 $sqltime = round(microtime(true)-$begintime,2);
170 201
 
171 202
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
172
-if ($currenttime != '') $currenttime = round($currenttime/1000);
203
+if ($currenttime != '') {
204
+	$currenttime = round($currenttime/1000);
205
+}
173 206
 
174
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
175
-else $usenextlatlon = true;
176
-if ($usenextlatlon === false) $currenttime = '';
207
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
208
+	$usenextlatlon = false;
209
+} else {
210
+	$usenextlatlon = true;
211
+}
212
+if ($usenextlatlon === false) {
213
+	$currenttime = '';
214
+}
177 215
 $j = 0;
178 216
 $prev_flightaware_id = '';
179 217
 $aircrafts_shadow = array();
180 218
 $output = '{';
181 219
 	$output .= '"type": "FeatureCollection",';
182
-		if ($min) $output .= '"minimal": "true",';
183
-		else $output .= '"minimal": "false",';
220
+		if ($min) {
221
+			$output .= '"minimal": "true",';
222
+		} else {
223
+			$output .= '"minimal": "false",';
224
+		}
184 225
 		//$output .= '"fc": "'.$flightcnt.'",';
185 226
 		$output .= '"sqt": "'.$sqltime.'",';
186 227
 
@@ -224,18 +265,29 @@  discard block
 block discarded – undo
224 265
 						}
225 266
 						$output .= '"properties": {';
226 267
 						if (isset($spotter_item['flightaware_id'])) {
227
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
228
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
268
+							if ($compress) {
269
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
270
+							} else {
271
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
272
+							}
229 273
 						} elseif (isset($spotter_item['famtrackid'])) {
230
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
231
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
274
+							if ($compress) {
275
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
276
+							} else {
277
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
278
+							}
232 279
 						} elseif (isset($spotter_item['fammarine_id'])) {
233
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
234
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
280
+							if ($compress) {
281
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
282
+							} else {
283
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
284
+							}
235 285
 						}
236 286
 							$output .= '"fc": "'.$flightcnt.'",';
237 287
 							$output .= '"sqt": "'.$sqltime.'",';
238
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
288
+							if (isset($begindate)) {
289
+								$output .= '"archive_date": "'.$begindate.'",';
290
+							}
239 291
 
240 292
 /*
241 293
 							if ($min) $output .= '"minimal": "true",';
@@ -243,14 +295,22 @@  discard block
 block discarded – undo
243 295
 */
244 296
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
245 297
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
246
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
247
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
298
+							if ($compress) {
299
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
300
+							} else {
301
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
302
+							}
248 303
 							//"
249 304
 						} else {
250
-							if ($compress) $output .= '"c": "NA",';
251
-							else $output .= '"callsign": "NA",';
305
+							if ($compress) {
306
+								$output .= '"c": "NA",';
307
+							} else {
308
+								$output .= '"callsign": "NA",';
309
+							}
310
+						}
311
+						if (isset($spotter_item['registration'])) {
312
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
252 313
 						}
253
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
254 314
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
255 315
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
256 316
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -263,16 +323,23 @@  discard block
 block discarded – undo
263 323
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
264 324
 						}
265 325
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
266
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
267
-							else {
326
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
327
+								$spotter_item['aircraft_shadow'] = '';
328
+							} else {
268 329
 								$aircraft_icao = $spotter_item['aircraft_icao'];
269
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
270
-								else {
330
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
331
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
332
+								} else {
271 333
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
272
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
273
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
274
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
275
-									else $spotter_item['aircraft_shadow'] = '';
334
+									if (count($aircraft_info) > 0) {
335
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
336
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
337
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
338
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
339
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
340
+									} else {
341
+										$spotter_item['aircraft_shadow'] = '';
342
+									}
276 343
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
277 344
 								}
278 345
 							}
@@ -280,73 +347,139 @@  discard block
 block discarded – undo
280 347
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
281 348
 							if ($tracker) {
282 349
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
283
-									if ($compress) $output .= '"as": "ambulance.png",';
284
-									else $output .= '"aircraft_shadow": "ambulance.png",';
350
+									if ($compress) {
351
+										$output .= '"as": "ambulance.png",';
352
+									} else {
353
+										$output .= '"aircraft_shadow": "ambulance.png",';
354
+									}
285 355
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
286
-									if ($compress) $output .= '"as": "police.png",';
287
-									else $output .= '"aircraft_shadow": "police.png",';
356
+									if ($compress) {
357
+										$output .= '"as": "police.png",';
358
+									} else {
359
+										$output .= '"aircraft_shadow": "police.png",';
360
+									}
288 361
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
289
-									if ($compress) $output .= '"as": "ship.png",';
290
-									else $output .= '"aircraft_shadow": "ship.png",';
362
+									if ($compress) {
363
+										$output .= '"as": "ship.png",';
364
+									} else {
365
+										$output .= '"aircraft_shadow": "ship.png",';
366
+									}
291 367
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
292
-									if ($compress) $output .= '"as": "ship.png",';
293
-									else $output .= '"aircraft_shadow": "ship.png",';
368
+									if ($compress) {
369
+										$output .= '"as": "ship.png",';
370
+									} else {
371
+										$output .= '"aircraft_shadow": "ship.png",';
372
+									}
294 373
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
295
-									if ($compress) $output .= '"as": "ship.png",';
296
-									else $output .= '"aircraft_shadow": "ship.png",';
374
+									if ($compress) {
375
+										$output .= '"as": "ship.png",';
376
+									} else {
377
+										$output .= '"aircraft_shadow": "ship.png",';
378
+									}
297 379
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
298
-									if ($compress) $output .= '"as": "truck.png",';
299
-									else $output .= '"aircraft_shadow": "truck.png",';
380
+									if ($compress) {
381
+										$output .= '"as": "truck.png",';
382
+									} else {
383
+										$output .= '"aircraft_shadow": "truck.png",';
384
+									}
300 385
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
301
-									if ($compress) $output .= '"as": "truck.png",';
302
-									else $output .= '"aircraft_shadow": "truck.png",';
386
+									if ($compress) {
387
+										$output .= '"as": "truck.png",';
388
+									} else {
389
+										$output .= '"aircraft_shadow": "truck.png",';
390
+									}
303 391
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
304
-									if ($compress) $output .= '"as": "aircraft.png",';
305
-									else $output .= '"aircraft_shadow": "aircraft.png",';
392
+									if ($compress) {
393
+										$output .= '"as": "aircraft.png",';
394
+									} else {
395
+										$output .= '"aircraft_shadow": "aircraft.png",';
396
+									}
306 397
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
307
-									if ($compress) $output .= '"as": "aircraft.png",';
308
-									else $output .= '"aircraft_shadow": "aircraft.png",';
398
+									if ($compress) {
399
+										$output .= '"as": "aircraft.png",';
400
+									} else {
401
+										$output .= '"aircraft_shadow": "aircraft.png",';
402
+									}
309 403
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
310
-									if ($compress) $output .= '"as": "helico.png",';
311
-									else $output .= '"aircraft_shadow": "helico.png",';
404
+									if ($compress) {
405
+										$output .= '"as": "helico.png",';
406
+									} else {
407
+										$output .= '"aircraft_shadow": "helico.png",';
408
+									}
312 409
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
313
-									if ($compress) $output .= '"as": "rail.png",';
314
-									else $output .= '"aircraft_shadow": "rail.png",';
410
+									if ($compress) {
411
+										$output .= '"as": "rail.png",';
412
+									} else {
413
+										$output .= '"aircraft_shadow": "rail.png",';
414
+									}
315 415
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
316
-									if ($compress) $output .= '"as": "firetruck.png",';
317
-									else $output .= '"aircraft_shadow": "firetruck.png",';
416
+									if ($compress) {
417
+										$output .= '"as": "firetruck.png",';
418
+									} else {
419
+										$output .= '"aircraft_shadow": "firetruck.png",';
420
+									}
318 421
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
319
-									if ($compress) $output .= '"as": "bus.png",';
320
-									else $output .= '"aircraft_shadow": "bus.png",';
422
+									if ($compress) {
423
+										$output .= '"as": "bus.png",';
424
+									} else {
425
+										$output .= '"aircraft_shadow": "bus.png",';
426
+									}
321 427
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
322
-									if ($compress) $output .= '"as": "phone.png",';
323
-									else $output .= '"aircraft_shadow": "phone.png",';
428
+									if ($compress) {
429
+										$output .= '"as": "phone.png",';
430
+									} else {
431
+										$output .= '"aircraft_shadow": "phone.png",';
432
+									}
324 433
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
325
-									if ($compress) $output .= '"as": "jogger.png",';
326
-									else $output .= '"aircraft_shadow": "jogger.png",';
434
+									if ($compress) {
435
+										$output .= '"as": "jogger.png",';
436
+									} else {
437
+										$output .= '"aircraft_shadow": "jogger.png",';
438
+									}
327 439
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
328
-									if ($compress) $output .= '"as": "bike.png",';
329
-									else $output .= '"aircraft_shadow": "bike.png",';
440
+									if ($compress) {
441
+										$output .= '"as": "bike.png",';
442
+									} else {
443
+										$output .= '"aircraft_shadow": "bike.png",';
444
+									}
330 445
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
331
-									if ($compress) $output .= '"as": "motorcycle.png",';
332
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
446
+									if ($compress) {
447
+										$output .= '"as": "motorcycle.png",';
448
+									} else {
449
+										$output .= '"aircraft_shadow": "motorcycle.png",';
450
+									}
333 451
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
334
-									if ($compress) $output .= '"as": "balloon.png",';
335
-									else $output .= '"aircraft_shadow": "balloon.png",';
452
+									if ($compress) {
453
+										$output .= '"as": "balloon.png",';
454
+									} else {
455
+										$output .= '"aircraft_shadow": "balloon.png",';
456
+									}
336 457
 								} else {
337
-									if ($compress) $output .= '"as": "car.png",';
338
-									else $output .= '"aircraft_shadow": "car.png",';
458
+									if ($compress) {
459
+										$output .= '"as": "car.png",';
460
+									} else {
461
+										$output .= '"aircraft_shadow": "car.png",';
462
+									}
339 463
 								}
340 464
 							} elseif ($marine) {
341
-								if ($compress) $output .= '"as": "ship.png",';
342
-								else $output .= '"aircraft_shadow": "ship.png",';
465
+								if ($compress) {
466
+									$output .= '"as": "ship.png",';
467
+								} else {
468
+									$output .= '"aircraft_shadow": "ship.png",';
469
+								}
343 470
 							} else {
344
-								if ($compress) $output .= '"as": "default.png",';
345
-								else $output .= '"aircraft_shadow": "default.png",';
471
+								if ($compress) {
472
+									$output .= '"as": "default.png",';
473
+								} else {
474
+									$output .= '"aircraft_shadow": "default.png",';
475
+								}
346 476
 							}
347 477
 						} else {
348
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
349
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
478
+							if ($compress) {
479
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
480
+							} else {
481
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
482
+							}
350 483
 						}
351 484
 						if (isset($spotter_item['airline_name'])) {
352 485
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -354,8 +487,11 @@  discard block
 block discarded – undo
354 487
 							$output .= '"airline_name": "NA",';
355 488
 						}
356 489
 						if (isset($spotter_item['departure_airport'])) {
357
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
358
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
490
+							if ($compress) {
491
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
492
+							} else {
493
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
494
+							}
359 495
 						}
360 496
 						if (isset($spotter_item['departure_airport_city'])) {
361 497
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -367,8 +503,11 @@  discard block
 block discarded – undo
367 503
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
368 504
 						}
369 505
 						if (isset($spotter_item['arrival_airport'])) {
370
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
371
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
506
+							if ($compress) {
507
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
508
+							} else {
509
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
510
+							}
372 511
 						}
373 512
 						if (isset($spotter_item['arrival_airport_city'])) {
374 513
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -387,11 +526,17 @@  discard block
 block discarded – undo
387 526
 						}
388 527
 						
389 528
 						if (isset($spotter_item['altitude'])) {
390
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
391
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
529
+							if ($compress) {
530
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
531
+							} else {
532
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
533
+							}
534
+						}
535
+						if ($compress) {
536
+							$output .= '"h": "'.$spotter_item['heading'].'",';
537
+						} else {
538
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
392 539
 						}
393
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
394
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
395 540
 						
396 541
 						if ($currenttime != '') {
397 542
 							if (strtotime($spotter_item['date']) < $currenttime) {
@@ -413,7 +558,9 @@  discard block
 block discarded – undo
413 558
 							}
414 559
 						}
415 560
 
416
-						if (!$min) $output .= '"image": "'.$image.'",';
561
+						if (!$min) {
562
+							$output .= '"image": "'.$image.'",';
563
+						}
417 564
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
418 565
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
419 566
 						}
@@ -421,8 +568,11 @@  discard block
 block discarded – undo
421 568
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
422 569
 						}
423 570
 						if (isset($spotter_item['squawk'])) {
424
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
425
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
571
+							if ($compress) {
572
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
573
+							} else {
574
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
575
+							}
426 576
 						}
427 577
 						if (isset($spotter_item['squawk_usage'])) {
428 578
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -441,14 +591,23 @@  discard block
 block discarded – undo
441 591
 						}
442 592
 						// type when not aircraft ?
443 593
 						if (isset($spotter_item['type'])) {
444
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
445
-							else $output .= '"type": "'.$spotter_item['type'].'"';
594
+							if ($compress) {
595
+								$output .= '"t": "'.$spotter_item['type'].'"';
596
+							} else {
597
+								$output .= '"type": "'.$spotter_item['type'].'"';
598
+							}
446 599
 						} elseif ($marine) {
447
-							if ($compress) $output .= '"t": "ship"';
448
-							else $output .= '"type": "ship"';
600
+							if ($compress) {
601
+								$output .= '"t": "ship"';
602
+							} else {
603
+								$output .= '"type": "ship"';
604
+							}
449 605
 						} else {
450
-							if ($compress) $output .= '"t": "aircraft"';
451
-							else $output .= '"type": "aircraft"';
606
+							if ($compress) {
607
+								$output .= '"t": "aircraft"';
608
+							} else {
609
+								$output .= '"type": "aircraft"';
610
+							}
452 611
 						}
453 612
 						$output .= '},';
454 613
 						$output .= '"geometry": {';
@@ -456,7 +615,9 @@  discard block
 block discarded – undo
456 615
 								$output .= '"coordinates": [';
457 616
 								if ($currenttime != '') {
458 617
 									if (strtotime($spotter_item['date']) < $currenttime) {
459
-										if (!isset($archivespeed)) $archivespeed = 1;
618
+										if (!isset($archivespeed)) {
619
+											$archivespeed = 1;
620
+										}
460 621
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date']));
461 622
 										$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
462 623
 									} else {
@@ -527,7 +688,9 @@  discard block
 block discarded – undo
527 688
 			}
528 689
 */
529 690
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
530
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
691
+				if ($history == '' && isset($_COOKIE['history'])) {
692
+					$history = $_COOKIE['history'];
693
+				}
531 694
 				
532 695
 				if (
533 696
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -571,8 +734,11 @@  discard block
 block discarded – undo
571 734
 									$output_history .= ']}},';
572 735
 									$output .= $output_history;
573 736
 								}
574
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
575
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
737
+								if ($compress) {
738
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
739
+								} else {
740
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
741
+								}
576 742
 							}
577 743
 							$output_history .= '[';
578 744
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -591,9 +757,14 @@  discard block
 block discarded – undo
591 757
 							$prev_alt = $alt;
592 758
 						} else {
593 759
 							if ($d == false) {
594
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
595
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
596
-							} else $d = true;
760
+								if ($compress) {
761
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
762
+								} else {
763
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
764
+								}
765
+							} else {
766
+								$d = true;
767
+							}
597 768
 							$output_history .= '[';
598 769
 							$output_history .=  $spotter_history['longitude'].', ';
599 770
 							$output_history .=  $spotter_history['latitude'];
@@ -614,7 +785,9 @@  discard block
 block discarded – undo
614 785
 							$output_historyd = '[';
615 786
 							$output_historyd .=  $spotter_item['longitude'].', ';
616 787
 							$output_historyd .=  $spotter_item['latitude'];
617
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
788
+							if (isset($spotter_history['altitude'])) {
789
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
790
+							}
618 791
 							$output_historyd .= '],';
619 792
 							//$output_history = $output_historyd.$output_history;
620 793
 							$output_history = $output_history.$output_historyd;
@@ -636,8 +809,11 @@  discard block
 block discarded – undo
636 809
 				        && $spotter_item['arrival_airport'] != 'NA' 
637 810
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
638 811
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
639
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
640
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
812
+				    if ($compress) {
813
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
814
+				    } else {
815
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
816
+				    }
641 817
 				    if (isset($spotter_item['departure_airport_latitude'])) {
642 818
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
643 819
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -670,8 +846,11 @@  discard block
 block discarded – undo
670 846
 				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
671 847
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
672 848
 				    $havedata = false;
673
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
674
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
849
+				    if ($compress) {
850
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
851
+				    } else {
852
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
853
+				    }
675 854
 				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
676 855
 
677 856
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -686,7 +865,9 @@  discard block
 block discarded – undo
686 865
 				    }
687 866
 				    //$output_dest  = substr($output_dest, 0, -1);
688 867
 				    $output_dest .= ']}},';
689
-				    if ($havedata) $output .= $output_dest;
868
+				    if ($havedata) {
869
+				    	$output .= $output_dest;
870
+				    }
690 871
 				    unset($output_dest);
691 872
 				}
692 873
 			}
@@ -694,7 +875,9 @@  discard block
 block discarded – undo
694 875
 			$output .= ']';
695 876
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
696 877
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
697
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
878
+			if (isset($begindate)) {
879
+				$output .= '"archive_date": "'.$begindate.'",';
880
+			}
698 881
 			$output .= '"fc": "'.$j.'"';
699 882
 		} else {
700 883
 			$output .= '"features": ';
Please login to merge, or discard this patch.