Completed
Push — master ( 30fd93...f316c6 )
by Yannick
10:40
created
live-geojson.php 3 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -5,23 +5,23 @@  discard block
 block discarded – undo
5 5
 $marine = false;
6 6
 $usecoord = false;
7 7
 if (isset($_GET['tracker'])) {
8
-    $tracker = true;
8
+	$tracker = true;
9 9
 }
10 10
 if (isset($_GET['marine'])) {
11
-    $marine = true;
11
+	$marine = true;
12 12
 }
13 13
 if ($tracker) {
14
-    require_once('require/class.Tracker.php');
15
-    require_once('require/class.TrackerLive.php');
16
-    require_once('require/class.TrackerArchive.php');
14
+	require_once('require/class.Tracker.php');
15
+	require_once('require/class.TrackerLive.php');
16
+	require_once('require/class.TrackerArchive.php');
17 17
 } elseif ($marine) {
18
-    require_once('require/class.Marine.php');
19
-    require_once('require/class.MarineLive.php');
20
-    require_once('require/class.MarineArchive.php');
18
+	require_once('require/class.Marine.php');
19
+	require_once('require/class.MarineLive.php');
20
+	require_once('require/class.MarineArchive.php');
21 21
 } else {
22
-    require_once('require/class.Spotter.php');
23
-    require_once('require/class.SpotterLive.php');
24
-    require_once('require/class.SpotterArchive.php');
22
+	require_once('require/class.Spotter.php');
23
+	require_once('require/class.SpotterLive.php');
24
+	require_once('require/class.SpotterArchive.php');
25 25
 }
26 26
 
27 27
 $begintime = microtime(true);
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 $Common = new Common();
42 42
 
43 43
 if (isset($_GET['download'])) {
44
-    if ($_GET['download'] == "true")
45
-    {
44
+	if ($_GET['download'] == "true")
45
+	{
46 46
 	header('Content-disposition: attachment; filename="flightairmap.json"');
47
-    }
47
+	}
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
@@ -497,17 +497,17 @@  discard block
 block discarded – undo
497 497
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
498 498
 				
499 499
 				if (
500
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
501
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
500
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
501
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
502 502
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
503 503
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
504
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
505
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
506
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
507
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
508
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
509
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
510
-				    ) {
504
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
505
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
506
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
507
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
508
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
509
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
510
+					) {
511 511
 					if ($tracker) {
512 512
 						if ($from_archive || $globalArchive) {
513 513
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -596,66 +596,66 @@  discard block
 block discarded – undo
596 596
 				}
597 597
 				
598 598
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
599
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
600
-				     && (isset($spotter_item['departure_airport']) 
601
-				        && $spotter_item['departure_airport'] != 'NA' 
602
-				        && isset($spotter_item['arrival_airport']) 
603
-				        && $spotter_item['arrival_airport'] != 'NA' 
604
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
605
-				    	    || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) 
606
-				    	    || (isset($globalMapRoute) && $globalMapRoute)))))) {
607
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
608
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
609
-				    if (isset($spotter_item['departure_airport_latitude'])) {
599
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
600
+					 && (isset($spotter_item['departure_airport']) 
601
+						&& $spotter_item['departure_airport'] != 'NA' 
602
+						&& isset($spotter_item['arrival_airport']) 
603
+						&& $spotter_item['arrival_airport'] != 'NA' 
604
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
605
+							|| (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) 
606
+							|| (isset($globalMapRoute) && $globalMapRoute)))))) {
607
+					if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
608
+					else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
609
+					if (isset($spotter_item['departure_airport_latitude'])) {
610 610
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
611
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
611
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
612 612
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
613 613
 					if (isset($dairport[0]['latitude'])) {
614
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
614
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
615 615
 					}
616
-				    }
617
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
616
+					}
617
+					if (isset($spotter_item['arrival_airport_latitude'])) {
618 618
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],';
619
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
619
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
620 620
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
621 621
 					if (isset($aairport[0]['latitude'])) {
622
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
622
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
623 623
 					}
624
-				    }
625
-				    $output_air  = substr($output_air, 0, -1);
626
-				    $output_air .= ']}},';
627
-				    $output .= $output_air;
628
-				    unset($output_air);
624
+					}
625
+					$output_air  = substr($output_air, 0, -1);
626
+					$output_air .= ']}},';
627
+					$output .= $output_air;
628
+					unset($output_air);
629 629
 				}
630 630
 
631 631
 				//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))))) {
632 632
 				//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))))) {
633 633
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
634
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
635
-				     && (isset($spotter_item['arrival_airport']) 
636
-				        && $spotter_item['arrival_airport'] != 'NA' 
637
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
638
-				    	    || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) 
639
-				    	    || (isset($globalMapRoute) && $globalMapRoute)))))) {
640
-				    $havedata = false;
641
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
642
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
643
-				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
634
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
635
+					 && (isset($spotter_item['arrival_airport']) 
636
+						&& $spotter_item['arrival_airport'] != 'NA' 
637
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
638
+							|| (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) 
639
+							|| (isset($globalMapRoute) && $globalMapRoute)))))) {
640
+					$havedata = false;
641
+					if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
642
+					else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
643
+					$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
644 644
 
645
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
645
+					if (isset($spotter_item['arrival_airport_latitude'])) {
646 646
 					$output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
647 647
 					$havedata = true;
648
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
648
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
649 649
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
650 650
 					if (isset($aairport[0]['latitude'])) {
651
-					    $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
652
-					    $havedata = true;
651
+						$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
652
+						$havedata = true;
653 653
 					}
654
-				    }
655
-				    //$output_dest  = substr($output_dest, 0, -1);
656
-				    $output_dest .= ']}},';
657
-				    if ($havedata) $output .= $output_dest;
658
-				    unset($output_dest);
654
+					}
655
+					//$output_dest  = substr($output_dest, 0, -1);
656
+					$output_dest .= ']}},';
657
+					if ($havedata) $output .= $output_dest;
658
+					unset($output_dest);
659 659
 				}
660 660
 			}
661 661
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -55,23 +55,23 @@  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_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
67
-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_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
65
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
66
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
67
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
68 68
 
69 69
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
70 70
 	$min = true;
71 71
 } else $min = false;
72 72
 
73 73
 if (isset($_GET['ident'])) {
74
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
74
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
75 75
 	if ($tracker) {
76 76
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
77 77
 	} elseif ($marine) {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	}
86 86
 	$allhistory = true;
87 87
 } elseif (isset($_GET['flightaware_id'])) {
88
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
88
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
89 89
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
90 90
 	if (empty($spotter_array)) {
91 91
 		$from_archive = true;
@@ -93,44 +93,44 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 	$allhistory = true;
95 95
 } elseif (isset($_GET['famtrack_id'])) {
96
-	$famtrack_id = filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING);
96
+	$famtrack_id = filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING);
97 97
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
98 98
 	$allhistory = true;
99 99
 } elseif (isset($_GET['fammarine_id'])) {
100
-	$fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING);
100
+	$fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING);
101 101
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
102 102
 	$allhistory = true;
103 103
 } elseif (isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
104 104
 //} elseif (isset($_GET['coord'])) {
105 105
 	$usecoord = true;
106
-	$coord = explode(',',$_GET['coord']);
106
+	$coord = explode(',', $_GET['coord']);
107 107
 	if ($tracker) {
108
-		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
108
+		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter);
109 109
 	} elseif ($marine) {
110
-		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter);
110
+		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter);
111 111
 	} else {
112
-		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
112
+		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
113 113
 	}
114 114
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) {
115 115
 	$usecoord = true;
116
-	$coord = explode(',',$_GET['coord']);
116
+	$coord = explode(',', $_GET['coord']);
117 117
 	if ($tracker) {
118
-		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
118
+		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
119 119
 	} elseif ($marine) {
120
-		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
120
+		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
121 121
 	} else {
122
-		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
122
+		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
123 123
 	}
124 124
 } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) {
125 125
 	$from_archive = true;
126 126
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
127 127
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
128
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
129
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
130
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
131
-	$begindate = date('Y-m-d H:i:s',$begindate);
132
-	$enddate = date('Y-m-d H:i:s',$enddate);
133
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
128
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
129
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
130
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
131
+	$begindate = date('Y-m-d H:i:s', $begindate);
132
+	$enddate = date('Y-m-d H:i:s', $enddate);
133
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
134 134
 } elseif ($min) {
135 135
 	if ($tracker) {
136 136
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -142,18 +142,18 @@  discard block
 block discarded – undo
142 142
 #	$min = true;
143 143
 } else {
144 144
 	if ($tracker) {
145
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
145
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
146 146
 	} elseif ($marine) {
147
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
147
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
148 148
 	} else {
149
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
149
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
150 150
 	}
151 151
 }
152 152
 
153 153
 if (!empty($spotter_array) || $usecoord) {
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
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
159 159
 		}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	if ($flightcnt == '') $flightcnt = 0;
162 162
 } else $flightcnt = 0;
163 163
 
164
-$sqltime = round(microtime(true)-$begintime,2);
164
+$sqltime = round(microtime(true) - $begintime, 2);
165 165
 
166 166
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
167 167
 else $usenextlatlon = true;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		if (!empty($spotter_array) && is_array($spotter_array))
179 179
 		{
180 180
 			$output .= '"features": [';
181
-			foreach($spotter_array as $spotter_item)
181
+			foreach ($spotter_array as $spotter_item)
182 182
 			{
183 183
 				$j++;
184 184
 				date_default_timezone_set('UTC');
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 */
235 235
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
236 236
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
237
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
238
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
237
+							if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
238
+							else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",';
239 239
 							//"
240 240
 						} else {
241 241
 							if ($compress) $output .= '"c": "NA",';
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
245 245
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
246 246
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
247
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
247
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
248 248
 						} elseif (isset($spotter_item['aircraft_type'])) {
249 249
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
250 250
 						} elseif (!$min) {
@@ -384,16 +384,16 @@  discard block
 block discarded – undo
384 384
 						else $output .= '"heading": "'.$spotter_item['heading'].'",';
385 385
 						
386 386
 						if (isset($archivespeed)) {
387
-							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
387
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
388 388
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
389 389
 						} elseif ($usenextlatlon) {
390
-							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
390
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
391 391
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
392 392
 						}
393 393
 
394 394
 						if (!$min) $output .= '"image": "'.$image.'",';
395 395
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
396
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
396
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
397 397
 						}
398 398
 						if (isset($spotter_item['image_source_website'])) {
399 399
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
416 416
 						}
417 417
 						if (isset($spotter_item['acars'])) {
418
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
418
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
419 419
 						}
420 420
 						// type when not aircraft ?
421 421
 						if (isset($spotter_item['type'])) {
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
                 
494 494
 			}
495 495
 */
496
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
496
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
497 497
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
498 498
 				
499 499
 				if (
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
502 502
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
503 503
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
504
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
504
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
505 505
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
506
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
506
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
507 507
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
508
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
508
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
509 509
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
510 510
 				    ) {
511 511
 					if ($tracker) {
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
543 543
 							}
544 544
 							$output_history .= '[';
545
-							$output_history .=  $spotter_history['longitude'].', ';
546
-							$output_history .=  $spotter_history['latitude'].', ';
547
-							$output_history .=  $spotter_history['altitude']*30.48;
545
+							$output_history .= $spotter_history['longitude'].', ';
546
+							$output_history .= $spotter_history['latitude'].', ';
547
+							$output_history .= $spotter_history['altitude']*30.48;
548 548
 							$output_history .= '],';
549 549
 							/*
550 550
 							if ($from_archive === false) {
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
563 563
 							} else $d = true;
564 564
 							$output_history .= '[';
565
-							$output_history .=  $spotter_history['longitude'].', ';
566
-							$output_history .=  $spotter_history['latitude'];
565
+							$output_history .= $spotter_history['longitude'].', ';
566
+							$output_history .= $spotter_history['latitude'];
567 567
 							$output_history .= '],';
568 568
 							/*
569 569
 							if ($from_archive === false) {
@@ -579,9 +579,9 @@  discard block
 block discarded – undo
579 579
 					
580 580
 						if ($from_archive === false) {
581 581
 							$output_historyd = '[';
582
-							$output_historyd .=  $spotter_item['longitude'].', ';
583
-							$output_historyd .=  $spotter_item['latitude'];
584
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
582
+							$output_historyd .= $spotter_item['longitude'].', ';
583
+							$output_historyd .= $spotter_item['latitude'];
584
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
585 585
 							$output_historyd .= '],';
586 586
 							//$output_history = $output_historyd.$output_history;
587 587
 							$output_history = $output_history.$output_historyd;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 					}
596 596
 				}
597 597
 				
598
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
598
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
599 599
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
600 600
 				     && (isset($spotter_item['departure_airport']) 
601 601
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 
631 631
 				//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))))) {
632 632
 				//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))))) {
633
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
633
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
634 634
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
635 635
 				     && (isset($spotter_item['arrival_airport']) 
636 636
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 			$output  = substr($output, 0, -1);
662 662
 			$output .= ']';
663 663
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
664
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
664
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
665 665
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
666 666
 			$output .= '"fc": "'.$j.'"';
667 667
 		} else {
Please login to merge, or discard this patch.
Braces   +289 added lines, -113 removed lines patch added patch discarded remove patch
@@ -48,27 +48,52 @@  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_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
67
-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_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
80
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
81
+}
82
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
83
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
84
+}
85
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
86
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
87
+}
88
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
89
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
90
+}
68 91
 
69 92
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
70 93
 	$min = true;
71
-} else $min = false;
94
+} else {
95
+	$min = false;
96
+}
72 97
 
73 98
 if (isset($_GET['ident'])) {
74 99
 	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
@@ -157,21 +182,33 @@  discard block
 block discarded – undo
157 182
 		} else {
158 183
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
159 184
 		}
160
-	} else $flightcnt = count($spotter_array);
161
-	if ($flightcnt == '') $flightcnt = 0;
162
-} else $flightcnt = 0;
185
+	} else {
186
+		$flightcnt = count($spotter_array);
187
+	}
188
+	if ($flightcnt == '') {
189
+		$flightcnt = 0;
190
+	}
191
+	} else {
192
+	$flightcnt = 0;
193
+}
163 194
 
164 195
 $sqltime = round(microtime(true)-$begintime,2);
165 196
 
166
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
167
-else $usenextlatlon = true;
197
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
198
+	$usenextlatlon = false;
199
+} else {
200
+	$usenextlatlon = true;
201
+}
168 202
 $j = 0;
169 203
 $prev_flightaware_id = '';
170 204
 $aircrafts_shadow = array();
171 205
 $output = '{';
172 206
 	$output .= '"type": "FeatureCollection",';
173
-		if ($min) $output .= '"minimal": "true",';
174
-		else $output .= '"minimal": "false",';
207
+		if ($min) {
208
+			$output .= '"minimal": "true",';
209
+		} else {
210
+			$output .= '"minimal": "false",';
211
+		}
175 212
 		//$output .= '"fc": "'.$flightcnt.'",';
176 213
 		$output .= '"sqt": "'.$sqltime.'",';
177 214
 
@@ -215,18 +252,29 @@  discard block
 block discarded – undo
215 252
 						}
216 253
 						$output .= '"properties": {';
217 254
 						if (isset($spotter_item['flightaware_id'])) {
218
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
219
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
255
+							if ($compress) {
256
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
257
+							} else {
258
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
259
+							}
220 260
 						} elseif (isset($spotter_item['famtrackid'])) {
221
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
222
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
261
+							if ($compress) {
262
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
263
+							} else {
264
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
265
+							}
223 266
 						} elseif (isset($spotter_item['fammarine_id'])) {
224
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
225
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
267
+							if ($compress) {
268
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
269
+							} else {
270
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
271
+							}
226 272
 						}
227 273
 							$output .= '"fc": "'.$flightcnt.'",';
228 274
 							$output .= '"sqt": "'.$sqltime.'",';
229
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
275
+							if (isset($begindate)) {
276
+								$output .= '"archive_date": "'.$begindate.'",';
277
+							}
230 278
 
231 279
 /*
232 280
 							if ($min) $output .= '"minimal": "true",';
@@ -234,14 +282,22 @@  discard block
 block discarded – undo
234 282
 */
235 283
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
236 284
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
237
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
238
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
285
+							if ($compress) {
286
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
287
+							} else {
288
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
289
+							}
239 290
 							//"
240 291
 						} else {
241
-							if ($compress) $output .= '"c": "NA",';
242
-							else $output .= '"callsign": "NA",';
292
+							if ($compress) {
293
+								$output .= '"c": "NA",';
294
+							} else {
295
+								$output .= '"callsign": "NA",';
296
+							}
297
+						}
298
+						if (isset($spotter_item['registration'])) {
299
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
243 300
 						}
244
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
245 301
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
246 302
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
247 303
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -254,15 +310,21 @@  discard block
 block discarded – undo
254 310
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
255 311
 						}
256 312
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
257
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
258
-							else {
313
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
314
+								$spotter_item['aircraft_shadow'] = '';
315
+							} else {
259 316
 								$aircraft_icao = $spotter_item['aircraft_icao'];
260
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
261
-								else {
317
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
318
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
319
+								} else {
262 320
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
263
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
264
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
265
-									else $spotter_item['aircraft_shadow'] = '';
321
+									if (count($aircraft_info) > 0) {
322
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
323
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
324
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
325
+									} else {
326
+										$spotter_item['aircraft_shadow'] = '';
327
+									}
266 328
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
267 329
 								}
268 330
 							}
@@ -270,73 +332,139 @@  discard block
 block discarded – undo
270 332
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
271 333
 							if ($tracker) {
272 334
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
273
-									if ($compress) $output .= '"as": "ambulance.png",';
274
-									else $output .= '"aircraft_shadow": "ambulance.png",';
335
+									if ($compress) {
336
+										$output .= '"as": "ambulance.png",';
337
+									} else {
338
+										$output .= '"aircraft_shadow": "ambulance.png",';
339
+									}
275 340
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
276
-									if ($compress) $output .= '"as": "police.png",';
277
-									else $output .= '"aircraft_shadow": "police.png",';
341
+									if ($compress) {
342
+										$output .= '"as": "police.png",';
343
+									} else {
344
+										$output .= '"aircraft_shadow": "police.png",';
345
+									}
278 346
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
279
-									if ($compress) $output .= '"as": "ship.png",';
280
-									else $output .= '"aircraft_shadow": "ship.png",';
347
+									if ($compress) {
348
+										$output .= '"as": "ship.png",';
349
+									} else {
350
+										$output .= '"aircraft_shadow": "ship.png",';
351
+									}
281 352
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
282
-									if ($compress) $output .= '"as": "ship.png",';
283
-									else $output .= '"aircraft_shadow": "ship.png",';
353
+									if ($compress) {
354
+										$output .= '"as": "ship.png",';
355
+									} else {
356
+										$output .= '"aircraft_shadow": "ship.png",';
357
+									}
284 358
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
285
-									if ($compress) $output .= '"as": "ship.png",';
286
-									else $output .= '"aircraft_shadow": "ship.png",';
359
+									if ($compress) {
360
+										$output .= '"as": "ship.png",';
361
+									} else {
362
+										$output .= '"aircraft_shadow": "ship.png",';
363
+									}
287 364
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
288
-									if ($compress) $output .= '"as": "truck.png",';
289
-									else $output .= '"aircraft_shadow": "truck.png",';
365
+									if ($compress) {
366
+										$output .= '"as": "truck.png",';
367
+									} else {
368
+										$output .= '"aircraft_shadow": "truck.png",';
369
+									}
290 370
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
291
-									if ($compress) $output .= '"as": "truck.png",';
292
-									else $output .= '"aircraft_shadow": "truck.png",';
371
+									if ($compress) {
372
+										$output .= '"as": "truck.png",';
373
+									} else {
374
+										$output .= '"aircraft_shadow": "truck.png",';
375
+									}
293 376
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
294
-									if ($compress) $output .= '"as": "aircraft.png",';
295
-									else $output .= '"aircraft_shadow": "aircraft.png",';
377
+									if ($compress) {
378
+										$output .= '"as": "aircraft.png",';
379
+									} else {
380
+										$output .= '"aircraft_shadow": "aircraft.png",';
381
+									}
296 382
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
297
-									if ($compress) $output .= '"as": "aircraft.png",';
298
-									else $output .= '"aircraft_shadow": "aircraft.png",';
383
+									if ($compress) {
384
+										$output .= '"as": "aircraft.png",';
385
+									} else {
386
+										$output .= '"aircraft_shadow": "aircraft.png",';
387
+									}
299 388
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
300
-									if ($compress) $output .= '"as": "helico.png",';
301
-									else $output .= '"aircraft_shadow": "helico.png",';
389
+									if ($compress) {
390
+										$output .= '"as": "helico.png",';
391
+									} else {
392
+										$output .= '"aircraft_shadow": "helico.png",';
393
+									}
302 394
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
303
-									if ($compress) $output .= '"as": "rail.png",';
304
-									else $output .= '"aircraft_shadow": "rail.png",';
395
+									if ($compress) {
396
+										$output .= '"as": "rail.png",';
397
+									} else {
398
+										$output .= '"aircraft_shadow": "rail.png",';
399
+									}
305 400
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
306
-									if ($compress) $output .= '"as": "firetruck.png",';
307
-									else $output .= '"aircraft_shadow": "firetruck.png",';
401
+									if ($compress) {
402
+										$output .= '"as": "firetruck.png",';
403
+									} else {
404
+										$output .= '"aircraft_shadow": "firetruck.png",';
405
+									}
308 406
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
309
-									if ($compress) $output .= '"as": "bus.png",';
310
-									else $output .= '"aircraft_shadow": "bus.png",';
407
+									if ($compress) {
408
+										$output .= '"as": "bus.png",';
409
+									} else {
410
+										$output .= '"aircraft_shadow": "bus.png",';
411
+									}
311 412
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
312
-									if ($compress) $output .= '"as": "phone.png",';
313
-									else $output .= '"aircraft_shadow": "phone.png",';
413
+									if ($compress) {
414
+										$output .= '"as": "phone.png",';
415
+									} else {
416
+										$output .= '"aircraft_shadow": "phone.png",';
417
+									}
314 418
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
315
-									if ($compress) $output .= '"as": "jogger.png",';
316
-									else $output .= '"aircraft_shadow": "jogger.png",';
419
+									if ($compress) {
420
+										$output .= '"as": "jogger.png",';
421
+									} else {
422
+										$output .= '"aircraft_shadow": "jogger.png",';
423
+									}
317 424
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
318
-									if ($compress) $output .= '"as": "bike.png",';
319
-									else $output .= '"aircraft_shadow": "bike.png",';
425
+									if ($compress) {
426
+										$output .= '"as": "bike.png",';
427
+									} else {
428
+										$output .= '"aircraft_shadow": "bike.png",';
429
+									}
320 430
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
321
-									if ($compress) $output .= '"as": "motorcycle.png",';
322
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
431
+									if ($compress) {
432
+										$output .= '"as": "motorcycle.png",';
433
+									} else {
434
+										$output .= '"aircraft_shadow": "motorcycle.png",';
435
+									}
323 436
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
324
-									if ($compress) $output .= '"as": "balloon.png",';
325
-									else $output .= '"aircraft_shadow": "balloon.png",';
437
+									if ($compress) {
438
+										$output .= '"as": "balloon.png",';
439
+									} else {
440
+										$output .= '"aircraft_shadow": "balloon.png",';
441
+									}
326 442
 								} else {
327
-									if ($compress) $output .= '"as": "car.png",';
328
-									else $output .= '"aircraft_shadow": "car.png",';
443
+									if ($compress) {
444
+										$output .= '"as": "car.png",';
445
+									} else {
446
+										$output .= '"aircraft_shadow": "car.png",';
447
+									}
329 448
 								}
330 449
 							} elseif ($marine) {
331
-								if ($compress) $output .= '"as": "ship.png",';
332
-								else $output .= '"aircraft_shadow": "ship.png",';
450
+								if ($compress) {
451
+									$output .= '"as": "ship.png",';
452
+								} else {
453
+									$output .= '"aircraft_shadow": "ship.png",';
454
+								}
333 455
 							} else {
334
-								if ($compress) $output .= '"as": "default.png",';
335
-								else $output .= '"aircraft_shadow": "default.png",';
456
+								if ($compress) {
457
+									$output .= '"as": "default.png",';
458
+								} else {
459
+									$output .= '"aircraft_shadow": "default.png",';
460
+								}
336 461
 							}
337 462
 						} else {
338
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
339
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
463
+							if ($compress) {
464
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
465
+							} else {
466
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
467
+							}
340 468
 						}
341 469
 						if (isset($spotter_item['airline_name'])) {
342 470
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -344,8 +472,11 @@  discard block
 block discarded – undo
344 472
 							$output .= '"airline_name": "NA",';
345 473
 						}
346 474
 						if (isset($spotter_item['departure_airport'])) {
347
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
348
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
475
+							if ($compress) {
476
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
477
+							} else {
478
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
479
+							}
349 480
 						}
350 481
 						if (isset($spotter_item['departure_airport_city'])) {
351 482
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -357,8 +488,11 @@  discard block
 block discarded – undo
357 488
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
358 489
 						}
359 490
 						if (isset($spotter_item['arrival_airport'])) {
360
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
361
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
491
+							if ($compress) {
492
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
493
+							} else {
494
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
495
+							}
362 496
 						}
363 497
 						if (isset($spotter_item['arrival_airport_city'])) {
364 498
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -377,11 +511,17 @@  discard block
 block discarded – undo
377 511
 						}
378 512
 						
379 513
 						if (isset($spotter_item['altitude'])) {
380
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
381
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
514
+							if ($compress) {
515
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
516
+							} else {
517
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
518
+							}
519
+						}
520
+						if ($compress) {
521
+							$output .= '"h": "'.$spotter_item['heading'].'",';
522
+						} else {
523
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
382 524
 						}
383
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
384
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
385 525
 						
386 526
 						if (isset($archivespeed)) {
387 527
 							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
@@ -391,7 +531,9 @@  discard block
 block discarded – undo
391 531
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
392 532
 						}
393 533
 
394
-						if (!$min) $output .= '"image": "'.$image.'",';
534
+						if (!$min) {
535
+							$output .= '"image": "'.$image.'",';
536
+						}
395 537
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
396 538
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
397 539
 						}
@@ -399,8 +541,11 @@  discard block
 block discarded – undo
399 541
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
400 542
 						}
401 543
 						if (isset($spotter_item['squawk'])) {
402
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
403
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
544
+							if ($compress) {
545
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
546
+							} else {
547
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
548
+							}
404 549
 						}
405 550
 						if (isset($spotter_item['squawk_usage'])) {
406 551
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -419,14 +564,23 @@  discard block
 block discarded – undo
419 564
 						}
420 565
 						// type when not aircraft ?
421 566
 						if (isset($spotter_item['type'])) {
422
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
423
-							else $output .= '"type": "'.$spotter_item['type'].'"';
567
+							if ($compress) {
568
+								$output .= '"t": "'.$spotter_item['type'].'"';
569
+							} else {
570
+								$output .= '"type": "'.$spotter_item['type'].'"';
571
+							}
424 572
 						} elseif ($marine) {
425
-							if ($compress) $output .= '"t": "ship"';
426
-							else $output .= '"type": "ship"';
573
+							if ($compress) {
574
+								$output .= '"t": "ship"';
575
+							} else {
576
+								$output .= '"type": "ship"';
577
+							}
427 578
 						} else {
428
-							if ($compress) $output .= '"t": "aircraft"';
429
-							else $output .= '"type": "aircraft"';
579
+							if ($compress) {
580
+								$output .= '"t": "aircraft"';
581
+							} else {
582
+								$output .= '"type": "aircraft"';
583
+							}
430 584
 						}
431 585
 						$output .= '},';
432 586
 						$output .= '"geometry": {';
@@ -494,7 +648,9 @@  discard block
 block discarded – undo
494 648
 			}
495 649
 */
496 650
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
497
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
651
+				if ($history == '' && isset($_COOKIE['history'])) {
652
+					$history = $_COOKIE['history'];
653
+				}
498 654
 				
499 655
 				if (
500 656
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -538,8 +694,11 @@  discard block
 block discarded – undo
538 694
 									$output_history .= ']}},';
539 695
 									$output .= $output_history;
540 696
 								}
541
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
542
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
697
+								if ($compress) {
698
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
699
+								} else {
700
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
701
+								}
543 702
 							}
544 703
 							$output_history .= '[';
545 704
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -558,9 +717,14 @@  discard block
 block discarded – undo
558 717
 							$prev_alt = $alt;
559 718
 						} else {
560 719
 							if ($d == false) {
561
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
562
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
563
-							} else $d = true;
720
+								if ($compress) {
721
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
722
+								} else {
723
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
724
+								}
725
+							} else {
726
+								$d = true;
727
+							}
564 728
 							$output_history .= '[';
565 729
 							$output_history .=  $spotter_history['longitude'].', ';
566 730
 							$output_history .=  $spotter_history['latitude'];
@@ -581,7 +745,9 @@  discard block
 block discarded – undo
581 745
 							$output_historyd = '[';
582 746
 							$output_historyd .=  $spotter_item['longitude'].', ';
583 747
 							$output_historyd .=  $spotter_item['latitude'];
584
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
748
+							if (isset($spotter_history['altitude'])) {
749
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
750
+							}
585 751
 							$output_historyd .= '],';
586 752
 							//$output_history = $output_historyd.$output_history;
587 753
 							$output_history = $output_history.$output_historyd;
@@ -604,8 +770,11 @@  discard block
 block discarded – undo
604 770
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
605 771
 				    	    || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) 
606 772
 				    	    || (isset($globalMapRoute) && $globalMapRoute)))))) {
607
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
608
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
773
+				    if ($compress) {
774
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
775
+				    } else {
776
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
777
+				    }
609 778
 				    if (isset($spotter_item['departure_airport_latitude'])) {
610 779
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
611 780
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -638,8 +807,11 @@  discard block
 block discarded – undo
638 807
 				    	    || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) 
639 808
 				    	    || (isset($globalMapRoute) && $globalMapRoute)))))) {
640 809
 				    $havedata = false;
641
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
642
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
810
+				    if ($compress) {
811
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
812
+				    } else {
813
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
814
+				    }
643 815
 				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
644 816
 
645 817
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -654,7 +826,9 @@  discard block
 block discarded – undo
654 826
 				    }
655 827
 				    //$output_dest  = substr($output_dest, 0, -1);
656 828
 				    $output_dest .= ']}},';
657
-				    if ($havedata) $output .= $output_dest;
829
+				    if ($havedata) {
830
+				    	$output .= $output_dest;
831
+				    }
658 832
 				    unset($output_dest);
659 833
 				}
660 834
 			}
@@ -662,7 +836,9 @@  discard block
 block discarded – undo
662 836
 			$output .= ']';
663 837
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
664 838
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
665
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
839
+			if (isset($begindate)) {
840
+				$output .= '"archive_date": "'.$begindate.'",';
841
+			}
666 842
 			$output .= '"fc": "'.$j.'"';
667 843
 		} else {
668 844
 			$output .= '"features": ';
Please login to merge, or discard this patch.