@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | $min = true; |
66 | 66 | $allhistory = false; |
67 | 67 | $filter['source'] = array(); |
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
70 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
72 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
73 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
78 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
79 | -if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
69 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
70 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
71 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
72 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
73 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
74 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
75 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
76 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
77 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
78 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
79 | +if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT); |
|
80 | 80 | if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true; |
81 | 81 | |
82 | 82 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | |
86 | 86 | |
87 | 87 | if (isset($_COOKIE['map_2d_limit'])) { |
88 | - $limit = filter_var($_COOKIE['map_2d_limit'],FILTER_SANITIZE_NUMBER_INT); |
|
88 | + $limit = filter_var($_COOKIE['map_2d_limit'], FILTER_SANITIZE_NUMBER_INT); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $spotter_array = array(); |
92 | 92 | |
93 | 93 | if (isset($_GET['ident'])) { |
94 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
94 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
95 | 95 | if ($tracker) { |
96 | 96 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
97 | 97 | } elseif ($marine) { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | $allhistory = true; |
107 | 107 | } elseif (isset($_GET['flightaware_id'])) { |
108 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
108 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
109 | 109 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
110 | 110 | if (empty($spotter_array)) { |
111 | 111 | $from_archive = true; |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | } |
114 | 114 | $allhistory = true; |
115 | 115 | } elseif (isset($_GET['famtrack_id'])) { |
116 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
116 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
117 | 117 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
118 | 118 | $allhistory = true; |
119 | 119 | } elseif (isset($_GET['fammarine_id'])) { |
120 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
120 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
121 | 121 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
122 | 122 | $allhistory = true; |
123 | 123 | /* |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | */ |
138 | 138 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min && !isset($_GET['archive'])) { |
139 | 139 | $usecoord = true; |
140 | - $coord = explode(',',$_GET['coord']); |
|
141 | - 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) |
|
140 | + $coord = explode(',', $_GET['coord']); |
|
141 | + 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) |
|
142 | 142 | && $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) { |
143 | 143 | if ($tracker) { |
144 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
144 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
145 | 145 | } elseif ($marine) { |
146 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
146 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
147 | 147 | } else { |
148 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$limit,$filter); |
|
148 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $limit, $filter); |
|
149 | 149 | } |
150 | 150 | } else { |
151 | 151 | if ($tracker) { |
@@ -153,41 +153,41 @@ discard block |
||
153 | 153 | } elseif ($marine) { |
154 | 154 | $spotter_array = $MarineLive->getMinLiveMarineData($filter); |
155 | 155 | } else { |
156 | - $spotter_array = $SpotterLive->getMinLiveSpotterData($limit,$filter); |
|
156 | + $spotter_array = $SpotterLive->getMinLiveSpotterData($limit, $filter); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
160 | 160 | $from_archive = true; |
161 | 161 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
162 | 162 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
163 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
164 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
165 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
166 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
167 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
168 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
163 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
164 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
165 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
166 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
167 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
168 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
169 | 169 | } elseif ($min) { |
170 | 170 | if ($tracker) { |
171 | 171 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
172 | 172 | } elseif ($marine) { |
173 | 173 | $spotter_array = $MarineLive->getMinLiveMarineData($filter); |
174 | 174 | } else { |
175 | - $spotter_array = $SpotterLive->getMinLiveSpotterData($limit,$filter); |
|
175 | + $spotter_array = $SpotterLive->getMinLiveSpotterData($limit, $filter); |
|
176 | 176 | } |
177 | 177 | # $min = true; |
178 | 178 | } else { |
179 | 179 | if ($tracker) { |
180 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
180 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
181 | 181 | } elseif ($marine) { |
182 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
182 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
183 | 183 | } else { |
184 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
184 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | 188 | if ($usecoord) { |
189 | 189 | if (isset($_GET['archive'])) { |
190 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
190 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
191 | 191 | } else { |
192 | 192 | if ($tracker) { |
193 | 193 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | if ($flightcnt == '') $flightcnt = 0; |
201 | 201 | } else $flightcnt = 0; |
202 | 202 | |
203 | -$sqltime = round(microtime(true)-$begintime,2); |
|
203 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
204 | 204 | |
205 | -$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
205 | +$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
206 | 206 | if ($currenttime != '') $currenttime = round($currenttime/1000); |
207 | 207 | |
208 | 208 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation === FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | if (!empty($spotter_array) && is_array($spotter_array)) |
222 | 222 | { |
223 | 223 | $output .= '"features": ['; |
224 | - foreach($spotter_array as $spotter_item) |
|
224 | + foreach ($spotter_array as $spotter_item) |
|
225 | 225 | { |
226 | 226 | $j++; |
227 | 227 | unset($idistance); |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | */ |
279 | 279 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
280 | 280 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
281 | - if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
282 | - else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
281 | + if ($compress) $output .= '"c": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).','; |
|
282 | + else $output .= '"callsign": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).','; |
|
283 | 283 | //' |
284 | 284 | } else { |
285 | 285 | if ($compress) $output .= '"c": "NA",'; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
293 | 293 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
294 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
294 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
295 | 295 | } elseif (isset($spotter_item['aircraft_type'])) { |
296 | 296 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
297 | 297 | } elseif (!$min) { |
@@ -377,22 +377,22 @@ discard block |
||
377 | 377 | else $output .= '"aircraft_shadow": "car.png",'; |
378 | 378 | } |
379 | 379 | } elseif ($marine) { |
380 | - if (isset($spotter_item['type']) && ($spotter_item['type'] == '50' Performance Cruiser' || $spotter_item['type'] == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) { |
|
380 | + if (isset($spotter_item['type']) && ($spotter_item['type'] == '50' Performance Cruiser' || $spotter_item['type'] == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) { |
|
381 | 381 | if ($compress) $output .= '"as": "50perfcruiser.png",'; |
382 | 382 | else $output .= '"aircraft_shadow": "50perfcruiser.png",'; |
383 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Sailaway Cruiser 38') { |
|
383 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Sailaway Cruiser 38') { |
|
384 | 384 | if ($compress) $output .= '"as": "cruiser38.png",'; |
385 | 385 | else $output .= '"aircraft_shadow": "cruiser38.png",'; |
386 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Mini Transat') { |
|
386 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Mini Transat') { |
|
387 | 387 | if ($compress) $output .= '"as": "transat.png",'; |
388 | 388 | else $output .= '"aircraft_shadow": "transat.png",'; |
389 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == '52' Cruising Cat') { |
|
389 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == '52' Cruising Cat') { |
|
390 | 390 | if ($compress) $output .= '"as": "catamaran.png",'; |
391 | 391 | else $output .= '"aircraft_shadow": "catamaran.png",'; |
392 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Caribbean Rose') { |
|
392 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Caribbean Rose') { |
|
393 | 393 | if ($compress) $output .= '"as": "carib.png",'; |
394 | 394 | else $output .= '"aircraft_shadow": "carib.png",'; |
395 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Nordic Folkboat') { |
|
395 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Nordic Folkboat') { |
|
396 | 396 | if ($compress) $output .= '"as": "nordic.png",'; |
397 | 397 | else $output .= '"aircraft_shadow": "nordic.png",'; |
398 | 398 | } else { |
@@ -458,15 +458,15 @@ discard block |
||
458 | 458 | if (isset($archivespeed) || $usenextlatlon) { |
459 | 459 | if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
460 | 460 | if (isset($spotter_item['arrival_airport_latitude'])) { |
461 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
462 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
461 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
462 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
463 | 463 | $farr_lat = $spotter_item['arrival_airport_latitude']; |
464 | 464 | $farr_lon = $spotter_item['arrival_airport_longitude']; |
465 | 465 | } else { |
466 | 466 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
467 | 467 | if (isset($aairport[0]['latitude'])) { |
468 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
469 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
468 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
469 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
470 | 470 | $farr_lat = $aairport[0]['latitude']; |
471 | 471 | $farr_lon = $aairport[0]['longitude']; |
472 | 472 | } |
@@ -479,59 +479,59 @@ discard block |
||
479 | 479 | if ($currenttime != '') { |
480 | 480 | if (strtotime($spotter_item['date']) < $currenttime) { |
481 | 481 | if (isset($archivespeed)) { |
482 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
483 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
482 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
483 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
484 | 484 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
485 | 485 | else { |
486 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
487 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
486 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
487 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
488 | 488 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
489 | 489 | else { |
490 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
490 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
491 | 491 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
492 | 492 | } |
493 | 493 | } |
494 | 494 | } elseif ($usenextlatlon) { |
495 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
496 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
495 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
496 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
497 | 497 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
498 | 498 | else { |
499 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
500 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
499 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
500 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
501 | 501 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
502 | 502 | else { |
503 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
503 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
504 | 504 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
505 | 505 | } |
506 | 506 | } |
507 | 507 | } |
508 | 508 | } else { |
509 | 509 | if (isset($archivespeed)) { |
510 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
510 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
511 | 511 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
512 | 512 | } elseif ($usenextlatlon) { |
513 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
513 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
514 | 514 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
515 | 515 | } |
516 | 516 | } |
517 | 517 | } else { |
518 | 518 | if (isset($archivespeed)) { |
519 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
520 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
519 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
520 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
521 | 521 | if (!isset($idistance) || $fdistance < $idistance) { |
522 | 522 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
523 | 523 | } else { |
524 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed); |
|
524 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed); |
|
525 | 525 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
526 | 526 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
527 | 527 | } |
528 | 528 | } elseif ($usenextlatlon) { |
529 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
530 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
529 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
530 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
531 | 531 | if (!isset($idistance) || $fdistance < $idistance) { |
532 | 532 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
533 | 533 | } else { |
534 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading); |
|
534 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading); |
|
535 | 535 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
536 | 536 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
537 | 537 | } |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | |
541 | 541 | if (!$min) $output .= '"image": "'.$image.'",'; |
542 | 542 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
543 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
543 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
544 | 544 | } |
545 | 545 | if (isset($spotter_item['image_source_website'])) { |
546 | 546 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
575 | 575 | } |
576 | 576 | if (isset($spotter_item['acars'])) { |
577 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
577 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
578 | 578 | } |
579 | 579 | // type when not aircraft ? |
580 | 580 | if (isset($spotter_item['type'])) { |
@@ -594,12 +594,12 @@ discard block |
||
594 | 594 | if ($currenttime != '') { |
595 | 595 | if (strtotime($spotter_item['date']) < $currenttime) { |
596 | 596 | if (!isset($archivespeed)) $archivespeed = 1; |
597 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
598 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
597 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
598 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
599 | 599 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
600 | 600 | else { |
601 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
602 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
601 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
602 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
603 | 603 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
604 | 604 | else { |
605 | 605 | $output .= $spotter_item['longitude'].', '; |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | |
679 | 679 | } |
680 | 680 | */ |
681 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
681 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
682 | 682 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
683 | 683 | |
684 | 684 | if ( |
@@ -686,11 +686,11 @@ discard block |
||
686 | 686 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
687 | 687 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
688 | 688 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
689 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
689 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
690 | 690 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
691 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
691 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
692 | 692 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
693 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
693 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
694 | 694 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
695 | 695 | ) { |
696 | 696 | if ($tracker) { |
@@ -719,9 +719,9 @@ discard block |
||
719 | 719 | require(dirname(__FILE__).'/require/class.MapMatching.php'); |
720 | 720 | $MapMatching = new MapMatching(); |
721 | 721 | if (isset($spotter_item['date_iso_8601'])) { |
722 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date_iso_8601']))))); |
|
722 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date_iso_8601']))))); |
|
723 | 723 | } else { |
724 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date']))))); |
|
724 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date']))))); |
|
725 | 725 | } |
726 | 726 | $spotter_history_array = $MapMatching->match($spotter_history_array_mm); |
727 | 727 | } |
@@ -754,9 +754,9 @@ discard block |
||
754 | 754 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
755 | 755 | } |
756 | 756 | $output_history .= '['; |
757 | - $output_history .= $spotter_history['longitude'].', '; |
|
758 | - $output_history .= $spotter_history['latitude'].', '; |
|
759 | - $output_history .= $spotter_history['altitude']*30.48; |
|
757 | + $output_history .= $spotter_history['longitude'].', '; |
|
758 | + $output_history .= $spotter_history['latitude'].', '; |
|
759 | + $output_history .= $spotter_history['altitude']*30.48; |
|
760 | 760 | $output_history .= '],'; |
761 | 761 | /* |
762 | 762 | if ($from_archive === false) { |
@@ -779,8 +779,8 @@ discard block |
||
779 | 779 | $d = true; |
780 | 780 | } |
781 | 781 | $output_history .= '['; |
782 | - $output_history .= $spotter_history['longitude'].', '; |
|
783 | - $output_history .= $spotter_history['latitude']; |
|
782 | + $output_history .= $spotter_history['longitude'].', '; |
|
783 | + $output_history .= $spotter_history['latitude']; |
|
784 | 784 | $output_history .= '],'; |
785 | 785 | /* |
786 | 786 | if ($from_archive === false) { |
@@ -796,9 +796,9 @@ discard block |
||
796 | 796 | //echo $output_history; |
797 | 797 | if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) { |
798 | 798 | $output_historyd = '['; |
799 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
800 | - $output_historyd .= $spotter_item['latitude']; |
|
801 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
799 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
800 | + $output_historyd .= $spotter_item['latitude']; |
|
801 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
802 | 802 | $output_historyd .= '],'; |
803 | 803 | //$output_history = $output_historyd.$output_history; |
804 | 804 | $output_history = $output_history.$output_historyd; |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | $last = array_pop($spotter_history_array); |
807 | 807 | $latitude = $last['latitude']; |
808 | 808 | $longitude = $last['longitude']; |
809 | - $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output); |
|
809 | + $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | $output_history = substr($output_history, 0, -1); |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | |
819 | 819 | } |
820 | 820 | |
821 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
821 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
822 | 822 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
823 | 823 | && (isset($spotter_item['departure_airport']) |
824 | 824 | && $spotter_item['departure_airport'] != 'NA' |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | |
853 | 853 | //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))))) { |
854 | 854 | //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))))) { |
855 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
855 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
856 | 856 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
857 | 857 | && (isset($spotter_item['arrival_airport']) |
858 | 858 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -879,11 +879,11 @@ discard block |
||
879 | 879 | } |
880 | 880 | } |
881 | 881 | if ($havedata) { |
882 | - $line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon); |
|
882 | + $line = $Common->greatCircle($spotter_item['latitude'], $spotter_item['longitude'], $end_lat, $end_lon); |
|
883 | 883 | foreach ($line[0] as $coord) { |
884 | 884 | $output_dest .= '['.$coord[0].','.$coord[1].'],'; |
885 | 885 | } |
886 | - $output_dest = substr($output_dest, 0, -1); |
|
886 | + $output_dest = substr($output_dest, 0, -1); |
|
887 | 887 | } |
888 | 888 | $output_dest .= ']}},'; |
889 | 889 | if ($havedata) $output .= $output_dest; |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | $output = substr($output, 0, -1); |
894 | 894 | $output .= ']'; |
895 | 895 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
896 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
896 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
897 | 897 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
898 | 898 | $output .= '"fc": "'.$j.'"'; |
899 | 899 | } else { |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | $tracker = false; |
13 | 13 | $marine = false; |
14 | 14 | $usecoord = false; |
15 | -if (isset($_GET['test'])) exit(); |
|
15 | +if (isset($_GET['test'])) { |
|
16 | + exit(); |
|
17 | +} |
|
16 | 18 | if (isset($_GET['tracker'])) { |
17 | 19 | $tracker = true; |
18 | 20 | } |
@@ -57,31 +59,62 @@ discard block |
||
57 | 59 | } |
58 | 60 | header('Content-Type: text/javascript'); |
59 | 61 | |
60 | -if (!isset($globalJsonCompress)) $compress = true; |
|
61 | -else $compress = $globalJsonCompress; |
|
62 | +if (!isset($globalJsonCompress)) { |
|
63 | + $compress = true; |
|
64 | +} else { |
|
65 | + $compress = $globalJsonCompress; |
|
66 | +} |
|
62 | 67 | |
63 | 68 | $limit = 0; |
64 | 69 | $from_archive = false; |
65 | 70 | $min = true; |
66 | 71 | $allhistory = false; |
67 | 72 | $filter['source'] = array(); |
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
70 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
72 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
73 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
78 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
79 | -if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
80 | -if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true; |
|
73 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
74 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
75 | +} |
|
76 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
77 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
78 | +} |
|
79 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
80 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
81 | +} |
|
82 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
83 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
84 | +} |
|
85 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
86 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
87 | +} |
|
88 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
89 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
90 | +} |
|
91 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
92 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
93 | +} |
|
94 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
95 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
96 | +} |
|
97 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
98 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
99 | +} |
|
100 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
101 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
102 | +} |
|
103 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
104 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
105 | +} |
|
106 | +if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') { |
|
107 | + $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
108 | +} |
|
109 | +if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') { |
|
110 | + $filter['blocked'] = true; |
|
111 | +} |
|
81 | 112 | |
82 | 113 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
83 | 114 | $min = true; |
84 | -} else $min = false; |
|
115 | +} else { |
|
116 | + $min = false; |
|
117 | +} |
|
85 | 118 | |
86 | 119 | |
87 | 120 | if (isset($_COOKIE['map_2d_limit'])) { |
@@ -197,24 +230,38 @@ discard block |
||
197 | 230 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
198 | 231 | } |
199 | 232 | } |
200 | - if ($flightcnt == '') $flightcnt = 0; |
|
201 | -} else $flightcnt = 0; |
|
233 | + if ($flightcnt == '') { |
|
234 | + $flightcnt = 0; |
|
235 | + } |
|
236 | + } else { |
|
237 | + $flightcnt = 0; |
|
238 | +} |
|
202 | 239 | |
203 | 240 | $sqltime = round(microtime(true)-$begintime,2); |
204 | 241 | |
205 | 242 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
206 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
243 | +if ($currenttime != '') { |
|
244 | + $currenttime = round($currenttime/1000); |
|
245 | +} |
|
207 | 246 | |
208 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation === FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
209 | -else $usenextlatlon = true; |
|
210 | -if ($usenextlatlon === false) $currenttime = ''; |
|
247 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation === FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
248 | + $usenextlatlon = false; |
|
249 | +} else { |
|
250 | + $usenextlatlon = true; |
|
251 | +} |
|
252 | +if ($usenextlatlon === false) { |
|
253 | + $currenttime = ''; |
|
254 | +} |
|
211 | 255 | $j = 0; |
212 | 256 | $prev_flightaware_id = ''; |
213 | 257 | $aircrafts_shadow = array(); |
214 | 258 | $output = '{'; |
215 | 259 | $output .= '"type": "FeatureCollection",'; |
216 | - if ($min) $output .= '"minimal": "true",'; |
|
217 | - else $output .= '"minimal": "false",'; |
|
260 | + if ($min) { |
|
261 | + $output .= '"minimal": "true",'; |
|
262 | + } else { |
|
263 | + $output .= '"minimal": "false",'; |
|
264 | + } |
|
218 | 265 | //$output .= '"fc": "'.$flightcnt.'",'; |
219 | 266 | $output .= '"sqt": "'.$sqltime.'",'; |
220 | 267 | |
@@ -259,18 +306,29 @@ discard block |
||
259 | 306 | } |
260 | 307 | $output .= '"properties": {'; |
261 | 308 | if (isset($spotter_item['flightaware_id'])) { |
262 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
263 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
309 | + if ($compress) { |
|
310 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
311 | + } else { |
|
312 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
313 | + } |
|
264 | 314 | } elseif (isset($spotter_item['famtrackid'])) { |
265 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
266 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
315 | + if ($compress) { |
|
316 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
317 | + } else { |
|
318 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
319 | + } |
|
267 | 320 | } elseif (isset($spotter_item['fammarine_id'])) { |
268 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
269 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
321 | + if ($compress) { |
|
322 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
323 | + } else { |
|
324 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
325 | + } |
|
270 | 326 | } |
271 | 327 | $output .= '"fc": "'.$flightcnt.'",'; |
272 | 328 | $output .= '"sqt": "'.$sqltime.'",'; |
273 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
329 | + if (isset($begindate)) { |
|
330 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
331 | + } |
|
274 | 332 | |
275 | 333 | /* |
276 | 334 | if ($min) $output .= '"minimal": "true",'; |
@@ -278,16 +336,25 @@ discard block |
||
278 | 336 | */ |
279 | 337 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
280 | 338 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
281 | - if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
282 | - else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
339 | + if ($compress) { |
|
340 | + $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
341 | + } else { |
|
342 | + $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
343 | + } |
|
283 | 344 | //' |
284 | 345 | } else { |
285 | - if ($compress) $output .= '"c": "NA",'; |
|
286 | - else $output .= '"callsign": "NA",'; |
|
346 | + if ($compress) { |
|
347 | + $output .= '"c": "NA",'; |
|
348 | + } else { |
|
349 | + $output .= '"callsign": "NA",'; |
|
350 | + } |
|
287 | 351 | } |
288 | 352 | if (isset($spotter_item['registration'])) { |
289 | - if ($compress) $output .= '"reg": '.json_encode($spotter_item['registration']).','; |
|
290 | - else $output .= '"registration": '.json_encode($spotter_item['registration']).','; |
|
353 | + if ($compress) { |
|
354 | + $output .= '"reg": '.json_encode($spotter_item['registration']).','; |
|
355 | + } else { |
|
356 | + $output .= '"registration": '.json_encode($spotter_item['registration']).','; |
|
357 | + } |
|
291 | 358 | } |
292 | 359 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
293 | 360 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
@@ -298,20 +365,30 @@ discard block |
||
298 | 365 | $output .= '"aircraft_name": "NA",'; |
299 | 366 | } |
300 | 367 | if (isset($spotter_item['aircraft_icao'])) { |
301 | - if ($compress) $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",'; |
|
302 | - else $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
368 | + if ($compress) { |
|
369 | + $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",'; |
|
370 | + } else { |
|
371 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
372 | + } |
|
303 | 373 | } |
304 | 374 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
305 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
306 | - else { |
|
375 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
376 | + $spotter_item['aircraft_shadow'] = ''; |
|
377 | + } else { |
|
307 | 378 | $aircraft_icao = $spotter_item['aircraft_icao']; |
308 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
309 | - else { |
|
379 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
380 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
381 | + } else { |
|
310 | 382 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
311 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
312 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
313 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
314 | - else $spotter_item['aircraft_shadow'] = ''; |
|
383 | + if (count($aircraft_info) > 0) { |
|
384 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
385 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
386 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
387 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
388 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
389 | + } else { |
|
390 | + $spotter_item['aircraft_shadow'] = ''; |
|
391 | + } |
|
315 | 392 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
316 | 393 | } |
317 | 394 | } |
@@ -319,93 +396,177 @@ discard block |
||
319 | 396 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
320 | 397 | if ($tracker) { |
321 | 398 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
322 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
323 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
399 | + if ($compress) { |
|
400 | + $output .= '"as": "ambulance.png",'; |
|
401 | + } else { |
|
402 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
403 | + } |
|
324 | 404 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
325 | - if ($compress) $output .= '"as": "police.png",'; |
|
326 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
405 | + if ($compress) { |
|
406 | + $output .= '"as": "police.png",'; |
|
407 | + } else { |
|
408 | + $output .= '"aircraft_shadow": "police.png",'; |
|
409 | + } |
|
327 | 410 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
328 | - if ($compress) $output .= '"as": "ship.png",'; |
|
329 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
411 | + if ($compress) { |
|
412 | + $output .= '"as": "ship.png",'; |
|
413 | + } else { |
|
414 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
415 | + } |
|
330 | 416 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
331 | - if ($compress) $output .= '"as": "ship.png",'; |
|
332 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
417 | + if ($compress) { |
|
418 | + $output .= '"as": "ship.png",'; |
|
419 | + } else { |
|
420 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
421 | + } |
|
333 | 422 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
334 | - if ($compress) $output .= '"as": "ship.png",'; |
|
335 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
423 | + if ($compress) { |
|
424 | + $output .= '"as": "ship.png",'; |
|
425 | + } else { |
|
426 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
427 | + } |
|
336 | 428 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
337 | - if ($compress) $output .= '"as": "truck.png",'; |
|
338 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
429 | + if ($compress) { |
|
430 | + $output .= '"as": "truck.png",'; |
|
431 | + } else { |
|
432 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
433 | + } |
|
339 | 434 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
340 | - if ($compress) $output .= '"as": "truck.png",'; |
|
341 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
435 | + if ($compress) { |
|
436 | + $output .= '"as": "truck.png",'; |
|
437 | + } else { |
|
438 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
439 | + } |
|
342 | 440 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
343 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
344 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
441 | + if ($compress) { |
|
442 | + $output .= '"as": "aircraft.png",'; |
|
443 | + } else { |
|
444 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
445 | + } |
|
345 | 446 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
346 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
347 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
447 | + if ($compress) { |
|
448 | + $output .= '"as": "aircraft.png",'; |
|
449 | + } else { |
|
450 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
451 | + } |
|
348 | 452 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
349 | - if ($compress) $output .= '"as": "helico.png",'; |
|
350 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
453 | + if ($compress) { |
|
454 | + $output .= '"as": "helico.png",'; |
|
455 | + } else { |
|
456 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
457 | + } |
|
351 | 458 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
352 | - if ($compress) $output .= '"as": "rail.png",'; |
|
353 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
459 | + if ($compress) { |
|
460 | + $output .= '"as": "rail.png",'; |
|
461 | + } else { |
|
462 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
463 | + } |
|
354 | 464 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
355 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
356 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
465 | + if ($compress) { |
|
466 | + $output .= '"as": "firetruck.png",'; |
|
467 | + } else { |
|
468 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
469 | + } |
|
357 | 470 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
358 | - if ($compress) $output .= '"as": "bus.png",'; |
|
359 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
471 | + if ($compress) { |
|
472 | + $output .= '"as": "bus.png",'; |
|
473 | + } else { |
|
474 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
475 | + } |
|
360 | 476 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
361 | - if ($compress) $output .= '"as": "phone.png",'; |
|
362 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
477 | + if ($compress) { |
|
478 | + $output .= '"as": "phone.png",'; |
|
479 | + } else { |
|
480 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
481 | + } |
|
363 | 482 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
364 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
365 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
483 | + if ($compress) { |
|
484 | + $output .= '"as": "jogger.png",'; |
|
485 | + } else { |
|
486 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
487 | + } |
|
366 | 488 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
367 | - if ($compress) $output .= '"as": "bike.png",'; |
|
368 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
489 | + if ($compress) { |
|
490 | + $output .= '"as": "bike.png",'; |
|
491 | + } else { |
|
492 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
493 | + } |
|
369 | 494 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
370 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
371 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
495 | + if ($compress) { |
|
496 | + $output .= '"as": "motorcycle.png",'; |
|
497 | + } else { |
|
498 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
499 | + } |
|
372 | 500 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
373 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
374 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
501 | + if ($compress) { |
|
502 | + $output .= '"as": "balloon.png",'; |
|
503 | + } else { |
|
504 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
505 | + } |
|
375 | 506 | } else { |
376 | - if ($compress) $output .= '"as": "car.png",'; |
|
377 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
507 | + if ($compress) { |
|
508 | + $output .= '"as": "car.png",'; |
|
509 | + } else { |
|
510 | + $output .= '"aircraft_shadow": "car.png",'; |
|
511 | + } |
|
378 | 512 | } |
379 | 513 | } elseif ($marine) { |
380 | 514 | if (isset($spotter_item['type']) && ($spotter_item['type'] == '50' Performance Cruiser' || $spotter_item['type'] == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) { |
381 | - if ($compress) $output .= '"as": "50perfcruiser.png",'; |
|
382 | - else $output .= '"aircraft_shadow": "50perfcruiser.png",'; |
|
515 | + if ($compress) { |
|
516 | + $output .= '"as": "50perfcruiser.png",'; |
|
517 | + } else { |
|
518 | + $output .= '"aircraft_shadow": "50perfcruiser.png",'; |
|
519 | + } |
|
383 | 520 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Sailaway Cruiser 38') { |
384 | - if ($compress) $output .= '"as": "cruiser38.png",'; |
|
385 | - else $output .= '"aircraft_shadow": "cruiser38.png",'; |
|
521 | + if ($compress) { |
|
522 | + $output .= '"as": "cruiser38.png",'; |
|
523 | + } else { |
|
524 | + $output .= '"aircraft_shadow": "cruiser38.png",'; |
|
525 | + } |
|
386 | 526 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Mini Transat') { |
387 | - if ($compress) $output .= '"as": "transat.png",'; |
|
388 | - else $output .= '"aircraft_shadow": "transat.png",'; |
|
527 | + if ($compress) { |
|
528 | + $output .= '"as": "transat.png",'; |
|
529 | + } else { |
|
530 | + $output .= '"aircraft_shadow": "transat.png",'; |
|
531 | + } |
|
389 | 532 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == '52' Cruising Cat') { |
390 | - if ($compress) $output .= '"as": "catamaran.png",'; |
|
391 | - else $output .= '"aircraft_shadow": "catamaran.png",'; |
|
533 | + if ($compress) { |
|
534 | + $output .= '"as": "catamaran.png",'; |
|
535 | + } else { |
|
536 | + $output .= '"aircraft_shadow": "catamaran.png",'; |
|
537 | + } |
|
392 | 538 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Caribbean Rose') { |
393 | - if ($compress) $output .= '"as": "carib.png",'; |
|
394 | - else $output .= '"aircraft_shadow": "carib.png",'; |
|
539 | + if ($compress) { |
|
540 | + $output .= '"as": "carib.png",'; |
|
541 | + } else { |
|
542 | + $output .= '"aircraft_shadow": "carib.png",'; |
|
543 | + } |
|
395 | 544 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Nordic Folkboat') { |
396 | - if ($compress) $output .= '"as": "nordic.png",'; |
|
397 | - else $output .= '"aircraft_shadow": "nordic.png",'; |
|
545 | + if ($compress) { |
|
546 | + $output .= '"as": "nordic.png",'; |
|
547 | + } else { |
|
548 | + $output .= '"aircraft_shadow": "nordic.png",'; |
|
549 | + } |
|
398 | 550 | } else { |
399 | - if ($compress) $output .= '"as": "ship.png",'; |
|
400 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
551 | + if ($compress) { |
|
552 | + $output .= '"as": "ship.png",'; |
|
553 | + } else { |
|
554 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
555 | + } |
|
401 | 556 | } |
402 | 557 | } else { |
403 | - if ($compress) $output .= '"as": "default.png",'; |
|
404 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
558 | + if ($compress) { |
|
559 | + $output .= '"as": "default.png",'; |
|
560 | + } else { |
|
561 | + $output .= '"aircraft_shadow": "default.png",'; |
|
562 | + } |
|
405 | 563 | } |
406 | 564 | } else { |
407 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
408 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
565 | + if ($compress) { |
|
566 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
567 | + } else { |
|
568 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
569 | + } |
|
409 | 570 | } |
410 | 571 | if (isset($spotter_item['airline_name'])) { |
411 | 572 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -413,8 +574,11 @@ discard block |
||
413 | 574 | $output .= '"airline_name": "NA",'; |
414 | 575 | } |
415 | 576 | if (isset($spotter_item['departure_airport'])) { |
416 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
417 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
577 | + if ($compress) { |
|
578 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
579 | + } else { |
|
580 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
581 | + } |
|
418 | 582 | } |
419 | 583 | if (isset($spotter_item['departure_airport_city'])) { |
420 | 584 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -426,8 +590,11 @@ discard block |
||
426 | 590 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
427 | 591 | } |
428 | 592 | if (isset($spotter_item['arrival_airport'])) { |
429 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
430 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
593 | + if ($compress) { |
|
594 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
595 | + } else { |
|
596 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
597 | + } |
|
431 | 598 | } |
432 | 599 | if (isset($spotter_item['arrival_airport_city'])) { |
433 | 600 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -446,11 +613,17 @@ discard block |
||
446 | 613 | } |
447 | 614 | |
448 | 615 | if (isset($spotter_item['real_altitude'])) { |
449 | - if ($compress) $output .= '"a": "'.($spotter_item['real_altitude']/100).'",'; |
|
450 | - else $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",'; |
|
616 | + if ($compress) { |
|
617 | + $output .= '"a": "'.($spotter_item['real_altitude']/100).'",'; |
|
618 | + } else { |
|
619 | + $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",'; |
|
620 | + } |
|
451 | 621 | } elseif (isset($spotter_item['altitude'])) { |
452 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
453 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
622 | + if ($compress) { |
|
623 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
624 | + } else { |
|
625 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
626 | + } |
|
454 | 627 | } |
455 | 628 | |
456 | 629 | $heading = $spotter_item['heading']; |
@@ -474,19 +647,24 @@ discard block |
||
474 | 647 | } |
475 | 648 | } |
476 | 649 | |
477 | - if ($compress)$output .= '"h": "'.$heading.'",'; |
|
478 | - else $output .= '"heading": "'.$heading.'",'; |
|
650 | + if ($compress) { |
|
651 | + $output .= '"h": "'.$heading.'",'; |
|
652 | + } else { |
|
653 | + $output .= '"heading": "'.$heading.'",'; |
|
654 | + } |
|
479 | 655 | if ($currenttime != '') { |
480 | 656 | if (strtotime($spotter_item['date']) < $currenttime) { |
481 | 657 | if (isset($archivespeed)) { |
482 | 658 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
483 | 659 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
484 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
485 | - else { |
|
660 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
661 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
662 | + } else { |
|
486 | 663 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
487 | 664 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
488 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
489 | - else { |
|
665 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
666 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
667 | + } else { |
|
490 | 668 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
491 | 669 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
492 | 670 | } |
@@ -494,12 +672,14 @@ discard block |
||
494 | 672 | } elseif ($usenextlatlon) { |
495 | 673 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
496 | 674 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
497 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
498 | - else { |
|
675 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
676 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
677 | + } else { |
|
499 | 678 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
500 | 679 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
501 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
502 | - else { |
|
680 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
681 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
682 | + } else { |
|
503 | 683 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
504 | 684 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
505 | 685 | } |
@@ -538,7 +718,9 @@ discard block |
||
538 | 718 | } |
539 | 719 | } |
540 | 720 | |
541 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
721 | + if (!$min) { |
|
722 | + $output .= '"image": "'.$image.'",'; |
|
723 | + } |
|
542 | 724 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
543 | 725 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
544 | 726 | } |
@@ -546,8 +728,11 @@ discard block |
||
546 | 728 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
547 | 729 | } |
548 | 730 | if (isset($spotter_item['squawk'])) { |
549 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
550 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
731 | + if ($compress) { |
|
732 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
733 | + } else { |
|
734 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
735 | + } |
|
551 | 736 | } |
552 | 737 | if (isset($spotter_item['squawk_usage'])) { |
553 | 738 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -578,14 +763,23 @@ discard block |
||
578 | 763 | } |
579 | 764 | // type when not aircraft ? |
580 | 765 | if (isset($spotter_item['type'])) { |
581 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
582 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
766 | + if ($compress) { |
|
767 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
768 | + } else { |
|
769 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
770 | + } |
|
583 | 771 | } elseif ($marine) { |
584 | - if ($compress) $output .= '"t": "ship"'; |
|
585 | - else $output .= '"type": "ship"'; |
|
772 | + if ($compress) { |
|
773 | + $output .= '"t": "ship"'; |
|
774 | + } else { |
|
775 | + $output .= '"type": "ship"'; |
|
776 | + } |
|
586 | 777 | } else { |
587 | - if ($compress) $output .= '"t": "aircraft"'; |
|
588 | - else $output .= '"type": "aircraft"'; |
|
778 | + if ($compress) { |
|
779 | + $output .= '"t": "aircraft"'; |
|
780 | + } else { |
|
781 | + $output .= '"type": "aircraft"'; |
|
782 | + } |
|
589 | 783 | } |
590 | 784 | $output .= '},'; |
591 | 785 | $output .= '"geometry": {'; |
@@ -593,15 +787,19 @@ discard block |
||
593 | 787 | $output .= '"coordinates": ['; |
594 | 788 | if ($currenttime != '') { |
595 | 789 | if (strtotime($spotter_item['date']) < $currenttime) { |
596 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
790 | + if (!isset($archivespeed)) { |
|
791 | + $archivespeed = 1; |
|
792 | + } |
|
597 | 793 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
598 | 794 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
599 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
600 | - else { |
|
795 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
796 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
797 | + } else { |
|
601 | 798 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
602 | 799 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
603 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
604 | - else { |
|
800 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
801 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
802 | + } else { |
|
605 | 803 | $output .= $spotter_item['longitude'].', '; |
606 | 804 | $output .= $spotter_item['latitude']; |
607 | 805 | } |
@@ -679,7 +877,9 @@ discard block |
||
679 | 877 | } |
680 | 878 | */ |
681 | 879 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
682 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
880 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
881 | + $history = $_COOKIE['history']; |
|
882 | + } |
|
683 | 883 | |
684 | 884 | if ( |
685 | 885 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -750,8 +950,11 @@ discard block |
||
750 | 950 | $output_history .= ']}},'; |
751 | 951 | $output .= $output_history; |
752 | 952 | } |
753 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
754 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
953 | + if ($compress) { |
|
954 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
955 | + } else { |
|
956 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
957 | + } |
|
755 | 958 | } |
756 | 959 | $output_history .= '['; |
757 | 960 | $output_history .= $spotter_history['longitude'].', '; |
@@ -772,10 +975,15 @@ discard block |
||
772 | 975 | if ($d === false) { |
773 | 976 | if ($compress) { |
774 | 977 | $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",'; |
775 | - if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
776 | - elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
978 | + if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') { |
|
979 | + $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
980 | + } elseif (isset($spotter_history_array[0]['mapmatching_engine'])) { |
|
981 | + $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
982 | + } |
|
777 | 983 | $output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
778 | - } else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
984 | + } else { |
|
985 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
986 | + } |
|
779 | 987 | $d = true; |
780 | 988 | } |
781 | 989 | $output_history .= '['; |
@@ -798,7 +1006,9 @@ discard block |
||
798 | 1006 | $output_historyd = '['; |
799 | 1007 | $output_historyd .= $spotter_item['longitude'].', '; |
800 | 1008 | $output_historyd .= $spotter_item['latitude']; |
801 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
1009 | + if (isset($spotter_history['altitude'])) { |
|
1010 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
1011 | + } |
|
802 | 1012 | $output_historyd .= '],'; |
803 | 1013 | //$output_history = $output_historyd.$output_history; |
804 | 1014 | $output_history = $output_history.$output_historyd; |
@@ -826,8 +1036,11 @@ discard block |
||
826 | 1036 | && $spotter_item['arrival_airport'] != 'NA' |
827 | 1037 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
828 | 1038 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
829 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
830 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
1039 | + if ($compress) { |
|
1040 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
1041 | + } else { |
|
1042 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
1043 | + } |
|
831 | 1044 | if (isset($spotter_item['departure_airport_latitude'])) { |
832 | 1045 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
833 | 1046 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -860,8 +1073,11 @@ discard block |
||
860 | 1073 | || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
861 | 1074 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
862 | 1075 | $havedata = false; |
863 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
864 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1076 | + if ($compress) { |
|
1077 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1078 | + } else { |
|
1079 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1080 | + } |
|
865 | 1081 | |
866 | 1082 | //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
867 | 1083 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -886,7 +1102,9 @@ discard block |
||
886 | 1102 | $output_dest = substr($output_dest, 0, -1); |
887 | 1103 | } |
888 | 1104 | $output_dest .= ']}},'; |
889 | - if ($havedata) $output .= $output_dest; |
|
1105 | + if ($havedata) { |
|
1106 | + $output .= $output_dest; |
|
1107 | + } |
|
890 | 1108 | unset($output_dest); |
891 | 1109 | } |
892 | 1110 | } |
@@ -894,7 +1112,9 @@ discard block |
||
894 | 1112 | $output .= ']'; |
895 | 1113 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
896 | 1114 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
897 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
1115 | + if (isset($begindate)) { |
|
1116 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
1117 | + } |
|
898 | 1118 | $output .= '"fc": "'.$j.'"'; |
899 | 1119 | } else { |
900 | 1120 | $output .= '"features": '; |