@@ -64,17 +64,17 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 { |
@@ -57,28 +57,55 @@ discard block |
||
57 | 57 | } |
58 | 58 | header('Content-Type: text/javascript'); |
59 | 59 | |
60 | -if (!isset($globalJsonCompress)) $compress = true; |
|
61 | -else $compress = $globalJsonCompress; |
|
60 | +if (!isset($globalJsonCompress)) { |
|
61 | + $compress = true; |
|
62 | +} else { |
|
63 | + $compress = $globalJsonCompress; |
|
64 | +} |
|
62 | 65 | |
63 | 66 | $from_archive = false; |
64 | 67 | $min = true; |
65 | 68 | $allhistory = false; |
66 | 69 | $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); |
|
70 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
71 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
72 | +} |
|
73 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
74 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
75 | +} |
|
76 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
77 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
78 | +} |
|
79 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
80 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
81 | +} |
|
82 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
83 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
84 | +} |
|
85 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
86 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
87 | +} |
|
88 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
89 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
90 | +} |
|
91 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
92 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
93 | +} |
|
94 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
95 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
96 | +} |
|
97 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
98 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
99 | +} |
|
100 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
101 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
102 | +} |
|
78 | 103 | |
79 | 104 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
80 | 105 | $min = true; |
81 | -} else $min = false; |
|
106 | +} else { |
|
107 | + $min = false; |
|
108 | +} |
|
82 | 109 | |
83 | 110 | $spotter_array = array(); |
84 | 111 | |
@@ -188,24 +215,38 @@ discard block |
||
188 | 215 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
189 | 216 | } |
190 | 217 | } |
191 | - if ($flightcnt == '') $flightcnt = 0; |
|
192 | -} else $flightcnt = 0; |
|
218 | + if ($flightcnt == '') { |
|
219 | + $flightcnt = 0; |
|
220 | + } |
|
221 | + } else { |
|
222 | + $flightcnt = 0; |
|
223 | +} |
|
193 | 224 | |
194 | 225 | $sqltime = round(microtime(true)-$begintime,2); |
195 | 226 | |
196 | 227 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
197 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
228 | +if ($currenttime != '') { |
|
229 | + $currenttime = round($currenttime/1000); |
|
230 | +} |
|
198 | 231 | |
199 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
200 | -else $usenextlatlon = true; |
|
201 | -if ($usenextlatlon === false) $currenttime = ''; |
|
232 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
233 | + $usenextlatlon = false; |
|
234 | +} else { |
|
235 | + $usenextlatlon = true; |
|
236 | +} |
|
237 | +if ($usenextlatlon === false) { |
|
238 | + $currenttime = ''; |
|
239 | +} |
|
202 | 240 | $j = 0; |
203 | 241 | $prev_flightaware_id = ''; |
204 | 242 | $aircrafts_shadow = array(); |
205 | 243 | $output = '{'; |
206 | 244 | $output .= '"type": "FeatureCollection",'; |
207 | - if ($min) $output .= '"minimal": "true",'; |
|
208 | - else $output .= '"minimal": "false",'; |
|
245 | + if ($min) { |
|
246 | + $output .= '"minimal": "true",'; |
|
247 | + } else { |
|
248 | + $output .= '"minimal": "false",'; |
|
249 | + } |
|
209 | 250 | //$output .= '"fc": "'.$flightcnt.'",'; |
210 | 251 | $output .= '"sqt": "'.$sqltime.'",'; |
211 | 252 | |
@@ -250,18 +291,29 @@ discard block |
||
250 | 291 | } |
251 | 292 | $output .= '"properties": {'; |
252 | 293 | if (isset($spotter_item['flightaware_id'])) { |
253 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
254 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
294 | + if ($compress) { |
|
295 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
296 | + } else { |
|
297 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
298 | + } |
|
255 | 299 | } elseif (isset($spotter_item['famtrackid'])) { |
256 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
257 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
300 | + if ($compress) { |
|
301 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
302 | + } else { |
|
303 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
304 | + } |
|
258 | 305 | } elseif (isset($spotter_item['fammarine_id'])) { |
259 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
260 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
306 | + if ($compress) { |
|
307 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
308 | + } else { |
|
309 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
310 | + } |
|
261 | 311 | } |
262 | 312 | $output .= '"fc": "'.$flightcnt.'",'; |
263 | 313 | $output .= '"sqt": "'.$sqltime.'",'; |
264 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
314 | + if (isset($begindate)) { |
|
315 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
316 | + } |
|
265 | 317 | |
266 | 318 | /* |
267 | 319 | if ($min) $output .= '"minimal": "true",'; |
@@ -269,14 +321,22 @@ discard block |
||
269 | 321 | */ |
270 | 322 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
271 | 323 | 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']).'",'; |
|
324 | + if ($compress) { |
|
325 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
326 | + } else { |
|
327 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
328 | + } |
|
274 | 329 | //" |
275 | 330 | } else { |
276 | - if ($compress) $output .= '"c": "NA",'; |
|
277 | - else $output .= '"callsign": "NA",'; |
|
331 | + if ($compress) { |
|
332 | + $output .= '"c": "NA",'; |
|
333 | + } else { |
|
334 | + $output .= '"callsign": "NA",'; |
|
335 | + } |
|
336 | + } |
|
337 | + if (isset($spotter_item['registration'])) { |
|
338 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
278 | 339 | } |
279 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
280 | 340 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
281 | 341 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
282 | 342 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -289,16 +349,23 @@ discard block |
||
289 | 349 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
290 | 350 | } |
291 | 351 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
292 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
293 | - else { |
|
352 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
353 | + $spotter_item['aircraft_shadow'] = ''; |
|
354 | + } else { |
|
294 | 355 | $aircraft_icao = $spotter_item['aircraft_icao']; |
295 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
296 | - else { |
|
356 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
357 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
358 | + } else { |
|
297 | 359 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
298 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
299 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
300 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
301 | - else $spotter_item['aircraft_shadow'] = ''; |
|
360 | + if (count($aircraft_info) > 0) { |
|
361 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
362 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
363 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
364 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
365 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
366 | + } else { |
|
367 | + $spotter_item['aircraft_shadow'] = ''; |
|
368 | + } |
|
302 | 369 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
303 | 370 | } |
304 | 371 | } |
@@ -306,73 +373,139 @@ discard block |
||
306 | 373 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
307 | 374 | if ($tracker) { |
308 | 375 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
309 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
310 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
376 | + if ($compress) { |
|
377 | + $output .= '"as": "ambulance.png",'; |
|
378 | + } else { |
|
379 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
380 | + } |
|
311 | 381 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
312 | - if ($compress) $output .= '"as": "police.png",'; |
|
313 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
382 | + if ($compress) { |
|
383 | + $output .= '"as": "police.png",'; |
|
384 | + } else { |
|
385 | + $output .= '"aircraft_shadow": "police.png",'; |
|
386 | + } |
|
314 | 387 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
315 | - if ($compress) $output .= '"as": "ship.png",'; |
|
316 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
388 | + if ($compress) { |
|
389 | + $output .= '"as": "ship.png",'; |
|
390 | + } else { |
|
391 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
392 | + } |
|
317 | 393 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
318 | - if ($compress) $output .= '"as": "ship.png",'; |
|
319 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
394 | + if ($compress) { |
|
395 | + $output .= '"as": "ship.png",'; |
|
396 | + } else { |
|
397 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
398 | + } |
|
320 | 399 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
321 | - if ($compress) $output .= '"as": "ship.png",'; |
|
322 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
400 | + if ($compress) { |
|
401 | + $output .= '"as": "ship.png",'; |
|
402 | + } else { |
|
403 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
404 | + } |
|
323 | 405 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
324 | - if ($compress) $output .= '"as": "truck.png",'; |
|
325 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
406 | + if ($compress) { |
|
407 | + $output .= '"as": "truck.png",'; |
|
408 | + } else { |
|
409 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
410 | + } |
|
326 | 411 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
327 | - if ($compress) $output .= '"as": "truck.png",'; |
|
328 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
412 | + if ($compress) { |
|
413 | + $output .= '"as": "truck.png",'; |
|
414 | + } else { |
|
415 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
416 | + } |
|
329 | 417 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
330 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
331 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
418 | + if ($compress) { |
|
419 | + $output .= '"as": "aircraft.png",'; |
|
420 | + } else { |
|
421 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
422 | + } |
|
332 | 423 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
333 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
334 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
424 | + if ($compress) { |
|
425 | + $output .= '"as": "aircraft.png",'; |
|
426 | + } else { |
|
427 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
428 | + } |
|
335 | 429 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
336 | - if ($compress) $output .= '"as": "helico.png",'; |
|
337 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
430 | + if ($compress) { |
|
431 | + $output .= '"as": "helico.png",'; |
|
432 | + } else { |
|
433 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
434 | + } |
|
338 | 435 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
339 | - if ($compress) $output .= '"as": "rail.png",'; |
|
340 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
436 | + if ($compress) { |
|
437 | + $output .= '"as": "rail.png",'; |
|
438 | + } else { |
|
439 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
440 | + } |
|
341 | 441 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
342 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
343 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
442 | + if ($compress) { |
|
443 | + $output .= '"as": "firetruck.png",'; |
|
444 | + } else { |
|
445 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
446 | + } |
|
344 | 447 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
345 | - if ($compress) $output .= '"as": "bus.png",'; |
|
346 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
448 | + if ($compress) { |
|
449 | + $output .= '"as": "bus.png",'; |
|
450 | + } else { |
|
451 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
452 | + } |
|
347 | 453 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
348 | - if ($compress) $output .= '"as": "phone.png",'; |
|
349 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
454 | + if ($compress) { |
|
455 | + $output .= '"as": "phone.png",'; |
|
456 | + } else { |
|
457 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
458 | + } |
|
350 | 459 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
351 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
352 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
460 | + if ($compress) { |
|
461 | + $output .= '"as": "jogger.png",'; |
|
462 | + } else { |
|
463 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
464 | + } |
|
353 | 465 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
354 | - if ($compress) $output .= '"as": "bike.png",'; |
|
355 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
466 | + if ($compress) { |
|
467 | + $output .= '"as": "bike.png",'; |
|
468 | + } else { |
|
469 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
470 | + } |
|
356 | 471 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
357 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
358 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
472 | + if ($compress) { |
|
473 | + $output .= '"as": "motorcycle.png",'; |
|
474 | + } else { |
|
475 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
476 | + } |
|
359 | 477 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
360 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
361 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
478 | + if ($compress) { |
|
479 | + $output .= '"as": "balloon.png",'; |
|
480 | + } else { |
|
481 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
482 | + } |
|
362 | 483 | } else { |
363 | - if ($compress) $output .= '"as": "car.png",'; |
|
364 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
484 | + if ($compress) { |
|
485 | + $output .= '"as": "car.png",'; |
|
486 | + } else { |
|
487 | + $output .= '"aircraft_shadow": "car.png",'; |
|
488 | + } |
|
365 | 489 | } |
366 | 490 | } elseif ($marine) { |
367 | - if ($compress) $output .= '"as": "ship.png",'; |
|
368 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
491 | + if ($compress) { |
|
492 | + $output .= '"as": "ship.png",'; |
|
493 | + } else { |
|
494 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
495 | + } |
|
369 | 496 | } else { |
370 | - if ($compress) $output .= '"as": "default.png",'; |
|
371 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
497 | + if ($compress) { |
|
498 | + $output .= '"as": "default.png",'; |
|
499 | + } else { |
|
500 | + $output .= '"aircraft_shadow": "default.png",'; |
|
501 | + } |
|
372 | 502 | } |
373 | 503 | } else { |
374 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
375 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
504 | + if ($compress) { |
|
505 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
506 | + } else { |
|
507 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
508 | + } |
|
376 | 509 | } |
377 | 510 | if (isset($spotter_item['airline_name'])) { |
378 | 511 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -380,8 +513,11 @@ discard block |
||
380 | 513 | $output .= '"airline_name": "NA",'; |
381 | 514 | } |
382 | 515 | if (isset($spotter_item['departure_airport'])) { |
383 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
384 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
516 | + if ($compress) { |
|
517 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
518 | + } else { |
|
519 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
520 | + } |
|
385 | 521 | } |
386 | 522 | if (isset($spotter_item['departure_airport_city'])) { |
387 | 523 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -393,8 +529,11 @@ discard block |
||
393 | 529 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
394 | 530 | } |
395 | 531 | if (isset($spotter_item['arrival_airport'])) { |
396 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
397 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
532 | + if ($compress) { |
|
533 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
534 | + } else { |
|
535 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
536 | + } |
|
398 | 537 | } |
399 | 538 | if (isset($spotter_item['arrival_airport_city'])) { |
400 | 539 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -413,8 +552,11 @@ discard block |
||
413 | 552 | } |
414 | 553 | |
415 | 554 | if (isset($spotter_item['altitude'])) { |
416 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
417 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
555 | + if ($compress) { |
|
556 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
557 | + } else { |
|
558 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
559 | + } |
|
418 | 560 | } |
419 | 561 | |
420 | 562 | $heading = $spotter_item['heading']; |
@@ -438,19 +580,24 @@ discard block |
||
438 | 580 | } |
439 | 581 | } |
440 | 582 | |
441 | - if ($compress)$output .= '"h": "'.$heading.'",'; |
|
442 | - else $output .= '"heading": "'.$heading.'",'; |
|
583 | + if ($compress) { |
|
584 | + $output .= '"h": "'.$heading.'",'; |
|
585 | + } else { |
|
586 | + $output .= '"heading": "'.$heading.'",'; |
|
587 | + } |
|
443 | 588 | if ($currenttime != '') { |
444 | 589 | if (strtotime($spotter_item['date']) < $currenttime) { |
445 | 590 | if (isset($archivespeed)) { |
446 | 591 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
447 | 592 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
448 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
449 | - else { |
|
593 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
594 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
595 | + } else { |
|
450 | 596 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
451 | 597 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
452 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
453 | - else { |
|
598 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
599 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
600 | + } else { |
|
454 | 601 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
455 | 602 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
456 | 603 | } |
@@ -458,12 +605,14 @@ discard block |
||
458 | 605 | } elseif ($usenextlatlon) { |
459 | 606 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
460 | 607 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
461 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
462 | - else { |
|
608 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
609 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
610 | + } else { |
|
463 | 611 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
464 | 612 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
465 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
466 | - else { |
|
613 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
614 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
615 | + } else { |
|
467 | 616 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
468 | 617 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
469 | 618 | } |
@@ -502,7 +651,9 @@ discard block |
||
502 | 651 | } |
503 | 652 | } |
504 | 653 | |
505 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
654 | + if (!$min) { |
|
655 | + $output .= '"image": "'.$image.'",'; |
|
656 | + } |
|
506 | 657 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
507 | 658 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
508 | 659 | } |
@@ -510,8 +661,11 @@ discard block |
||
510 | 661 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
511 | 662 | } |
512 | 663 | if (isset($spotter_item['squawk'])) { |
513 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
514 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
664 | + if ($compress) { |
|
665 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
666 | + } else { |
|
667 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
668 | + } |
|
515 | 669 | } |
516 | 670 | if (isset($spotter_item['squawk_usage'])) { |
517 | 671 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -530,14 +684,23 @@ discard block |
||
530 | 684 | } |
531 | 685 | // type when not aircraft ? |
532 | 686 | if (isset($spotter_item['type'])) { |
533 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
534 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
687 | + if ($compress) { |
|
688 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
689 | + } else { |
|
690 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
691 | + } |
|
535 | 692 | } elseif ($marine) { |
536 | - if ($compress) $output .= '"t": "ship"'; |
|
537 | - else $output .= '"type": "ship"'; |
|
693 | + if ($compress) { |
|
694 | + $output .= '"t": "ship"'; |
|
695 | + } else { |
|
696 | + $output .= '"type": "ship"'; |
|
697 | + } |
|
538 | 698 | } else { |
539 | - if ($compress) $output .= '"t": "aircraft"'; |
|
540 | - else $output .= '"type": "aircraft"'; |
|
699 | + if ($compress) { |
|
700 | + $output .= '"t": "aircraft"'; |
|
701 | + } else { |
|
702 | + $output .= '"type": "aircraft"'; |
|
703 | + } |
|
541 | 704 | } |
542 | 705 | $output .= '},'; |
543 | 706 | $output .= '"geometry": {'; |
@@ -545,15 +708,19 @@ discard block |
||
545 | 708 | $output .= '"coordinates": ['; |
546 | 709 | if ($currenttime != '') { |
547 | 710 | if (strtotime($spotter_item['date']) < $currenttime) { |
548 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
711 | + if (!isset($archivespeed)) { |
|
712 | + $archivespeed = 1; |
|
713 | + } |
|
549 | 714 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
550 | 715 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
551 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
552 | - else { |
|
716 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
717 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
718 | + } else { |
|
553 | 719 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
554 | 720 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
555 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
556 | - else { |
|
721 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
722 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
723 | + } else { |
|
557 | 724 | $output .= $spotter_item['longitude'].', '; |
558 | 725 | $output .= $spotter_item['latitude']; |
559 | 726 | } |
@@ -631,7 +798,9 @@ discard block |
||
631 | 798 | } |
632 | 799 | */ |
633 | 800 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
634 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
801 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
802 | + $history = $_COOKIE['history']; |
|
803 | + } |
|
635 | 804 | |
636 | 805 | if ( |
637 | 806 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -675,8 +844,11 @@ discard block |
||
675 | 844 | $output_history .= ']}},'; |
676 | 845 | $output .= $output_history; |
677 | 846 | } |
678 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
679 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
847 | + if ($compress) { |
|
848 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
849 | + } else { |
|
850 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
851 | + } |
|
680 | 852 | } |
681 | 853 | $output_history .= '['; |
682 | 854 | $output_history .= $spotter_history['longitude'].', '; |
@@ -695,9 +867,14 @@ discard block |
||
695 | 867 | $prev_alt = $alt; |
696 | 868 | } else { |
697 | 869 | if ($d == false) { |
698 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
699 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
700 | - } else $d = true; |
|
870 | + if ($compress) { |
|
871 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
872 | + } else { |
|
873 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
874 | + } |
|
875 | + } else { |
|
876 | + $d = true; |
|
877 | + } |
|
701 | 878 | $output_history .= '['; |
702 | 879 | $output_history .= $spotter_history['longitude'].', '; |
703 | 880 | $output_history .= $spotter_history['latitude']; |
@@ -718,7 +895,9 @@ discard block |
||
718 | 895 | $output_historyd = '['; |
719 | 896 | $output_historyd .= $spotter_item['longitude'].', '; |
720 | 897 | $output_historyd .= $spotter_item['latitude']; |
721 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
898 | + if (isset($spotter_history['altitude'])) { |
|
899 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
900 | + } |
|
722 | 901 | $output_historyd .= '],'; |
723 | 902 | //$output_history = $output_historyd.$output_history; |
724 | 903 | $output_history = $output_history.$output_historyd; |
@@ -740,8 +919,11 @@ discard block |
||
740 | 919 | && $spotter_item['arrival_airport'] != 'NA' |
741 | 920 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
742 | 921 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
743 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
744 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
922 | + if ($compress) { |
|
923 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
924 | + } else { |
|
925 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
926 | + } |
|
745 | 927 | if (isset($spotter_item['departure_airport_latitude'])) { |
746 | 928 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
747 | 929 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -774,8 +956,11 @@ discard block |
||
774 | 956 | || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
775 | 957 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
776 | 958 | $havedata = false; |
777 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
778 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
959 | + if ($compress) { |
|
960 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
961 | + } else { |
|
962 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
963 | + } |
|
779 | 964 | $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
780 | 965 | |
781 | 966 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -790,7 +975,9 @@ discard block |
||
790 | 975 | } |
791 | 976 | //$output_dest = substr($output_dest, 0, -1); |
792 | 977 | $output_dest .= ']}},'; |
793 | - if ($havedata) $output .= $output_dest; |
|
978 | + if ($havedata) { |
|
979 | + $output .= $output_dest; |
|
980 | + } |
|
794 | 981 | unset($output_dest); |
795 | 982 | } |
796 | 983 | } |
@@ -798,7 +985,9 @@ discard block |
||
798 | 985 | $output .= ']'; |
799 | 986 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
800 | 987 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
801 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
988 | + if (isset($begindate)) { |
|
989 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
990 | + } |
|
802 | 991 | $output .= '"fc": "'.$j.'"'; |
803 | 992 | } else { |
804 | 993 | $output .= '"features": '; |