Completed
Push — master ( 8b0949...4e1c61 )
by Yannick
55:45 queued 25:25
created
live-geojson.php 2 patches
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -64,18 +64,18 @@  discard block
 block discarded – undo
64 64
 $min = true;
65 65
 $allhistory = false;
66 66
 $filter['source'] = array();
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
72
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
78
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
67
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
68
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
69
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
70
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
71
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
72
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
73
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
74
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
75
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
76
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
77
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
78
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT);
79 79
 
80 80
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
81 81
 	$min = true;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 $spotter_array = array();
85 85
 
86 86
 if (isset($_GET['ident'])) {
87
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
87
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
88 88
 	if ($tracker) {
89 89
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
90 90
 	} elseif ($marine) {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 	$allhistory = true;
100 100
 } elseif (isset($_GET['flightaware_id'])) {
101
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
101
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
102 102
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
103 103
 	if (empty($spotter_array)) {
104 104
 		$from_archive = true;
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 	}
107 107
 	$allhistory = true;
108 108
 } elseif (isset($_GET['famtrack_id'])) {
109
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
109
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
110 110
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
111 111
 	$allhistory = true;
112 112
 } elseif (isset($_GET['fammarine_id'])) {
113
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
113
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
114 114
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
115 115
 	$allhistory = true;
116 116
 /*
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
 */
131 131
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min && !isset($_GET['archive'])) {
132 132
 	$usecoord = true;
133
-	$coord = explode(',',$_GET['coord']);
134
-	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
133
+	$coord = explode(',', $_GET['coord']);
134
+	if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
135 135
 	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
136 136
 		if ($tracker) {
137
-			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
137
+			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
138 138
 		} elseif ($marine) {
139
-			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
139
+			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
140 140
 		} else {
141
-			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
141
+			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
142 142
 		}
143 143
 	} else {
144 144
 		if ($tracker) {
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 	$from_archive = true;
154 154
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
155 155
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
156
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
157
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
158
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
159
-	$begindate = date('Y-m-d H:i:s',$begindate);
160
-	$enddate = date('Y-m-d H:i:s',$enddate);
161
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
156
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
157
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
158
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
159
+	$begindate = date('Y-m-d H:i:s', $begindate);
160
+	$enddate = date('Y-m-d H:i:s', $enddate);
161
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
162 162
 } elseif ($min) {
163 163
 	if ($tracker) {
164 164
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -170,17 +170,17 @@  discard block
 block discarded – undo
170 170
 #	$min = true;
171 171
 } else {
172 172
 	if ($tracker) {
173
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
173
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
174 174
 	} elseif ($marine) {
175
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
175
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
176 176
 	} else {
177
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
177
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
178 178
 	}
179 179
 }
180 180
 
181 181
 if ($usecoord) {
182 182
 	if (isset($_GET['archive'])) {
183
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
183
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
184 184
 	} else {
185 185
 		if ($tracker) {
186 186
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 	if ($flightcnt == '') $flightcnt = 0;
194 194
 } else $flightcnt = 0;
195 195
 
196
-$sqltime = round(microtime(true)-$begintime,2);
196
+$sqltime = round(microtime(true) - $begintime, 2);
197 197
 
198
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
198
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
199 199
 if ($currenttime != '') $currenttime = round($currenttime/1000);
200 200
 
201 201
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		if (!empty($spotter_array) && is_array($spotter_array))
215 215
 		{
216 216
 			$output .= '"features": [';
217
-			foreach($spotter_array as $spotter_item)
217
+			foreach ($spotter_array as $spotter_item)
218 218
 			{
219 219
 				$j++;
220 220
 				unset($idistance);
@@ -271,8 +271,8 @@  discard block
 block discarded – undo
271 271
 */
272 272
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
273 273
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
274
-							if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
275
-							else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
274
+							if ($compress) $output .= '"c": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).',';
275
+							else $output .= '"callsign": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).',';
276 276
 							//'
277 277
 						} else {
278 278
 							if ($compress) $output .= '"c": "NA",';
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 						}
285 285
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
286 286
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
287
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
287
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
288 288
 						} elseif (isset($spotter_item['aircraft_type'])) {
289 289
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
290 290
 						} elseif (!$min) {
@@ -370,19 +370,19 @@  discard block
 block discarded – undo
370 370
 									else $output .= '"aircraft_shadow": "car.png",';
371 371
 								}
372 372
 							} elseif ($marine) {
373
-								if (isset($spotter_item['type']) && ($spotter_item['type']  == '50&#39; Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
373
+								if (isset($spotter_item['type']) && ($spotter_item['type'] == '50&#39; Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
374 374
 									if ($compress) $output .= '"as": "50perfcruiser.png",';
375 375
 									else $output .= '"aircraft_shadow": "50perfcruiser.png",';
376
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Sailaway Cruiser 38') {
376
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Sailaway Cruiser 38') {
377 377
 									if ($compress) $output .= '"as": "cruiser38.png",';
378 378
 									else $output .= '"aircraft_shadow": "cruiser38.png",';
379
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Mini Transat') {
379
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Mini Transat') {
380 380
 									if ($compress) $output .= '"as": "transat.png",';
381 381
 									else $output .= '"aircraft_shadow": "transat.png",';
382
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == '52&#39; Cruising Cat') {
382
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == '52&#39; Cruising Cat') {
383 383
 									if ($compress) $output .= '"as": "catamaran.png",';
384 384
 									else $output .= '"aircraft_shadow": "catamaran.png",';
385
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Caribbean Rose') {
385
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Caribbean Rose') {
386 386
 									if ($compress) $output .= '"as": "carib.png",';
387 387
 									else $output .= '"aircraft_shadow": "carib.png",';
388 388
 								} else {
@@ -448,15 +448,15 @@  discard block
 block discarded – undo
448 448
 						if (isset($archivespeed) || $usenextlatlon) {
449 449
 							if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
450 450
 								if (isset($spotter_item['arrival_airport_latitude'])) {
451
-									$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
452
-									$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
451
+									$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
452
+									$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
453 453
 									$farr_lat = $spotter_item['arrival_airport_latitude'];
454 454
 									$farr_lon = $spotter_item['arrival_airport_longitude'];
455 455
 								} else {
456 456
 									$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
457 457
 									if (isset($aairport[0]['latitude'])) {
458
-										$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
459
-										$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
458
+										$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
459
+										$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
460 460
 										$farr_lat = $aairport[0]['latitude'];
461 461
 										$farr_lon = $aairport[0]['longitude'];
462 462
 									}
@@ -469,59 +469,59 @@  discard block
 block discarded – undo
469 469
 						if ($currenttime != '') {
470 470
 							if (strtotime($spotter_item['date']) < $currenttime) {
471 471
 								if (isset($archivespeed)) {
472
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
473
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
472
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
473
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
474 474
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
475 475
 									else {
476
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
477
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
476
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
477
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
478 478
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
479 479
 										else {
480
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
480
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
481 481
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
482 482
 										}
483 483
 									}
484 484
 								} elseif ($usenextlatlon) {
485
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
486
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
485
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
486
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
487 487
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
488 488
 									else {
489
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
490
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
489
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
490
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
491 491
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
492 492
 										else {
493
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
493
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
494 494
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
495 495
 										}
496 496
 									}
497 497
 								}
498 498
 							} else {
499 499
 								if (isset($archivespeed)) {
500
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
500
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
501 501
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
502 502
 								} elseif ($usenextlatlon) {
503
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
503
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
504 504
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
505 505
 								}
506 506
 							}
507 507
 						} else {
508 508
 							if (isset($archivespeed)) {
509
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
510
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
509
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
510
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
511 511
 								if (!isset($idistance) || $fdistance < $idistance) {
512 512
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
513 513
 								} else {
514
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed);
514
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed);
515 515
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
516 516
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
517 517
 								}
518 518
 							} elseif ($usenextlatlon) {
519
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
520
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
519
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
520
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
521 521
 								if (!isset($idistance) || $fdistance < $idistance) {
522 522
 										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
523 523
 								} else {
524
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading);
524
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading);
525 525
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
526 526
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
527 527
 								}
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 
531 531
 						if (!$min) $output .= '"image": "'.$image.'",';
532 532
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
533
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
533
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
534 534
 						}
535 535
 						if (isset($spotter_item['image_source_website'])) {
536 536
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
559 559
 						}
560 560
 						if (isset($spotter_item['acars'])) {
561
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
561
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
562 562
 						}
563 563
 						// type when not aircraft ?
564 564
 						if (isset($spotter_item['type'])) {
@@ -578,12 +578,12 @@  discard block
 block discarded – undo
578 578
 								if ($currenttime != '') {
579 579
 									if (strtotime($spotter_item['date']) < $currenttime) {
580 580
 										if (!isset($archivespeed)) $archivespeed = 1;
581
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
582
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
581
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
582
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
583 583
 										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
584 584
 										else {
585
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
586
-											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
585
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
586
+											$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
587 587
 											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
588 588
 											else {
589 589
 												$output .= $spotter_item['longitude'].', ';
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
                 
663 663
 			}
664 664
 */
665
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
665
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
666 666
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
667 667
 				
668 668
 				if (
@@ -670,11 +670,11 @@  discard block
 block discarded – undo
670 670
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
671 671
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
672 672
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
673
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
673
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
674 674
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
675
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
675
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
676 676
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
677
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
677
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
678 678
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
679 679
 				    ) {
680 680
 					if ($tracker) {
@@ -703,9 +703,9 @@  discard block
 block discarded – undo
703 703
 							require(dirname(__FILE__).'/require/class.MapMatching.php');
704 704
 							$MapMatching = new MapMatching();
705 705
 							if (isset($spotter_item['date_iso_8601'])) {
706
-								$spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date_iso_8601'])))));
706
+								$spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date_iso_8601'])))));
707 707
 							} else {
708
-								$spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date'])))));
708
+								$spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date'])))));
709 709
 							}
710 710
 							$spotter_history_array = $MapMatching->match($spotter_history_array_mm);
711 711
 						}
@@ -737,9 +737,9 @@  discard block
 block discarded – undo
737 737
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
738 738
 							}
739 739
 							$output_history .= '[';
740
-							$output_history .=  $spotter_history['longitude'].', ';
741
-							$output_history .=  $spotter_history['latitude'].', ';
742
-							$output_history .=  $spotter_history['altitude']*30.48;
740
+							$output_history .= $spotter_history['longitude'].', ';
741
+							$output_history .= $spotter_history['latitude'].', ';
742
+							$output_history .= $spotter_history['altitude']*30.48;
743 743
 							$output_history .= '],';
744 744
 							/*
745 745
 							if ($from_archive === false) {
@@ -762,8 +762,8 @@  discard block
 block discarded – undo
762 762
 								$d = true;
763 763
 							}
764 764
 							$output_history .= '[';
765
-							$output_history .=  $spotter_history['longitude'].', ';
766
-							$output_history .=  $spotter_history['latitude'];
765
+							$output_history .= $spotter_history['longitude'].', ';
766
+							$output_history .= $spotter_history['latitude'];
767 767
 							$output_history .= '],';
768 768
 							/*
769 769
 							if ($from_archive === false) {
@@ -779,9 +779,9 @@  discard block
 block discarded – undo
779 779
 						//echo $output_history;
780 780
 						if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) {
781 781
 							$output_historyd = '[';
782
-							$output_historyd .=  $spotter_item['longitude'].', ';
783
-							$output_historyd .=  $spotter_item['latitude'];
784
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
782
+							$output_historyd .= $spotter_item['longitude'].', ';
783
+							$output_historyd .= $spotter_item['latitude'];
784
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
785 785
 							$output_historyd .= '],';
786 786
 							//$output_history = $output_historyd.$output_history;
787 787
 							$output_history = $output_history.$output_historyd;
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 							$last = array_pop($spotter_history_array);
790 790
 							$latitude = $last['latitude'];
791 791
 							$longitude = $last['longitude'];
792
-							$output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output);
792
+							$output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output);
793 793
 						}
794 794
 						
795 795
 						$output_history  = substr($output_history, 0, -1);
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 					
802 802
 				}
803 803
 				
804
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
804
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
805 805
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
806 806
 				     && (isset($spotter_item['departure_airport']) 
807 807
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 
836 836
 				//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))))) {
837 837
 				//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))))) {
838
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
838
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
839 839
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
840 840
 				     && (isset($spotter_item['arrival_airport']) 
841 841
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -862,11 +862,11 @@  discard block
 block discarded – undo
862 862
 					}
863 863
 				    }
864 864
 				    if ($havedata) {
865
-					$line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon);
865
+					$line = $Common->greatCircle($spotter_item['latitude'], $spotter_item['longitude'], $end_lat, $end_lon);
866 866
 					foreach ($line[0] as $coord) {
867 867
 						$output_dest .= '['.$coord[0].','.$coord[1].'],';
868 868
 					}
869
-					$output_dest  = substr($output_dest, 0, -1);
869
+					$output_dest = substr($output_dest, 0, -1);
870 870
 				    }
871 871
 				    $output_dest .= ']}},';
872 872
 				    if ($havedata) $output .= $output_dest;
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 			$output  = substr($output, 0, -1);
877 877
 			$output .= ']';
878 878
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
879
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
879
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
880 880
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
881 881
 			$output .= '"fc": "'.$j.'"';
882 882
 		} else {
Please login to merge, or discard this patch.
Braces   +361 added lines, -146 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 $tracker = false;
13 13
 $marine = false;
14 14
 $usecoord = false;
15
-if (isset($_GET['test'])) exit();
15
+if (isset($_GET['test'])) {
16
+	exit();
17
+}
16 18
 if (isset($_GET['tracker'])) {
17 19
     $tracker = true;
18 20
 }
@@ -57,29 +59,58 @@  discard block
 block discarded – undo
57 59
 }
58 60
 header('Content-Type: text/javascript');
59 61
 
60
-if (!isset($globalJsonCompress)) $compress = true;
61
-else $compress = $globalJsonCompress;
62
+if (!isset($globalJsonCompress)) {
63
+	$compress = true;
64
+} else {
65
+	$compress = $globalJsonCompress;
66
+}
62 67
 
63 68
 $from_archive = false;
64 69
 $min = true;
65 70
 $allhistory = false;
66 71
 $filter['source'] = array();
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
72
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
78
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
72
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
73
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
74
+}
75
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
76
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
77
+}
78
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
79
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
80
+}
81
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
82
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
83
+}
84
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
85
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
86
+}
87
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
88
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
89
+}
90
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
91
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
92
+}
93
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
94
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
95
+}
96
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
97
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
98
+}
99
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
100
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
101
+}
102
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
103
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
104
+}
105
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') {
106
+	$filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
107
+}
79 108
 
80 109
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
81 110
 	$min = true;
82
-} else $min = false;
111
+} else {
112
+	$min = false;
113
+}
83 114
 
84 115
 $spotter_array = array();
85 116
 
@@ -190,24 +221,38 @@  discard block
 block discarded – undo
190 221
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
191 222
 		}
192 223
 	}
193
-	if ($flightcnt == '') $flightcnt = 0;
194
-} else $flightcnt = 0;
224
+	if ($flightcnt == '') {
225
+		$flightcnt = 0;
226
+	}
227
+	} else {
228
+	$flightcnt = 0;
229
+}
195 230
 
196 231
 $sqltime = round(microtime(true)-$begintime,2);
197 232
 
198 233
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
199
-if ($currenttime != '') $currenttime = round($currenttime/1000);
234
+if ($currenttime != '') {
235
+	$currenttime = round($currenttime/1000);
236
+}
200 237
 
201
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
202
-else $usenextlatlon = true;
203
-if ($usenextlatlon === false) $currenttime = '';
238
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
239
+	$usenextlatlon = false;
240
+} else {
241
+	$usenextlatlon = true;
242
+}
243
+if ($usenextlatlon === false) {
244
+	$currenttime = '';
245
+}
204 246
 $j = 0;
205 247
 $prev_flightaware_id = '';
206 248
 $aircrafts_shadow = array();
207 249
 $output = '{';
208 250
 	$output .= '"type": "FeatureCollection",';
209
-		if ($min) $output .= '"minimal": "true",';
210
-		else $output .= '"minimal": "false",';
251
+		if ($min) {
252
+			$output .= '"minimal": "true",';
253
+		} else {
254
+			$output .= '"minimal": "false",';
255
+		}
211 256
 		//$output .= '"fc": "'.$flightcnt.'",';
212 257
 		$output .= '"sqt": "'.$sqltime.'",';
213 258
 
@@ -252,18 +297,29 @@  discard block
 block discarded – undo
252 297
 						}
253 298
 						$output .= '"properties": {';
254 299
 						if (isset($spotter_item['flightaware_id'])) {
255
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
256
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
300
+							if ($compress) {
301
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
302
+							} else {
303
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
304
+							}
257 305
 						} elseif (isset($spotter_item['famtrackid'])) {
258
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
259
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
306
+							if ($compress) {
307
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
308
+							} else {
309
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
310
+							}
260 311
 						} elseif (isset($spotter_item['fammarine_id'])) {
261
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
262
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
312
+							if ($compress) {
313
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
314
+							} else {
315
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
316
+							}
263 317
 						}
264 318
 						$output .= '"fc": "'.$flightcnt.'",';
265 319
 						$output .= '"sqt": "'.$sqltime.'",';
266
-						if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
320
+						if (isset($begindate)) {
321
+							$output .= '"archive_date": "'.$begindate.'",';
322
+						}
267 323
 
268 324
 /*
269 325
 							if ($min) $output .= '"minimal": "true",';
@@ -271,16 +327,25 @@  discard block
 block discarded – undo
271 327
 */
272 328
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
273 329
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
274
-							if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
275
-							else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
330
+							if ($compress) {
331
+								$output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
332
+							} else {
333
+								$output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
334
+							}
276 335
 							//'
277 336
 						} else {
278
-							if ($compress) $output .= '"c": "NA",';
279
-							else $output .= '"callsign": "NA",';
337
+							if ($compress) {
338
+								$output .= '"c": "NA",';
339
+							} else {
340
+								$output .= '"callsign": "NA",';
341
+							}
280 342
 						}
281 343
 						if (isset($spotter_item['registration'])) {
282
-							if ($compress) $output .= '"reg": '.json_encode($spotter_item['registration']).',';
283
-							else $output .= '"registration": '.json_encode($spotter_item['registration']).',';
344
+							if ($compress) {
345
+								$output .= '"reg": '.json_encode($spotter_item['registration']).',';
346
+							} else {
347
+								$output .= '"registration": '.json_encode($spotter_item['registration']).',';
348
+							}
284 349
 						}
285 350
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
286 351
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
@@ -291,20 +356,30 @@  discard block
 block discarded – undo
291 356
 							$output .= '"aircraft_name": "NA",';
292 357
 						}
293 358
 						if (isset($spotter_item['aircraft_icao'])) {
294
-							if ($compress) $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",';
295
-							else $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
359
+							if ($compress) {
360
+								$output .= '"ai": "'.$spotter_item['aircraft_icao'].'",';
361
+							} else {
362
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
363
+							}
296 364
 						}
297 365
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) {
298
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
299
-							else {
366
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
367
+								$spotter_item['aircraft_shadow'] = '';
368
+							} else {
300 369
 								$aircraft_icao = $spotter_item['aircraft_icao'];
301
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
302
-								else {
370
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
371
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
372
+								} else {
303 373
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
304
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
305
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
306
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
307
-									else $spotter_item['aircraft_shadow'] = '';
374
+									if (count($aircraft_info) > 0) {
375
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
376
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
377
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
378
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
379
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
380
+									} else {
381
+										$spotter_item['aircraft_shadow'] = '';
382
+									}
308 383
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
309 384
 								}
310 385
 							}
@@ -312,90 +387,171 @@  discard block
 block discarded – undo
312 387
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
313 388
 							if ($tracker) {
314 389
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
315
-									if ($compress) $output .= '"as": "ambulance.png",';
316
-									else $output .= '"aircraft_shadow": "ambulance.png",';
390
+									if ($compress) {
391
+										$output .= '"as": "ambulance.png",';
392
+									} else {
393
+										$output .= '"aircraft_shadow": "ambulance.png",';
394
+									}
317 395
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
318
-									if ($compress) $output .= '"as": "police.png",';
319
-									else $output .= '"aircraft_shadow": "police.png",';
396
+									if ($compress) {
397
+										$output .= '"as": "police.png",';
398
+									} else {
399
+										$output .= '"aircraft_shadow": "police.png",';
400
+									}
320 401
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
321
-									if ($compress) $output .= '"as": "ship.png",';
322
-									else $output .= '"aircraft_shadow": "ship.png",';
402
+									if ($compress) {
403
+										$output .= '"as": "ship.png",';
404
+									} else {
405
+										$output .= '"aircraft_shadow": "ship.png",';
406
+									}
323 407
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
324
-									if ($compress) $output .= '"as": "ship.png",';
325
-									else $output .= '"aircraft_shadow": "ship.png",';
408
+									if ($compress) {
409
+										$output .= '"as": "ship.png",';
410
+									} else {
411
+										$output .= '"aircraft_shadow": "ship.png",';
412
+									}
326 413
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
327
-									if ($compress) $output .= '"as": "ship.png",';
328
-									else $output .= '"aircraft_shadow": "ship.png",';
414
+									if ($compress) {
415
+										$output .= '"as": "ship.png",';
416
+									} else {
417
+										$output .= '"aircraft_shadow": "ship.png",';
418
+									}
329 419
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
330
-									if ($compress) $output .= '"as": "truck.png",';
331
-									else $output .= '"aircraft_shadow": "truck.png",';
420
+									if ($compress) {
421
+										$output .= '"as": "truck.png",';
422
+									} else {
423
+										$output .= '"aircraft_shadow": "truck.png",';
424
+									}
332 425
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
333
-									if ($compress) $output .= '"as": "truck.png",';
334
-									else $output .= '"aircraft_shadow": "truck.png",';
426
+									if ($compress) {
427
+										$output .= '"as": "truck.png",';
428
+									} else {
429
+										$output .= '"aircraft_shadow": "truck.png",';
430
+									}
335 431
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
336
-									if ($compress) $output .= '"as": "aircraft.png",';
337
-									else $output .= '"aircraft_shadow": "aircraft.png",';
432
+									if ($compress) {
433
+										$output .= '"as": "aircraft.png",';
434
+									} else {
435
+										$output .= '"aircraft_shadow": "aircraft.png",';
436
+									}
338 437
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
339
-									if ($compress) $output .= '"as": "aircraft.png",';
340
-									else $output .= '"aircraft_shadow": "aircraft.png",';
438
+									if ($compress) {
439
+										$output .= '"as": "aircraft.png",';
440
+									} else {
441
+										$output .= '"aircraft_shadow": "aircraft.png",';
442
+									}
341 443
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
342
-									if ($compress) $output .= '"as": "helico.png",';
343
-									else $output .= '"aircraft_shadow": "helico.png",';
444
+									if ($compress) {
445
+										$output .= '"as": "helico.png",';
446
+									} else {
447
+										$output .= '"aircraft_shadow": "helico.png",';
448
+									}
344 449
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
345
-									if ($compress) $output .= '"as": "rail.png",';
346
-									else $output .= '"aircraft_shadow": "rail.png",';
450
+									if ($compress) {
451
+										$output .= '"as": "rail.png",';
452
+									} else {
453
+										$output .= '"aircraft_shadow": "rail.png",';
454
+									}
347 455
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
348
-									if ($compress) $output .= '"as": "firetruck.png",';
349
-									else $output .= '"aircraft_shadow": "firetruck.png",';
456
+									if ($compress) {
457
+										$output .= '"as": "firetruck.png",';
458
+									} else {
459
+										$output .= '"aircraft_shadow": "firetruck.png",';
460
+									}
350 461
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
351
-									if ($compress) $output .= '"as": "bus.png",';
352
-									else $output .= '"aircraft_shadow": "bus.png",';
462
+									if ($compress) {
463
+										$output .= '"as": "bus.png",';
464
+									} else {
465
+										$output .= '"aircraft_shadow": "bus.png",';
466
+									}
353 467
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
354
-									if ($compress) $output .= '"as": "phone.png",';
355
-									else $output .= '"aircraft_shadow": "phone.png",';
468
+									if ($compress) {
469
+										$output .= '"as": "phone.png",';
470
+									} else {
471
+										$output .= '"aircraft_shadow": "phone.png",';
472
+									}
356 473
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
357
-									if ($compress) $output .= '"as": "jogger.png",';
358
-									else $output .= '"aircraft_shadow": "jogger.png",';
474
+									if ($compress) {
475
+										$output .= '"as": "jogger.png",';
476
+									} else {
477
+										$output .= '"aircraft_shadow": "jogger.png",';
478
+									}
359 479
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
360
-									if ($compress) $output .= '"as": "bike.png",';
361
-									else $output .= '"aircraft_shadow": "bike.png",';
480
+									if ($compress) {
481
+										$output .= '"as": "bike.png",';
482
+									} else {
483
+										$output .= '"aircraft_shadow": "bike.png",';
484
+									}
362 485
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
363
-									if ($compress) $output .= '"as": "motorcycle.png",';
364
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
486
+									if ($compress) {
487
+										$output .= '"as": "motorcycle.png",';
488
+									} else {
489
+										$output .= '"aircraft_shadow": "motorcycle.png",';
490
+									}
365 491
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
366
-									if ($compress) $output .= '"as": "balloon.png",';
367
-									else $output .= '"aircraft_shadow": "balloon.png",';
492
+									if ($compress) {
493
+										$output .= '"as": "balloon.png",';
494
+									} else {
495
+										$output .= '"aircraft_shadow": "balloon.png",';
496
+									}
368 497
 								} else {
369
-									if ($compress) $output .= '"as": "car.png",';
370
-									else $output .= '"aircraft_shadow": "car.png",';
498
+									if ($compress) {
499
+										$output .= '"as": "car.png",';
500
+									} else {
501
+										$output .= '"aircraft_shadow": "car.png",';
502
+									}
371 503
 								}
372 504
 							} elseif ($marine) {
373 505
 								if (isset($spotter_item['type']) && ($spotter_item['type']  == '50&#39; Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
374
-									if ($compress) $output .= '"as": "50perfcruiser.png",';
375
-									else $output .= '"aircraft_shadow": "50perfcruiser.png",';
506
+									if ($compress) {
507
+										$output .= '"as": "50perfcruiser.png",';
508
+									} else {
509
+										$output .= '"aircraft_shadow": "50perfcruiser.png",';
510
+									}
376 511
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Sailaway Cruiser 38') {
377
-									if ($compress) $output .= '"as": "cruiser38.png",';
378
-									else $output .= '"aircraft_shadow": "cruiser38.png",';
512
+									if ($compress) {
513
+										$output .= '"as": "cruiser38.png",';
514
+									} else {
515
+										$output .= '"aircraft_shadow": "cruiser38.png",';
516
+									}
379 517
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Mini Transat') {
380
-									if ($compress) $output .= '"as": "transat.png",';
381
-									else $output .= '"aircraft_shadow": "transat.png",';
518
+									if ($compress) {
519
+										$output .= '"as": "transat.png",';
520
+									} else {
521
+										$output .= '"aircraft_shadow": "transat.png",';
522
+									}
382 523
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == '52&#39; Cruising Cat') {
383
-									if ($compress) $output .= '"as": "catamaran.png",';
384
-									else $output .= '"aircraft_shadow": "catamaran.png",';
524
+									if ($compress) {
525
+										$output .= '"as": "catamaran.png",';
526
+									} else {
527
+										$output .= '"aircraft_shadow": "catamaran.png",';
528
+									}
385 529
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Caribbean Rose') {
386
-									if ($compress) $output .= '"as": "carib.png",';
387
-									else $output .= '"aircraft_shadow": "carib.png",';
530
+									if ($compress) {
531
+										$output .= '"as": "carib.png",';
532
+									} else {
533
+										$output .= '"aircraft_shadow": "carib.png",';
534
+									}
388 535
 								} else {
389
-									if ($compress) $output .= '"as": "ship.png",';
390
-									else $output .= '"aircraft_shadow": "ship.png",';
536
+									if ($compress) {
537
+										$output .= '"as": "ship.png",';
538
+									} else {
539
+										$output .= '"aircraft_shadow": "ship.png",';
540
+									}
391 541
 								}
392 542
 							} else {
393
-								if ($compress) $output .= '"as": "default.png",';
394
-								else $output .= '"aircraft_shadow": "default.png",';
543
+								if ($compress) {
544
+									$output .= '"as": "default.png",';
545
+								} else {
546
+									$output .= '"aircraft_shadow": "default.png",';
547
+								}
395 548
 							}
396 549
 						} else {
397
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
398
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
550
+							if ($compress) {
551
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
552
+							} else {
553
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
554
+							}
399 555
 						}
400 556
 						if (isset($spotter_item['airline_name'])) {
401 557
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -403,8 +559,11 @@  discard block
 block discarded – undo
403 559
 							$output .= '"airline_name": "NA",';
404 560
 						}
405 561
 						if (isset($spotter_item['departure_airport'])) {
406
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
407
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
562
+							if ($compress) {
563
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
564
+							} else {
565
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
566
+							}
408 567
 						}
409 568
 						if (isset($spotter_item['departure_airport_city'])) {
410 569
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -416,8 +575,11 @@  discard block
 block discarded – undo
416 575
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
417 576
 						}
418 577
 						if (isset($spotter_item['arrival_airport'])) {
419
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
420
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
578
+							if ($compress) {
579
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
580
+							} else {
581
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
582
+							}
421 583
 						}
422 584
 						if (isset($spotter_item['arrival_airport_city'])) {
423 585
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -436,11 +598,17 @@  discard block
 block discarded – undo
436 598
 						}
437 599
 						
438 600
 						if (isset($spotter_item['real_altitude'])) {
439
-							if ($compress) $output .= '"a": "'.($spotter_item['real_altitude']/100).'",';
440
-							else $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",';
601
+							if ($compress) {
602
+								$output .= '"a": "'.($spotter_item['real_altitude']/100).'",';
603
+							} else {
604
+								$output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",';
605
+							}
441 606
 						} elseif (isset($spotter_item['altitude'])) {
442
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
443
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
607
+							if ($compress) {
608
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
609
+							} else {
610
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
611
+							}
444 612
 						}
445 613
 						
446 614
 						$heading = $spotter_item['heading'];
@@ -464,19 +632,24 @@  discard block
 block discarded – undo
464 632
 							}
465 633
 						}
466 634
 						
467
-						if ($compress)$output .= '"h": "'.$heading.'",';
468
-						else $output .= '"heading": "'.$heading.'",';
635
+						if ($compress) {
636
+							$output .= '"h": "'.$heading.'",';
637
+						} else {
638
+							$output .= '"heading": "'.$heading.'",';
639
+						}
469 640
 						if ($currenttime != '') {
470 641
 							if (strtotime($spotter_item['date']) < $currenttime) {
471 642
 								if (isset($archivespeed)) {
472 643
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
473 644
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
474
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
475
-									else {
645
+									if (!isset($idistance) || $fdistance < $idistance) {
646
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
647
+									} else {
476 648
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
477 649
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
478
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
479
-										else {
650
+										if (!isset($idistance) || $fdistance < $idistance) {
651
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
652
+										} else {
480 653
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
481 654
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
482 655
 										}
@@ -484,12 +657,14 @@  discard block
 block discarded – undo
484 657
 								} elseif ($usenextlatlon) {
485 658
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
486 659
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
487
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
488
-									else {
660
+									if (!isset($idistance) || $fdistance < $idistance) {
661
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
662
+									} else {
489 663
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
490 664
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
491
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
492
-										else {
665
+										if (!isset($idistance) || $fdistance < $idistance) {
666
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
667
+										} else {
493 668
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
494 669
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
495 670
 										}
@@ -528,7 +703,9 @@  discard block
 block discarded – undo
528 703
 							}
529 704
 						}
530 705
 
531
-						if (!$min) $output .= '"image": "'.$image.'",';
706
+						if (!$min) {
707
+							$output .= '"image": "'.$image.'",';
708
+						}
532 709
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
533 710
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
534 711
 						}
@@ -536,8 +713,11 @@  discard block
 block discarded – undo
536 713
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
537 714
 						}
538 715
 						if (isset($spotter_item['squawk'])) {
539
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
540
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
716
+							if ($compress) {
717
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
718
+							} else {
719
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
720
+							}
541 721
 						}
542 722
 						if (isset($spotter_item['squawk_usage'])) {
543 723
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -562,14 +742,23 @@  discard block
 block discarded – undo
562 742
 						}
563 743
 						// type when not aircraft ?
564 744
 						if (isset($spotter_item['type'])) {
565
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
566
-							else $output .= '"type": "'.$spotter_item['type'].'"';
745
+							if ($compress) {
746
+								$output .= '"t": "'.$spotter_item['type'].'"';
747
+							} else {
748
+								$output .= '"type": "'.$spotter_item['type'].'"';
749
+							}
567 750
 						} elseif ($marine) {
568
-							if ($compress) $output .= '"t": "ship"';
569
-							else $output .= '"type": "ship"';
751
+							if ($compress) {
752
+								$output .= '"t": "ship"';
753
+							} else {
754
+								$output .= '"type": "ship"';
755
+							}
570 756
 						} else {
571
-							if ($compress) $output .= '"t": "aircraft"';
572
-							else $output .= '"type": "aircraft"';
757
+							if ($compress) {
758
+								$output .= '"t": "aircraft"';
759
+							} else {
760
+								$output .= '"type": "aircraft"';
761
+							}
573 762
 						}
574 763
 						$output .= '},';
575 764
 						$output .= '"geometry": {';
@@ -577,15 +766,19 @@  discard block
 block discarded – undo
577 766
 								$output .= '"coordinates": [';
578 767
 								if ($currenttime != '') {
579 768
 									if (strtotime($spotter_item['date']) < $currenttime) {
580
-										if (!isset($archivespeed)) $archivespeed = 1;
769
+										if (!isset($archivespeed)) {
770
+											$archivespeed = 1;
771
+										}
581 772
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
582 773
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
583
-										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
584
-										else {
774
+										if (!isset($idistance) || $fdistance < $idistance) {
775
+											$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
776
+										} else {
585 777
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
586 778
 											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
587
-											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
588
-											else {
779
+											if (!isset($idistance) || $fdistance < $idistance) {
780
+												$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
781
+											} else {
589 782
 												$output .= $spotter_item['longitude'].', ';
590 783
 												$output .= $spotter_item['latitude'];
591 784
 											}
@@ -663,7 +856,9 @@  discard block
 block discarded – undo
663 856
 			}
664 857
 */
665 858
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
666
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
859
+				if ($history == '' && isset($_COOKIE['history'])) {
860
+					$history = $_COOKIE['history'];
861
+				}
667 862
 				
668 863
 				if (
669 864
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -733,8 +928,11 @@  discard block
 block discarded – undo
733 928
 									$output_history .= ']}},';
734 929
 									$output .= $output_history;
735 930
 								}
736
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
737
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
931
+								if ($compress) {
932
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
933
+								} else {
934
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
935
+								}
738 936
 							}
739 937
 							$output_history .= '[';
740 938
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -755,10 +953,15 @@  discard block
 block discarded – undo
755 953
 							if ($d == false) {
756 954
 								if ($compress) {
757 955
 									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",';
758
-									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
759
-									elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
956
+									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') {
957
+										$output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
958
+									} elseif (isset($spotter_history_array[0]['mapmatching_engine'])) {
959
+										$output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
960
+									}
760 961
 									$output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": [';
761
-								} else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
962
+								} else {
963
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
964
+								}
762 965
 								$d = true;
763 966
 							}
764 967
 							$output_history .= '[';
@@ -781,7 +984,9 @@  discard block
 block discarded – undo
781 984
 							$output_historyd = '[';
782 985
 							$output_historyd .=  $spotter_item['longitude'].', ';
783 986
 							$output_historyd .=  $spotter_item['latitude'];
784
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
987
+							if (isset($spotter_history['altitude'])) {
988
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
989
+							}
785 990
 							$output_historyd .= '],';
786 991
 							//$output_history = $output_historyd.$output_history;
787 992
 							$output_history = $output_history.$output_historyd;
@@ -809,8 +1014,11 @@  discard block
 block discarded – undo
809 1014
 				        && $spotter_item['arrival_airport'] != 'NA' 
810 1015
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
811 1016
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
812
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
813
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
1017
+				    if ($compress) {
1018
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
1019
+				    } else {
1020
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
1021
+				    }
814 1022
 				    if (isset($spotter_item['departure_airport_latitude'])) {
815 1023
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
816 1024
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -843,8 +1051,11 @@  discard block
 block discarded – undo
843 1051
 				    	    || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
844 1052
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
845 1053
 				    $havedata = false;
846
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
847
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1054
+				    if ($compress) {
1055
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1056
+				    } else {
1057
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1058
+				    }
848 1059
 				    
849 1060
 				    //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
850 1061
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -869,7 +1080,9 @@  discard block
 block discarded – undo
869 1080
 					$output_dest  = substr($output_dest, 0, -1);
870 1081
 				    }
871 1082
 				    $output_dest .= ']}},';
872
-				    if ($havedata) $output .= $output_dest;
1083
+				    if ($havedata) {
1084
+				    	$output .= $output_dest;
1085
+				    }
873 1086
 				    unset($output_dest);
874 1087
 				}
875 1088
 			}
@@ -877,7 +1090,9 @@  discard block
 block discarded – undo
877 1090
 			$output .= ']';
878 1091
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
879 1092
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
880
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
1093
+			if (isset($begindate)) {
1094
+				$output .= '"archive_date": "'.$begindate.'",';
1095
+			}
881 1096
 			$output .= '"fc": "'.$j.'"';
882 1097
 		} else {
883 1098
 			$output .= '"features": ';
Please login to merge, or discard this patch.