Completed
Push — master ( b184e5...56e07e )
by Yannick
27:11
created
live-geojson.php 2 patches
Spacing   +60 added lines, -60 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 = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
74
+	$ident = urldecode(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 = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
96
+	$famtrack_id = urldecode(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 = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
100
+	$fammarine_id = urldecode(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($globalMapUseBbox) && $globalMapUseBbox && 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,17 +142,17 @@  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 ($usecoord) {
154 154
 	if (isset($_GET['archive'])) {
155
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
155
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
156 156
 	} else {
157 157
 		if ($tracker) {
158 158
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	if ($flightcnt == '') $flightcnt = 0;
166 166
 } else $flightcnt = 0;
167 167
 
168
-$sqltime = round(microtime(true)-$begintime,2);
168
+$sqltime = round(microtime(true) - $begintime, 2);
169 169
 
170
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
170
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
171 171
 if ($currenttime != '') $currenttime = round($currenttime/1000);
172 172
 
173 173
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		if (!empty($spotter_array) && is_array($spotter_array))
187 187
 		{
188 188
 			$output .= '"features": [';
189
-			foreach($spotter_array as $spotter_item)
189
+			foreach ($spotter_array as $spotter_item)
190 190
 			{
191 191
 				$j++;
192 192
 				date_default_timezone_set('UTC');
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
 */
243 243
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
244 244
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
245
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
246
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
245
+							if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
246
+							else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",';
247 247
 							//"
248 248
 						} else {
249 249
 							if ($compress) $output .= '"c": "NA",';
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
253 253
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
254 254
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
255
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
255
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
256 256
 						} elseif (isset($spotter_item['aircraft_type'])) {
257 257
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
258 258
 						} elseif (!$min) {
@@ -395,26 +395,26 @@  discard block
 block discarded – undo
395 395
 						if ($currenttime != '') {
396 396
 							if (strtotime($spotter_item['date']) < $currenttime) {
397 397
 								if (isset($archivespeed)) {
398
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date'])+$globalMapRefresh);
398
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, $currenttime - strtotime($spotter_item['date']) + $globalMapRefresh);
399 399
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
400 400
 								} elseif ($usenextlatlon) {
401
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],1,$currenttime-strtotime($spotter_item['date'])+$globalMapRefresh);
401
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], 1, $currenttime - strtotime($spotter_item['date']) + $globalMapRefresh);
402 402
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
403 403
 								}
404 404
 							}
405 405
 						} else {
406 406
 							if (isset($archivespeed)) {
407
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
407
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
408 408
 								$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
409 409
 							} elseif ($usenextlatlon) {
410
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
410
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
411 411
 								$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
412 412
 							}
413 413
 						}
414 414
 
415 415
 						if (!$min) $output .= '"image": "'.$image.'",';
416 416
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
417
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
417
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
418 418
 						}
419 419
 						if (isset($spotter_item['image_source_website'])) {
420 420
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
437 437
 						}
438 438
 						if (isset($spotter_item['acars'])) {
439
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
439
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
440 440
 						}
441 441
 						// type when not aircraft ?
442 442
 						if (isset($spotter_item['type'])) {
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 								if ($currenttime != '') {
457 457
 									if (strtotime($spotter_item['date']) < $currenttime) {
458 458
 										if (!isset($archivespeed)) $archivespeed = 1;
459
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date']));
459
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, $currenttime - strtotime($spotter_item['date']));
460 460
 										$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
461 461
 									} else {
462 462
 										$output .= $spotter_item['longitude'].', ';
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                 
526 526
 			}
527 527
 */
528
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
528
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
529 529
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
530 530
 				
531 531
 				if (
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
534 534
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
535 535
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
536
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
536
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
537 537
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
538
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
538
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
539 539
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
540
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
540
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
541 541
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
542 542
 				    ) {
543 543
 					if ($tracker) {
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
575 575
 							}
576 576
 							$output_history .= '[';
577
-							$output_history .=  $spotter_history['longitude'].', ';
578
-							$output_history .=  $spotter_history['latitude'].', ';
579
-							$output_history .=  $spotter_history['altitude']*30.48;
577
+							$output_history .= $spotter_history['longitude'].', ';
578
+							$output_history .= $spotter_history['latitude'].', ';
579
+							$output_history .= $spotter_history['altitude']*30.48;
580 580
 							$output_history .= '],';
581 581
 							/*
582 582
 							if ($from_archive === false) {
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
595 595
 							} else $d = true;
596 596
 							$output_history .= '[';
597
-							$output_history .=  $spotter_history['longitude'].', ';
598
-							$output_history .=  $spotter_history['latitude'];
597
+							$output_history .= $spotter_history['longitude'].', ';
598
+							$output_history .= $spotter_history['latitude'];
599 599
 							$output_history .= '],';
600 600
 							/*
601 601
 							if ($from_archive === false) {
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 					
612 612
 						if ($from_archive === false) {
613 613
 							$output_historyd = '[';
614
-							$output_historyd .=  $spotter_item['longitude'].', ';
615
-							$output_historyd .=  $spotter_item['latitude'];
616
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
614
+							$output_historyd .= $spotter_item['longitude'].', ';
615
+							$output_historyd .= $spotter_item['latitude'];
616
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
617 617
 							$output_historyd .= '],';
618 618
 							//$output_history = $output_historyd.$output_history;
619 619
 							$output_history = $output_history.$output_historyd;
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 					}
628 628
 				}
629 629
 				
630
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
630
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
631 631
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
632 632
 				     && (isset($spotter_item['departure_airport']) 
633 633
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 
662 662
 				//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))))) {
663 663
 				//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))))) {
664
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
664
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
665 665
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
666 666
 				     && (isset($spotter_item['arrival_airport']) 
667 667
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 			$output  = substr($output, 0, -1);
693 693
 			$output .= ']';
694 694
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
695
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
695
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
696 696
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
697 697
 			$output .= '"fc": "'.$j.'"';
698 698
 		} else {
Please login to merge, or discard this patch.
Braces   +297 added lines, -116 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 = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
@@ -162,24 +187,38 @@  discard block
 block discarded – undo
162 187
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
163 188
 		}
164 189
 	}
165
-	if ($flightcnt == '') $flightcnt = 0;
166
-} else $flightcnt = 0;
190
+	if ($flightcnt == '') {
191
+		$flightcnt = 0;
192
+	}
193
+	} else {
194
+	$flightcnt = 0;
195
+}
167 196
 
168 197
 $sqltime = round(microtime(true)-$begintime,2);
169 198
 
170 199
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
171
-if ($currenttime != '') $currenttime = round($currenttime/1000);
200
+if ($currenttime != '') {
201
+	$currenttime = round($currenttime/1000);
202
+}
172 203
 
173
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
174
-else $usenextlatlon = true;
175
-if ($usenextlatlon === false) $currenttime = '';
204
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
205
+	$usenextlatlon = false;
206
+} else {
207
+	$usenextlatlon = true;
208
+}
209
+if ($usenextlatlon === false) {
210
+	$currenttime = '';
211
+}
176 212
 $j = 0;
177 213
 $prev_flightaware_id = '';
178 214
 $aircrafts_shadow = array();
179 215
 $output = '{';
180 216
 	$output .= '"type": "FeatureCollection",';
181
-		if ($min) $output .= '"minimal": "true",';
182
-		else $output .= '"minimal": "false",';
217
+		if ($min) {
218
+			$output .= '"minimal": "true",';
219
+		} else {
220
+			$output .= '"minimal": "false",';
221
+		}
183 222
 		//$output .= '"fc": "'.$flightcnt.'",';
184 223
 		$output .= '"sqt": "'.$sqltime.'",';
185 224
 
@@ -223,18 +262,29 @@  discard block
 block discarded – undo
223 262
 						}
224 263
 						$output .= '"properties": {';
225 264
 						if (isset($spotter_item['flightaware_id'])) {
226
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
227
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
265
+							if ($compress) {
266
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
267
+							} else {
268
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
269
+							}
228 270
 						} elseif (isset($spotter_item['famtrackid'])) {
229
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
230
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
271
+							if ($compress) {
272
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
273
+							} else {
274
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
275
+							}
231 276
 						} elseif (isset($spotter_item['fammarine_id'])) {
232
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
233
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
277
+							if ($compress) {
278
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
279
+							} else {
280
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
281
+							}
234 282
 						}
235 283
 							$output .= '"fc": "'.$flightcnt.'",';
236 284
 							$output .= '"sqt": "'.$sqltime.'",';
237
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
285
+							if (isset($begindate)) {
286
+								$output .= '"archive_date": "'.$begindate.'",';
287
+							}
238 288
 
239 289
 /*
240 290
 							if ($min) $output .= '"minimal": "true",';
@@ -242,14 +292,22 @@  discard block
 block discarded – undo
242 292
 */
243 293
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
244 294
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
245
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
246
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
295
+							if ($compress) {
296
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
297
+							} else {
298
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
299
+							}
247 300
 							//"
248 301
 						} else {
249
-							if ($compress) $output .= '"c": "NA",';
250
-							else $output .= '"callsign": "NA",';
302
+							if ($compress) {
303
+								$output .= '"c": "NA",';
304
+							} else {
305
+								$output .= '"callsign": "NA",';
306
+							}
307
+						}
308
+						if (isset($spotter_item['registration'])) {
309
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
251 310
 						}
252
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
253 311
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
254 312
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
255 313
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -262,16 +320,23 @@  discard block
 block discarded – undo
262 320
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
263 321
 						}
264 322
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
265
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
266
-							else {
323
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
324
+								$spotter_item['aircraft_shadow'] = '';
325
+							} else {
267 326
 								$aircraft_icao = $spotter_item['aircraft_icao'];
268
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
269
-								else {
327
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
328
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
329
+								} else {
270 330
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
271
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
272
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
273
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
274
-									else $spotter_item['aircraft_shadow'] = '';
331
+									if (count($aircraft_info) > 0) {
332
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
333
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
334
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
335
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
336
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
337
+									} else {
338
+										$spotter_item['aircraft_shadow'] = '';
339
+									}
275 340
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
276 341
 								}
277 342
 							}
@@ -279,73 +344,139 @@  discard block
 block discarded – undo
279 344
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
280 345
 							if ($tracker) {
281 346
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
282
-									if ($compress) $output .= '"as": "ambulance.png",';
283
-									else $output .= '"aircraft_shadow": "ambulance.png",';
347
+									if ($compress) {
348
+										$output .= '"as": "ambulance.png",';
349
+									} else {
350
+										$output .= '"aircraft_shadow": "ambulance.png",';
351
+									}
284 352
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
285
-									if ($compress) $output .= '"as": "police.png",';
286
-									else $output .= '"aircraft_shadow": "police.png",';
353
+									if ($compress) {
354
+										$output .= '"as": "police.png",';
355
+									} else {
356
+										$output .= '"aircraft_shadow": "police.png",';
357
+									}
287 358
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
288
-									if ($compress) $output .= '"as": "ship.png",';
289
-									else $output .= '"aircraft_shadow": "ship.png",';
359
+									if ($compress) {
360
+										$output .= '"as": "ship.png",';
361
+									} else {
362
+										$output .= '"aircraft_shadow": "ship.png",';
363
+									}
290 364
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
291
-									if ($compress) $output .= '"as": "ship.png",';
292
-									else $output .= '"aircraft_shadow": "ship.png",';
365
+									if ($compress) {
366
+										$output .= '"as": "ship.png",';
367
+									} else {
368
+										$output .= '"aircraft_shadow": "ship.png",';
369
+									}
293 370
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
294
-									if ($compress) $output .= '"as": "ship.png",';
295
-									else $output .= '"aircraft_shadow": "ship.png",';
371
+									if ($compress) {
372
+										$output .= '"as": "ship.png",';
373
+									} else {
374
+										$output .= '"aircraft_shadow": "ship.png",';
375
+									}
296 376
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
297
-									if ($compress) $output .= '"as": "truck.png",';
298
-									else $output .= '"aircraft_shadow": "truck.png",';
377
+									if ($compress) {
378
+										$output .= '"as": "truck.png",';
379
+									} else {
380
+										$output .= '"aircraft_shadow": "truck.png",';
381
+									}
299 382
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
300
-									if ($compress) $output .= '"as": "truck.png",';
301
-									else $output .= '"aircraft_shadow": "truck.png",';
383
+									if ($compress) {
384
+										$output .= '"as": "truck.png",';
385
+									} else {
386
+										$output .= '"aircraft_shadow": "truck.png",';
387
+									}
302 388
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
303
-									if ($compress) $output .= '"as": "aircraft.png",';
304
-									else $output .= '"aircraft_shadow": "aircraft.png",';
389
+									if ($compress) {
390
+										$output .= '"as": "aircraft.png",';
391
+									} else {
392
+										$output .= '"aircraft_shadow": "aircraft.png",';
393
+									}
305 394
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
306
-									if ($compress) $output .= '"as": "aircraft.png",';
307
-									else $output .= '"aircraft_shadow": "aircraft.png",';
395
+									if ($compress) {
396
+										$output .= '"as": "aircraft.png",';
397
+									} else {
398
+										$output .= '"aircraft_shadow": "aircraft.png",';
399
+									}
308 400
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
309
-									if ($compress) $output .= '"as": "helico.png",';
310
-									else $output .= '"aircraft_shadow": "helico.png",';
401
+									if ($compress) {
402
+										$output .= '"as": "helico.png",';
403
+									} else {
404
+										$output .= '"aircraft_shadow": "helico.png",';
405
+									}
311 406
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
312
-									if ($compress) $output .= '"as": "rail.png",';
313
-									else $output .= '"aircraft_shadow": "rail.png",';
407
+									if ($compress) {
408
+										$output .= '"as": "rail.png",';
409
+									} else {
410
+										$output .= '"aircraft_shadow": "rail.png",';
411
+									}
314 412
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
315
-									if ($compress) $output .= '"as": "firetruck.png",';
316
-									else $output .= '"aircraft_shadow": "firetruck.png",';
413
+									if ($compress) {
414
+										$output .= '"as": "firetruck.png",';
415
+									} else {
416
+										$output .= '"aircraft_shadow": "firetruck.png",';
417
+									}
317 418
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
318
-									if ($compress) $output .= '"as": "bus.png",';
319
-									else $output .= '"aircraft_shadow": "bus.png",';
419
+									if ($compress) {
420
+										$output .= '"as": "bus.png",';
421
+									} else {
422
+										$output .= '"aircraft_shadow": "bus.png",';
423
+									}
320 424
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
321
-									if ($compress) $output .= '"as": "phone.png",';
322
-									else $output .= '"aircraft_shadow": "phone.png",';
425
+									if ($compress) {
426
+										$output .= '"as": "phone.png",';
427
+									} else {
428
+										$output .= '"aircraft_shadow": "phone.png",';
429
+									}
323 430
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
324
-									if ($compress) $output .= '"as": "jogger.png",';
325
-									else $output .= '"aircraft_shadow": "jogger.png",';
431
+									if ($compress) {
432
+										$output .= '"as": "jogger.png",';
433
+									} else {
434
+										$output .= '"aircraft_shadow": "jogger.png",';
435
+									}
326 436
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
327
-									if ($compress) $output .= '"as": "bike.png",';
328
-									else $output .= '"aircraft_shadow": "bike.png",';
437
+									if ($compress) {
438
+										$output .= '"as": "bike.png",';
439
+									} else {
440
+										$output .= '"aircraft_shadow": "bike.png",';
441
+									}
329 442
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
330
-									if ($compress) $output .= '"as": "motorcycle.png",';
331
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
443
+									if ($compress) {
444
+										$output .= '"as": "motorcycle.png",';
445
+									} else {
446
+										$output .= '"aircraft_shadow": "motorcycle.png",';
447
+									}
332 448
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
333
-									if ($compress) $output .= '"as": "balloon.png",';
334
-									else $output .= '"aircraft_shadow": "balloon.png",';
449
+									if ($compress) {
450
+										$output .= '"as": "balloon.png",';
451
+									} else {
452
+										$output .= '"aircraft_shadow": "balloon.png",';
453
+									}
335 454
 								} else {
336
-									if ($compress) $output .= '"as": "car.png",';
337
-									else $output .= '"aircraft_shadow": "car.png",';
455
+									if ($compress) {
456
+										$output .= '"as": "car.png",';
457
+									} else {
458
+										$output .= '"aircraft_shadow": "car.png",';
459
+									}
338 460
 								}
339 461
 							} elseif ($marine) {
340
-								if ($compress) $output .= '"as": "ship.png",';
341
-								else $output .= '"aircraft_shadow": "ship.png",';
462
+								if ($compress) {
463
+									$output .= '"as": "ship.png",';
464
+								} else {
465
+									$output .= '"aircraft_shadow": "ship.png",';
466
+								}
342 467
 							} else {
343
-								if ($compress) $output .= '"as": "default.png",';
344
-								else $output .= '"aircraft_shadow": "default.png",';
468
+								if ($compress) {
469
+									$output .= '"as": "default.png",';
470
+								} else {
471
+									$output .= '"aircraft_shadow": "default.png",';
472
+								}
345 473
 							}
346 474
 						} else {
347
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
348
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
475
+							if ($compress) {
476
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
477
+							} else {
478
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
479
+							}
349 480
 						}
350 481
 						if (isset($spotter_item['airline_name'])) {
351 482
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -353,8 +484,11 @@  discard block
 block discarded – undo
353 484
 							$output .= '"airline_name": "NA",';
354 485
 						}
355 486
 						if (isset($spotter_item['departure_airport'])) {
356
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
357
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
487
+							if ($compress) {
488
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
489
+							} else {
490
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
491
+							}
358 492
 						}
359 493
 						if (isset($spotter_item['departure_airport_city'])) {
360 494
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -366,8 +500,11 @@  discard block
 block discarded – undo
366 500
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
367 501
 						}
368 502
 						if (isset($spotter_item['arrival_airport'])) {
369
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
370
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
503
+							if ($compress) {
504
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
505
+							} else {
506
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
507
+							}
371 508
 						}
372 509
 						if (isset($spotter_item['arrival_airport_city'])) {
373 510
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -386,11 +523,17 @@  discard block
 block discarded – undo
386 523
 						}
387 524
 						
388 525
 						if (isset($spotter_item['altitude'])) {
389
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
390
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
526
+							if ($compress) {
527
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
528
+							} else {
529
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
530
+							}
531
+						}
532
+						if ($compress) {
533
+							$output .= '"h": "'.$spotter_item['heading'].'",';
534
+						} else {
535
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
391 536
 						}
392
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
393
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
394 537
 						
395 538
 						if ($currenttime != '') {
396 539
 							if (strtotime($spotter_item['date']) < $currenttime) {
@@ -412,7 +555,9 @@  discard block
 block discarded – undo
412 555
 							}
413 556
 						}
414 557
 
415
-						if (!$min) $output .= '"image": "'.$image.'",';
558
+						if (!$min) {
559
+							$output .= '"image": "'.$image.'",';
560
+						}
416 561
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
417 562
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
418 563
 						}
@@ -420,8 +565,11 @@  discard block
 block discarded – undo
420 565
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
421 566
 						}
422 567
 						if (isset($spotter_item['squawk'])) {
423
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
424
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
568
+							if ($compress) {
569
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
570
+							} else {
571
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
572
+							}
425 573
 						}
426 574
 						if (isset($spotter_item['squawk_usage'])) {
427 575
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -440,14 +588,23 @@  discard block
 block discarded – undo
440 588
 						}
441 589
 						// type when not aircraft ?
442 590
 						if (isset($spotter_item['type'])) {
443
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
444
-							else $output .= '"type": "'.$spotter_item['type'].'"';
591
+							if ($compress) {
592
+								$output .= '"t": "'.$spotter_item['type'].'"';
593
+							} else {
594
+								$output .= '"type": "'.$spotter_item['type'].'"';
595
+							}
445 596
 						} elseif ($marine) {
446
-							if ($compress) $output .= '"t": "ship"';
447
-							else $output .= '"type": "ship"';
597
+							if ($compress) {
598
+								$output .= '"t": "ship"';
599
+							} else {
600
+								$output .= '"type": "ship"';
601
+							}
448 602
 						} else {
449
-							if ($compress) $output .= '"t": "aircraft"';
450
-							else $output .= '"type": "aircraft"';
603
+							if ($compress) {
604
+								$output .= '"t": "aircraft"';
605
+							} else {
606
+								$output .= '"type": "aircraft"';
607
+							}
451 608
 						}
452 609
 						$output .= '},';
453 610
 						$output .= '"geometry": {';
@@ -455,7 +612,9 @@  discard block
 block discarded – undo
455 612
 								$output .= '"coordinates": [';
456 613
 								if ($currenttime != '') {
457 614
 									if (strtotime($spotter_item['date']) < $currenttime) {
458
-										if (!isset($archivespeed)) $archivespeed = 1;
615
+										if (!isset($archivespeed)) {
616
+											$archivespeed = 1;
617
+										}
459 618
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date']));
460 619
 										$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
461 620
 									} else {
@@ -526,7 +685,9 @@  discard block
 block discarded – undo
526 685
 			}
527 686
 */
528 687
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
529
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
688
+				if ($history == '' && isset($_COOKIE['history'])) {
689
+					$history = $_COOKIE['history'];
690
+				}
530 691
 				
531 692
 				if (
532 693
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -570,8 +731,11 @@  discard block
 block discarded – undo
570 731
 									$output_history .= ']}},';
571 732
 									$output .= $output_history;
572 733
 								}
573
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
574
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
734
+								if ($compress) {
735
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
736
+								} else {
737
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
738
+								}
575 739
 							}
576 740
 							$output_history .= '[';
577 741
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -590,9 +754,14 @@  discard block
 block discarded – undo
590 754
 							$prev_alt = $alt;
591 755
 						} else {
592 756
 							if ($d == false) {
593
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
594
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
595
-							} else $d = true;
757
+								if ($compress) {
758
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
759
+								} else {
760
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
761
+								}
762
+							} else {
763
+								$d = true;
764
+							}
596 765
 							$output_history .= '[';
597 766
 							$output_history .=  $spotter_history['longitude'].', ';
598 767
 							$output_history .=  $spotter_history['latitude'];
@@ -613,7 +782,9 @@  discard block
 block discarded – undo
613 782
 							$output_historyd = '[';
614 783
 							$output_historyd .=  $spotter_item['longitude'].', ';
615 784
 							$output_historyd .=  $spotter_item['latitude'];
616
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
785
+							if (isset($spotter_history['altitude'])) {
786
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
787
+							}
617 788
 							$output_historyd .= '],';
618 789
 							//$output_history = $output_historyd.$output_history;
619 790
 							$output_history = $output_history.$output_historyd;
@@ -635,8 +806,11 @@  discard block
 block discarded – undo
635 806
 				        && $spotter_item['arrival_airport'] != 'NA' 
636 807
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
637 808
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
638
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
639
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
809
+				    if ($compress) {
810
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
811
+				    } else {
812
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
813
+				    }
640 814
 				    if (isset($spotter_item['departure_airport_latitude'])) {
641 815
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
642 816
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -669,8 +843,11 @@  discard block
 block discarded – undo
669 843
 				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
670 844
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
671 845
 				    $havedata = false;
672
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
673
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
846
+				    if ($compress) {
847
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
848
+				    } else {
849
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
850
+				    }
674 851
 				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
675 852
 
676 853
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -685,7 +862,9 @@  discard block
 block discarded – undo
685 862
 				    }
686 863
 				    //$output_dest  = substr($output_dest, 0, -1);
687 864
 				    $output_dest .= ']}},';
688
-				    if ($havedata) $output .= $output_dest;
865
+				    if ($havedata) {
866
+				    	$output .= $output_dest;
867
+				    }
689 868
 				    unset($output_dest);
690 869
 				}
691 870
 			}
@@ -693,7 +872,9 @@  discard block
 block discarded – undo
693 872
 			$output .= ']';
694 873
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
695 874
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
696
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
875
+			if (isset($begindate)) {
876
+				$output .= '"archive_date": "'.$begindate.'",';
877
+			}
697 878
 			$output .= '"fc": "'.$j.'"';
698 879
 		} else {
699 880
 			$output .= '"features": ';
Please login to merge, or discard this patch.