@@ -55,23 +55,23 @@ discard block |
||
55 | 55 | $min = true; |
56 | 56 | $allhistory = false; |
57 | 57 | $filter['source'] = array(); |
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
65 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
66 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
67 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
58 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
59 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
60 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
61 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
62 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
63 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
64 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
65 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
66 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
67 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
68 | 68 | |
69 | 69 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
70 | 70 | $min = true; |
71 | 71 | } else $min = false; |
72 | 72 | |
73 | 73 | if (isset($_GET['ident'])) { |
74 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
74 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
75 | 75 | if ($tracker) { |
76 | 76 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
77 | 77 | } elseif ($marine) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | $allhistory = true; |
87 | 87 | } elseif (isset($_GET['flightaware_id'])) { |
88 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
88 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
89 | 89 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
90 | 90 | if (empty($spotter_array)) { |
91 | 91 | $from_archive = true; |
@@ -93,44 +93,44 @@ discard block |
||
93 | 93 | } |
94 | 94 | $allhistory = true; |
95 | 95 | } elseif (isset($_GET['famtrack_id'])) { |
96 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
96 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
97 | 97 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
98 | 98 | $allhistory = true; |
99 | 99 | } elseif (isset($_GET['fammarine_id'])) { |
100 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
100 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
101 | 101 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
102 | 102 | $allhistory = true; |
103 | 103 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
104 | 104 | //} elseif (isset($_GET['coord'])) { |
105 | 105 | $usecoord = true; |
106 | - $coord = explode(',',$_GET['coord']); |
|
106 | + $coord = explode(',', $_GET['coord']); |
|
107 | 107 | if ($tracker) { |
108 | - $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter); |
|
108 | + $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter); |
|
109 | 109 | } elseif ($marine) { |
110 | - $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter); |
|
110 | + $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter); |
|
111 | 111 | } else { |
112 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
112 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
113 | 113 | } |
114 | 114 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
115 | 115 | $usecoord = true; |
116 | - $coord = explode(',',$_GET['coord']); |
|
116 | + $coord = explode(',', $_GET['coord']); |
|
117 | 117 | if ($tracker) { |
118 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
118 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
119 | 119 | } elseif ($marine) { |
120 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
120 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
121 | 121 | } else { |
122 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
122 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
123 | 123 | } |
124 | 124 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
125 | 125 | $from_archive = true; |
126 | 126 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
127 | 127 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
128 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
129 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
130 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
131 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
132 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
133 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
128 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
129 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
130 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
131 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
132 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
133 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
134 | 134 | } elseif ($min) { |
135 | 135 | if ($tracker) { |
136 | 136 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -142,25 +142,25 @@ discard block |
||
142 | 142 | # $min = true; |
143 | 143 | } else { |
144 | 144 | if ($tracker) { |
145 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
145 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
146 | 146 | } elseif ($marine) { |
147 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
147 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
148 | 148 | } else { |
149 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
149 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | 154 | if ($usecoord) { |
155 | 155 | if (isset($_GET['archive'])) { |
156 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
156 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
157 | 157 | } else { |
158 | 158 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
159 | 159 | } |
160 | 160 | if ($flightcnt == '') $flightcnt = 0; |
161 | 161 | } else $flightcnt = 0; |
162 | 162 | |
163 | -$sqltime = round(microtime(true)-$begintime,2); |
|
163 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
164 | 164 | |
165 | 165 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
166 | 166 | else $usenextlatlon = true; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | if (!empty($spotter_array) && is_array($spotter_array)) |
178 | 178 | { |
179 | 179 | $output .= '"features": ['; |
180 | - foreach($spotter_array as $spotter_item) |
|
180 | + foreach ($spotter_array as $spotter_item) |
|
181 | 181 | { |
182 | 182 | $j++; |
183 | 183 | date_default_timezone_set('UTC'); |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | */ |
234 | 234 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
235 | 235 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
236 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
237 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
236 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
237 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
238 | 238 | //" |
239 | 239 | } else { |
240 | 240 | if ($compress) $output .= '"c": "NA",'; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
244 | 244 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
245 | 245 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
246 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
246 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
247 | 247 | } elseif (isset($spotter_item['aircraft_type'])) { |
248 | 248 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
249 | 249 | } elseif (!$min) { |
@@ -384,16 +384,16 @@ discard block |
||
384 | 384 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
385 | 385 | |
386 | 386 | if (isset($archivespeed)) { |
387 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
387 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
388 | 388 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
389 | 389 | } elseif ($usenextlatlon) { |
390 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
390 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
391 | 391 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
392 | 392 | } |
393 | 393 | |
394 | 394 | if (!$min) $output .= '"image": "'.$image.'",'; |
395 | 395 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
396 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
396 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
397 | 397 | } |
398 | 398 | if (isset($spotter_item['image_source_website'])) { |
399 | 399 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
416 | 416 | } |
417 | 417 | if (isset($spotter_item['acars'])) { |
418 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
418 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
419 | 419 | } |
420 | 420 | // type when not aircraft ? |
421 | 421 | if (isset($spotter_item['type'])) { |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | |
494 | 494 | } |
495 | 495 | */ |
496 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
496 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
497 | 497 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
498 | 498 | |
499 | 499 | if ( |
@@ -501,11 +501,11 @@ discard block |
||
501 | 501 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
502 | 502 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
503 | 503 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
504 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
504 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
505 | 505 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
506 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
506 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
507 | 507 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
508 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
508 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
509 | 509 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
510 | 510 | ) { |
511 | 511 | if ($tracker) { |
@@ -542,9 +542,9 @@ discard block |
||
542 | 542 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
543 | 543 | } |
544 | 544 | $output_history .= '['; |
545 | - $output_history .= $spotter_history['longitude'].', '; |
|
546 | - $output_history .= $spotter_history['latitude'].', '; |
|
547 | - $output_history .= $spotter_history['altitude']*30.48; |
|
545 | + $output_history .= $spotter_history['longitude'].', '; |
|
546 | + $output_history .= $spotter_history['latitude'].', '; |
|
547 | + $output_history .= $spotter_history['altitude']*30.48; |
|
548 | 548 | $output_history .= '],'; |
549 | 549 | /* |
550 | 550 | if ($from_archive === false) { |
@@ -562,8 +562,8 @@ discard block |
||
562 | 562 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
563 | 563 | } else $d = true; |
564 | 564 | $output_history .= '['; |
565 | - $output_history .= $spotter_history['longitude'].', '; |
|
566 | - $output_history .= $spotter_history['latitude']; |
|
565 | + $output_history .= $spotter_history['longitude'].', '; |
|
566 | + $output_history .= $spotter_history['latitude']; |
|
567 | 567 | $output_history .= '],'; |
568 | 568 | /* |
569 | 569 | if ($from_archive === false) { |
@@ -579,9 +579,9 @@ discard block |
||
579 | 579 | |
580 | 580 | if ($from_archive === false) { |
581 | 581 | $output_historyd = '['; |
582 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
583 | - $output_historyd .= $spotter_item['latitude']; |
|
584 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
582 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
583 | + $output_historyd .= $spotter_item['latitude']; |
|
584 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
585 | 585 | $output_historyd .= '],'; |
586 | 586 | //$output_history = $output_historyd.$output_history; |
587 | 587 | $output_history = $output_history.$output_historyd; |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | } |
596 | 596 | } |
597 | 597 | |
598 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
598 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
599 | 599 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
600 | 600 | && (isset($spotter_item['departure_airport']) |
601 | 601 | && $spotter_item['departure_airport'] != 'NA' |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | |
630 | 630 | //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))))) { |
631 | 631 | //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))))) { |
632 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
632 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
633 | 633 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
634 | 634 | && (isset($spotter_item['arrival_airport']) |
635 | 635 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | $output = substr($output, 0, -1); |
661 | 661 | $output .= ']'; |
662 | 662 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
663 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
663 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
664 | 664 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
665 | 665 | $output .= '"fc": "'.$j.'"'; |
666 | 666 | } else { |
@@ -48,27 +48,52 @@ discard block |
||
48 | 48 | } |
49 | 49 | header('Content-Type: text/javascript'); |
50 | 50 | |
51 | -if (!isset($globalJsonCompress)) $compress = true; |
|
52 | -else $compress = $globalJsonCompress; |
|
51 | +if (!isset($globalJsonCompress)) { |
|
52 | + $compress = true; |
|
53 | +} else { |
|
54 | + $compress = $globalJsonCompress; |
|
55 | +} |
|
53 | 56 | |
54 | 57 | $from_archive = false; |
55 | 58 | $min = true; |
56 | 59 | $allhistory = false; |
57 | 60 | $filter['source'] = array(); |
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
65 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
66 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
67 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
61 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
62 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
63 | +} |
|
64 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
65 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
66 | +} |
|
67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
68 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
69 | +} |
|
70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
71 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
72 | +} |
|
73 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
74 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
75 | +} |
|
76 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
77 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
78 | +} |
|
79 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
80 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
81 | +} |
|
82 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
83 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
84 | +} |
|
85 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
86 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
87 | +} |
|
88 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
89 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
90 | +} |
|
68 | 91 | |
69 | 92 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
70 | 93 | $min = true; |
71 | -} else $min = false; |
|
94 | +} else { |
|
95 | + $min = false; |
|
96 | +} |
|
72 | 97 | |
73 | 98 | if (isset($_GET['ident'])) { |
74 | 99 | $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
@@ -157,20 +182,30 @@ discard block |
||
157 | 182 | } else { |
158 | 183 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
159 | 184 | } |
160 | - if ($flightcnt == '') $flightcnt = 0; |
|
161 | -} else $flightcnt = 0; |
|
185 | + if ($flightcnt == '') { |
|
186 | + $flightcnt = 0; |
|
187 | + } |
|
188 | + } else { |
|
189 | + $flightcnt = 0; |
|
190 | +} |
|
162 | 191 | |
163 | 192 | $sqltime = round(microtime(true)-$begintime,2); |
164 | 193 | |
165 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
166 | -else $usenextlatlon = true; |
|
194 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
195 | + $usenextlatlon = false; |
|
196 | +} else { |
|
197 | + $usenextlatlon = true; |
|
198 | +} |
|
167 | 199 | $j = 0; |
168 | 200 | $prev_flightaware_id = ''; |
169 | 201 | $aircrafts_shadow = array(); |
170 | 202 | $output = '{'; |
171 | 203 | $output .= '"type": "FeatureCollection",'; |
172 | - if ($min) $output .= '"minimal": "true",'; |
|
173 | - else $output .= '"minimal": "false",'; |
|
204 | + if ($min) { |
|
205 | + $output .= '"minimal": "true",'; |
|
206 | + } else { |
|
207 | + $output .= '"minimal": "false",'; |
|
208 | + } |
|
174 | 209 | //$output .= '"fc": "'.$flightcnt.'",'; |
175 | 210 | $output .= '"sqt": "'.$sqltime.'",'; |
176 | 211 | |
@@ -214,18 +249,29 @@ discard block |
||
214 | 249 | } |
215 | 250 | $output .= '"properties": {'; |
216 | 251 | if (isset($spotter_item['flightaware_id'])) { |
217 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
218 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
252 | + if ($compress) { |
|
253 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
254 | + } else { |
|
255 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
256 | + } |
|
219 | 257 | } elseif (isset($spotter_item['famtrackid'])) { |
220 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
221 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
258 | + if ($compress) { |
|
259 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
260 | + } else { |
|
261 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
262 | + } |
|
222 | 263 | } elseif (isset($spotter_item['fammarine_id'])) { |
223 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
224 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
264 | + if ($compress) { |
|
265 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
266 | + } else { |
|
267 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
268 | + } |
|
225 | 269 | } |
226 | 270 | $output .= '"fc": "'.$flightcnt.'",'; |
227 | 271 | $output .= '"sqt": "'.$sqltime.'",'; |
228 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
272 | + if (isset($begindate)) { |
|
273 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
274 | + } |
|
229 | 275 | |
230 | 276 | /* |
231 | 277 | if ($min) $output .= '"minimal": "true",'; |
@@ -233,14 +279,22 @@ discard block |
||
233 | 279 | */ |
234 | 280 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
235 | 281 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
236 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
237 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
282 | + if ($compress) { |
|
283 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
284 | + } else { |
|
285 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
286 | + } |
|
238 | 287 | //" |
239 | 288 | } else { |
240 | - if ($compress) $output .= '"c": "NA",'; |
|
241 | - else $output .= '"callsign": "NA",'; |
|
289 | + if ($compress) { |
|
290 | + $output .= '"c": "NA",'; |
|
291 | + } else { |
|
292 | + $output .= '"callsign": "NA",'; |
|
293 | + } |
|
294 | + } |
|
295 | + if (isset($spotter_item['registration'])) { |
|
296 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
242 | 297 | } |
243 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
244 | 298 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
245 | 299 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
246 | 300 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -253,16 +307,23 @@ discard block |
||
253 | 307 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
254 | 308 | } |
255 | 309 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
256 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
257 | - else { |
|
310 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
311 | + $spotter_item['aircraft_shadow'] = ''; |
|
312 | + } else { |
|
258 | 313 | $aircraft_icao = $spotter_item['aircraft_icao']; |
259 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
260 | - else { |
|
314 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
315 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
316 | + } else { |
|
261 | 317 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
262 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
263 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
264 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
265 | - else $spotter_item['aircraft_shadow'] = ''; |
|
318 | + if (count($aircraft_info) > 0) { |
|
319 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
320 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
321 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
322 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
323 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
324 | + } else { |
|
325 | + $spotter_item['aircraft_shadow'] = ''; |
|
326 | + } |
|
266 | 327 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
267 | 328 | } |
268 | 329 | } |
@@ -270,73 +331,139 @@ discard block |
||
270 | 331 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
271 | 332 | if ($tracker) { |
272 | 333 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
273 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
274 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
334 | + if ($compress) { |
|
335 | + $output .= '"as": "ambulance.png",'; |
|
336 | + } else { |
|
337 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
338 | + } |
|
275 | 339 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
276 | - if ($compress) $output .= '"as": "police.png",'; |
|
277 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
340 | + if ($compress) { |
|
341 | + $output .= '"as": "police.png",'; |
|
342 | + } else { |
|
343 | + $output .= '"aircraft_shadow": "police.png",'; |
|
344 | + } |
|
278 | 345 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
279 | - if ($compress) $output .= '"as": "ship.png",'; |
|
280 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
346 | + if ($compress) { |
|
347 | + $output .= '"as": "ship.png",'; |
|
348 | + } else { |
|
349 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
350 | + } |
|
281 | 351 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
282 | - if ($compress) $output .= '"as": "ship.png",'; |
|
283 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
352 | + if ($compress) { |
|
353 | + $output .= '"as": "ship.png",'; |
|
354 | + } else { |
|
355 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
356 | + } |
|
284 | 357 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
285 | - if ($compress) $output .= '"as": "ship.png",'; |
|
286 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
358 | + if ($compress) { |
|
359 | + $output .= '"as": "ship.png",'; |
|
360 | + } else { |
|
361 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
362 | + } |
|
287 | 363 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
288 | - if ($compress) $output .= '"as": "truck.png",'; |
|
289 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
364 | + if ($compress) { |
|
365 | + $output .= '"as": "truck.png",'; |
|
366 | + } else { |
|
367 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
368 | + } |
|
290 | 369 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
291 | - if ($compress) $output .= '"as": "truck.png",'; |
|
292 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
370 | + if ($compress) { |
|
371 | + $output .= '"as": "truck.png",'; |
|
372 | + } else { |
|
373 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
374 | + } |
|
293 | 375 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
294 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
295 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
376 | + if ($compress) { |
|
377 | + $output .= '"as": "aircraft.png",'; |
|
378 | + } else { |
|
379 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
380 | + } |
|
296 | 381 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
297 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
298 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
382 | + if ($compress) { |
|
383 | + $output .= '"as": "aircraft.png",'; |
|
384 | + } else { |
|
385 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
386 | + } |
|
299 | 387 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
300 | - if ($compress) $output .= '"as": "helico.png",'; |
|
301 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
388 | + if ($compress) { |
|
389 | + $output .= '"as": "helico.png",'; |
|
390 | + } else { |
|
391 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
392 | + } |
|
302 | 393 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
303 | - if ($compress) $output .= '"as": "rail.png",'; |
|
304 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
394 | + if ($compress) { |
|
395 | + $output .= '"as": "rail.png",'; |
|
396 | + } else { |
|
397 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
398 | + } |
|
305 | 399 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
306 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
307 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
400 | + if ($compress) { |
|
401 | + $output .= '"as": "firetruck.png",'; |
|
402 | + } else { |
|
403 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
404 | + } |
|
308 | 405 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
309 | - if ($compress) $output .= '"as": "bus.png",'; |
|
310 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
406 | + if ($compress) { |
|
407 | + $output .= '"as": "bus.png",'; |
|
408 | + } else { |
|
409 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
410 | + } |
|
311 | 411 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
312 | - if ($compress) $output .= '"as": "phone.png",'; |
|
313 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
412 | + if ($compress) { |
|
413 | + $output .= '"as": "phone.png",'; |
|
414 | + } else { |
|
415 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
416 | + } |
|
314 | 417 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
315 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
316 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
418 | + if ($compress) { |
|
419 | + $output .= '"as": "jogger.png",'; |
|
420 | + } else { |
|
421 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
422 | + } |
|
317 | 423 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
318 | - if ($compress) $output .= '"as": "bike.png",'; |
|
319 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
424 | + if ($compress) { |
|
425 | + $output .= '"as": "bike.png",'; |
|
426 | + } else { |
|
427 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
428 | + } |
|
320 | 429 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
321 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
322 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
430 | + if ($compress) { |
|
431 | + $output .= '"as": "motorcycle.png",'; |
|
432 | + } else { |
|
433 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
434 | + } |
|
323 | 435 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
324 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
325 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
436 | + if ($compress) { |
|
437 | + $output .= '"as": "balloon.png",'; |
|
438 | + } else { |
|
439 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
440 | + } |
|
326 | 441 | } else { |
327 | - if ($compress) $output .= '"as": "car.png",'; |
|
328 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
442 | + if ($compress) { |
|
443 | + $output .= '"as": "car.png",'; |
|
444 | + } else { |
|
445 | + $output .= '"aircraft_shadow": "car.png",'; |
|
446 | + } |
|
329 | 447 | } |
330 | 448 | } elseif ($marine) { |
331 | - if ($compress) $output .= '"as": "ship.png",'; |
|
332 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
449 | + if ($compress) { |
|
450 | + $output .= '"as": "ship.png",'; |
|
451 | + } else { |
|
452 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
453 | + } |
|
333 | 454 | } else { |
334 | - if ($compress) $output .= '"as": "default.png",'; |
|
335 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
455 | + if ($compress) { |
|
456 | + $output .= '"as": "default.png",'; |
|
457 | + } else { |
|
458 | + $output .= '"aircraft_shadow": "default.png",'; |
|
459 | + } |
|
336 | 460 | } |
337 | 461 | } else { |
338 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
339 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
462 | + if ($compress) { |
|
463 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
464 | + } else { |
|
465 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
466 | + } |
|
340 | 467 | } |
341 | 468 | if (isset($spotter_item['airline_name'])) { |
342 | 469 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -344,8 +471,11 @@ discard block |
||
344 | 471 | $output .= '"airline_name": "NA",'; |
345 | 472 | } |
346 | 473 | if (isset($spotter_item['departure_airport'])) { |
347 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
348 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
474 | + if ($compress) { |
|
475 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
476 | + } else { |
|
477 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
478 | + } |
|
349 | 479 | } |
350 | 480 | if (isset($spotter_item['departure_airport_city'])) { |
351 | 481 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -357,8 +487,11 @@ discard block |
||
357 | 487 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
358 | 488 | } |
359 | 489 | if (isset($spotter_item['arrival_airport'])) { |
360 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
361 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
490 | + if ($compress) { |
|
491 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
492 | + } else { |
|
493 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
494 | + } |
|
362 | 495 | } |
363 | 496 | if (isset($spotter_item['arrival_airport_city'])) { |
364 | 497 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -377,11 +510,17 @@ discard block |
||
377 | 510 | } |
378 | 511 | |
379 | 512 | if (isset($spotter_item['altitude'])) { |
380 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
381 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
513 | + if ($compress) { |
|
514 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
515 | + } else { |
|
516 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
517 | + } |
|
518 | + } |
|
519 | + if ($compress) { |
|
520 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
521 | + } else { |
|
522 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
382 | 523 | } |
383 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
384 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
385 | 524 | |
386 | 525 | if (isset($archivespeed)) { |
387 | 526 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
@@ -391,7 +530,9 @@ discard block |
||
391 | 530 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
392 | 531 | } |
393 | 532 | |
394 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
533 | + if (!$min) { |
|
534 | + $output .= '"image": "'.$image.'",'; |
|
535 | + } |
|
395 | 536 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
396 | 537 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
397 | 538 | } |
@@ -399,8 +540,11 @@ discard block |
||
399 | 540 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
400 | 541 | } |
401 | 542 | if (isset($spotter_item['squawk'])) { |
402 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
403 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
543 | + if ($compress) { |
|
544 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
545 | + } else { |
|
546 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
547 | + } |
|
404 | 548 | } |
405 | 549 | if (isset($spotter_item['squawk_usage'])) { |
406 | 550 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -419,14 +563,23 @@ discard block |
||
419 | 563 | } |
420 | 564 | // type when not aircraft ? |
421 | 565 | if (isset($spotter_item['type'])) { |
422 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
423 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
566 | + if ($compress) { |
|
567 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
568 | + } else { |
|
569 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
570 | + } |
|
424 | 571 | } elseif ($marine) { |
425 | - if ($compress) $output .= '"t": "ship"'; |
|
426 | - else $output .= '"type": "ship"'; |
|
572 | + if ($compress) { |
|
573 | + $output .= '"t": "ship"'; |
|
574 | + } else { |
|
575 | + $output .= '"type": "ship"'; |
|
576 | + } |
|
427 | 577 | } else { |
428 | - if ($compress) $output .= '"t": "aircraft"'; |
|
429 | - else $output .= '"type": "aircraft"'; |
|
578 | + if ($compress) { |
|
579 | + $output .= '"t": "aircraft"'; |
|
580 | + } else { |
|
581 | + $output .= '"type": "aircraft"'; |
|
582 | + } |
|
430 | 583 | } |
431 | 584 | $output .= '},'; |
432 | 585 | $output .= '"geometry": {'; |
@@ -494,7 +647,9 @@ discard block |
||
494 | 647 | } |
495 | 648 | */ |
496 | 649 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
497 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
650 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
651 | + $history = $_COOKIE['history']; |
|
652 | + } |
|
498 | 653 | |
499 | 654 | if ( |
500 | 655 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -538,8 +693,11 @@ discard block |
||
538 | 693 | $output_history .= ']}},'; |
539 | 694 | $output .= $output_history; |
540 | 695 | } |
541 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
542 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
696 | + if ($compress) { |
|
697 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
698 | + } else { |
|
699 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
700 | + } |
|
543 | 701 | } |
544 | 702 | $output_history .= '['; |
545 | 703 | $output_history .= $spotter_history['longitude'].', '; |
@@ -558,9 +716,14 @@ discard block |
||
558 | 716 | $prev_alt = $alt; |
559 | 717 | } else { |
560 | 718 | if ($d == false) { |
561 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
562 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
563 | - } else $d = true; |
|
719 | + if ($compress) { |
|
720 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
721 | + } else { |
|
722 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
723 | + } |
|
724 | + } else { |
|
725 | + $d = true; |
|
726 | + } |
|
564 | 727 | $output_history .= '['; |
565 | 728 | $output_history .= $spotter_history['longitude'].', '; |
566 | 729 | $output_history .= $spotter_history['latitude']; |
@@ -581,7 +744,9 @@ discard block |
||
581 | 744 | $output_historyd = '['; |
582 | 745 | $output_historyd .= $spotter_item['longitude'].', '; |
583 | 746 | $output_historyd .= $spotter_item['latitude']; |
584 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
747 | + if (isset($spotter_history['altitude'])) { |
|
748 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
749 | + } |
|
585 | 750 | $output_historyd .= '],'; |
586 | 751 | //$output_history = $output_historyd.$output_history; |
587 | 752 | $output_history = $output_history.$output_historyd; |
@@ -603,8 +768,11 @@ discard block |
||
603 | 768 | && $spotter_item['arrival_airport'] != 'NA' |
604 | 769 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
605 | 770 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
606 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
607 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
771 | + if ($compress) { |
|
772 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
773 | + } else { |
|
774 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
775 | + } |
|
608 | 776 | if (isset($spotter_item['departure_airport_latitude'])) { |
609 | 777 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
610 | 778 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -637,8 +805,11 @@ discard block |
||
637 | 805 | || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
638 | 806 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
639 | 807 | $havedata = false; |
640 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
641 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
808 | + if ($compress) { |
|
809 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
810 | + } else { |
|
811 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
812 | + } |
|
642 | 813 | $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
643 | 814 | |
644 | 815 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -653,7 +824,9 @@ discard block |
||
653 | 824 | } |
654 | 825 | //$output_dest = substr($output_dest, 0, -1); |
655 | 826 | $output_dest .= ']}},'; |
656 | - if ($havedata) $output .= $output_dest; |
|
827 | + if ($havedata) { |
|
828 | + $output .= $output_dest; |
|
829 | + } |
|
657 | 830 | unset($output_dest); |
658 | 831 | } |
659 | 832 | } |
@@ -661,7 +834,9 @@ discard block |
||
661 | 834 | $output .= ']'; |
662 | 835 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
663 | 836 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
664 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
837 | + if (isset($begindate)) { |
|
838 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
839 | + } |
|
665 | 840 | $output .= '"fc": "'.$j.'"'; |
666 | 841 | } else { |
667 | 842 | $output .= '"features": '; |