Completed
Push — master ( 35ee00...39c0a3 )
by Yannick
28:16
created
live-geojson.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -64,17 +64,17 @@  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);
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 78
 
79 79
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
80 80
 	$min = true;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 $spotter_array = array();
84 84
 
85 85
 if (isset($_GET['ident'])) {
86
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
86
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
87 87
 	if ($tracker) {
88 88
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
89 89
 	} elseif ($marine) {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 	$allhistory = true;
99 99
 } elseif (isset($_GET['flightaware_id'])) {
100
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
100
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
101 101
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
102 102
 	if (empty($spotter_array)) {
103 103
 		$from_archive = true;
@@ -105,38 +105,38 @@  discard block
 block discarded – undo
105 105
 	}
106 106
 	$allhistory = true;
107 107
 } elseif (isset($_GET['famtrack_id'])) {
108
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
108
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
109 109
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
110 110
 	$allhistory = true;
111 111
 } elseif (isset($_GET['fammarine_id'])) {
112
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
112
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
113 113
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
114 114
 	$allhistory = true;
115 115
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
116 116
 //} elseif (isset($_GET['coord'])) {
117 117
 	$usecoord = true;
118
-	$coord = explode(',',$_GET['coord']);
119
-	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) 
118
+	$coord = explode(',', $_GET['coord']);
119
+	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) 
120 120
 	    && $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) {
121 121
 		if ($tracker) {
122
-			$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
122
+			$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter);
123 123
 		} elseif ($marine) {
124
-			$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter);
124
+			$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter);
125 125
 		} else {
126
-			$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
126
+			$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
127 127
 		}
128 128
 	}
129 129
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) {
130 130
 	$usecoord = true;
131
-	$coord = explode(',',$_GET['coord']);
132
-	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) 
131
+	$coord = explode(',', $_GET['coord']);
132
+	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 133
 	    && $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) {
134 134
 		if ($tracker) {
135
-			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
135
+			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
136 136
 		} elseif ($marine) {
137
-			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
137
+			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
138 138
 		} else {
139
-			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
139
+			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
140 140
 		}
141 141
 	} else {
142 142
 		if ($tracker) {
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 	$from_archive = true;
152 152
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
153 153
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
154
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
155
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
156
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
157
-	$begindate = date('Y-m-d H:i:s',$begindate);
158
-	$enddate = date('Y-m-d H:i:s',$enddate);
159
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
154
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
155
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
156
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
157
+	$begindate = date('Y-m-d H:i:s', $begindate);
158
+	$enddate = date('Y-m-d H:i:s', $enddate);
159
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
160 160
 } elseif ($min) {
161 161
 	if ($tracker) {
162 162
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -168,17 +168,17 @@  discard block
 block discarded – undo
168 168
 #	$min = true;
169 169
 } else {
170 170
 	if ($tracker) {
171
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
171
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
172 172
 	} elseif ($marine) {
173
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
173
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
174 174
 	} else {
175
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
175
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
176 176
 	}
177 177
 }
178 178
 
179 179
 if ($usecoord) {
180 180
 	if (isset($_GET['archive'])) {
181
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
181
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
182 182
 	} else {
183 183
 		if ($tracker) {
184 184
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 	if ($flightcnt == '') $flightcnt = 0;
192 192
 } else $flightcnt = 0;
193 193
 
194
-$sqltime = round(microtime(true)-$begintime,2);
194
+$sqltime = round(microtime(true) - $begintime, 2);
195 195
 
196
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
196
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
197 197
 if ($currenttime != '') $currenttime = round($currenttime/1000);
198 198
 
199 199
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		if (!empty($spotter_array) && is_array($spotter_array))
213 213
 		{
214 214
 			$output .= '"features": [';
215
-			foreach($spotter_array as $spotter_item)
215
+			foreach ($spotter_array as $spotter_item)
216 216
 			{
217 217
 				$j++;
218 218
 				unset($idistance);
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 */
270 270
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
271 271
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
272
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
273
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
272
+							if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
273
+							else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",';
274 274
 							//"
275 275
 						} else {
276 276
 							if ($compress) $output .= '"c": "NA",';
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
280 280
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
281 281
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
282
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
282
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
283 283
 						} elseif (isset($spotter_item['aircraft_type'])) {
284 284
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
285 285
 						} elseif (!$min) {
@@ -422,15 +422,15 @@  discard block
 block discarded – undo
422 422
 						if (isset($archivespeed) || $usenextlatlon) {
423 423
 							if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
424 424
 								if (isset($spotter_item['arrival_airport_latitude'])) {
425
-									$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
426
-									$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
425
+									$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
426
+									$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
427 427
 									$farr_lat = $spotter_item['arrival_airport_latitude'];
428 428
 									$farr_lon = $spotter_item['arrival_airport_longitude'];
429 429
 								} else {
430 430
 									$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
431 431
 									if (isset($aairport[0]['latitude'])) {
432
-										$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
433
-										$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
432
+										$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
433
+										$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
434 434
 										$farr_lat = $aairport[0]['latitude'];
435 435
 										$farr_lon = $aairport[0]['longitude'];
436 436
 									}
@@ -443,59 +443,59 @@  discard block
 block discarded – undo
443 443
 						if ($currenttime != '') {
444 444
 							if (strtotime($spotter_item['date']) < $currenttime) {
445 445
 								if (isset($archivespeed)) {
446
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
447
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
446
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
447
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
448 448
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
449 449
 									else {
450
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
451
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
450
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
451
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
452 452
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
453 453
 										else {
454
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
454
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
455 455
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
456 456
 										}
457 457
 									}
458 458
 								} elseif ($usenextlatlon) {
459
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
460
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
459
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
460
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
461 461
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
462 462
 									else {
463
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
464
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
463
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
464
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
465 465
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
466 466
 										else {
467
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
467
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
468 468
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
469 469
 										}
470 470
 									}
471 471
 								}
472 472
 							} else {
473 473
 								if (isset($archivespeed)) {
474
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
474
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
475 475
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
476 476
 								} elseif ($usenextlatlon) {
477
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
477
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
478 478
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
479 479
 								}
480 480
 							}
481 481
 						} else {
482 482
 							if (isset($archivespeed)) {
483
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
484
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
483
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
484
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
485 485
 								if (!isset($idistance) || $fdistance < $idistance) {
486 486
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
487 487
 								} else {
488
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed);
488
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed);
489 489
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
490 490
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
491 491
 								}
492 492
 							} elseif ($usenextlatlon) {
493
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
494
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
493
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
494
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
495 495
 								if (!isset($idistance) || $fdistance < $idistance) {
496 496
 										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
497 497
 								} else {
498
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading);
498
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading);
499 499
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
500 500
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
501 501
 								}
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 
505 505
 						if (!$min) $output .= '"image": "'.$image.'",';
506 506
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
507
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
507
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
508 508
 						}
509 509
 						if (isset($spotter_item['image_source_website'])) {
510 510
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
527 527
 						}
528 528
 						if (isset($spotter_item['acars'])) {
529
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
529
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
530 530
 						}
531 531
 						// type when not aircraft ?
532 532
 						if (isset($spotter_item['type'])) {
@@ -546,12 +546,12 @@  discard block
 block discarded – undo
546 546
 								if ($currenttime != '') {
547 547
 									if (strtotime($spotter_item['date']) < $currenttime) {
548 548
 										if (!isset($archivespeed)) $archivespeed = 1;
549
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
550
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
549
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
550
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
551 551
 										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
552 552
 										else {
553
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
554
-											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
553
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
554
+											$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
555 555
 											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
556 556
 											else {
557 557
 												$output .= $spotter_item['longitude'].', ';
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
                 
631 631
 			}
632 632
 */
633
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
633
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
634 634
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
635 635
 				
636 636
 				if (
@@ -638,11 +638,11 @@  discard block
 block discarded – undo
638 638
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
639 639
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
640 640
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
641
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
641
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
642 642
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
643
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
643
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
644 644
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
645
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
645
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
646 646
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
647 647
 				    ) {
648 648
 					if ($tracker) {
@@ -679,9 +679,9 @@  discard block
 block discarded – undo
679 679
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
680 680
 							}
681 681
 							$output_history .= '[';
682
-							$output_history .=  $spotter_history['longitude'].', ';
683
-							$output_history .=  $spotter_history['latitude'].', ';
684
-							$output_history .=  $spotter_history['altitude']*30.48;
682
+							$output_history .= $spotter_history['longitude'].', ';
683
+							$output_history .= $spotter_history['latitude'].', ';
684
+							$output_history .= $spotter_history['altitude']*30.48;
685 685
 							$output_history .= '],';
686 686
 							/*
687 687
 							if ($from_archive === false) {
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
700 700
 							} else $d = true;
701 701
 							$output_history .= '[';
702
-							$output_history .=  $spotter_history['longitude'].', ';
703
-							$output_history .=  $spotter_history['latitude'];
702
+							$output_history .= $spotter_history['longitude'].', ';
703
+							$output_history .= $spotter_history['latitude'];
704 704
 							$output_history .= '],';
705 705
 							/*
706 706
 							if ($from_archive === false) {
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
 					
717 717
 						if ($from_archive === false) {
718 718
 							$output_historyd = '[';
719
-							$output_historyd .=  $spotter_item['longitude'].', ';
720
-							$output_historyd .=  $spotter_item['latitude'];
721
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
719
+							$output_historyd .= $spotter_item['longitude'].', ';
720
+							$output_historyd .= $spotter_item['latitude'];
721
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
722 722
 							$output_historyd .= '],';
723 723
 							//$output_history = $output_historyd.$output_history;
724 724
 							$output_history = $output_history.$output_historyd;
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 					}
733 733
 				}
734 734
 				
735
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
735
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
736 736
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
737 737
 				     && (isset($spotter_item['departure_airport']) 
738 738
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 
767 767
 				//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))))) {
768 768
 				//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))))) {
769
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
769
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
770 770
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
771 771
 				     && (isset($spotter_item['arrival_airport']) 
772 772
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 			$output  = substr($output, 0, -1);
798 798
 			$output .= ']';
799 799
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
800
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
800
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
801 801
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
802 802
 			$output .= '"fc": "'.$j.'"';
803 803
 		} else {
Please login to merge, or discard this patch.