@@ -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 = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
74 | + $ident = 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 = filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING); |
|
96 | + $famtrack_id = 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 = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING); |
|
100 | + $fammarine_id = 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($_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,18 +142,18 @@ 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 | if (!empty($spotter_array) || $usecoord) { |
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 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | if ($flightcnt == '') $flightcnt = 0; |
162 | 162 | } else $flightcnt = 0; |
163 | 163 | |
164 | -$sqltime = round(microtime(true)-$begintime,2); |
|
164 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
165 | 165 | |
166 | 166 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
167 | 167 | else $usenextlatlon = true; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | if (!empty($spotter_array) && is_array($spotter_array)) |
179 | 179 | { |
180 | 180 | $output .= '"features": ['; |
181 | - foreach($spotter_array as $spotter_item) |
|
181 | + foreach ($spotter_array as $spotter_item) |
|
182 | 182 | { |
183 | 183 | $j++; |
184 | 184 | date_default_timezone_set('UTC'); |
@@ -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) { |
@@ -383,16 +383,16 @@ discard block |
||
383 | 383 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
384 | 384 | |
385 | 385 | if (isset($archivespeed)) { |
386 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
386 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
387 | 387 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
388 | 388 | } elseif ($usenextlatlon) { |
389 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
389 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
390 | 390 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
391 | 391 | } |
392 | 392 | |
393 | 393 | if (!$min) $output .= '"image": "'.$image.'",'; |
394 | 394 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
395 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
395 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
396 | 396 | } |
397 | 397 | if (isset($spotter_item['image_source_website'])) { |
398 | 398 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
415 | 415 | } |
416 | 416 | if (isset($spotter_item['acars'])) { |
417 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
417 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
418 | 418 | } |
419 | 419 | // type when not aircraft ? |
420 | 420 | if (isset($spotter_item['type'])) { |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | |
493 | 493 | } |
494 | 494 | */ |
495 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
495 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
496 | 496 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
497 | 497 | |
498 | 498 | if ( |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
501 | 501 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
502 | 502 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
503 | - || (isset($history) && $history != '' && $history != 'NA' && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
503 | + || (isset($history) && $history != '' && $history != 'NA' && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
504 | 504 | || (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
505 | 505 | ) { |
506 | 506 | if ($tracker) { |
@@ -529,9 +529,9 @@ discard block |
||
529 | 529 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
530 | 530 | } |
531 | 531 | $output_history .= '['; |
532 | - $output_history .= $spotter_history['longitude'].', '; |
|
533 | - $output_history .= $spotter_history['latitude'].', '; |
|
534 | - $output_history .= $spotter_history['altitude']*30.48; |
|
532 | + $output_history .= $spotter_history['longitude'].', '; |
|
533 | + $output_history .= $spotter_history['latitude'].', '; |
|
534 | + $output_history .= $spotter_history['altitude']*30.48; |
|
535 | 535 | $output_history .= '],'; |
536 | 536 | $prev_alt = $alt; |
537 | 537 | } else { |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
541 | 541 | } else $d = true; |
542 | 542 | $output_history .= '['; |
543 | - $output_history .= $spotter_history['longitude'].', '; |
|
544 | - $output_history .= $spotter_history['latitude']; |
|
543 | + $output_history .= $spotter_history['longitude'].', '; |
|
544 | + $output_history .= $spotter_history['latitude']; |
|
545 | 545 | $output_history .= '],'; |
546 | 546 | } |
547 | 547 | } |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $output = substr($output, 0, -1); |
581 | 581 | $output .= ']'; |
582 | 582 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
583 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
583 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
584 | 584 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
585 | 585 | $output .= '"fc": "'.$j.'"'; |
586 | 586 | } 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 = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
@@ -157,21 +182,33 @@ discard block |
||
157 | 182 | } else { |
158 | 183 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
159 | 184 | } |
160 | - } else $flightcnt = count($spotter_array); |
|
161 | - if ($flightcnt == '') $flightcnt = 0; |
|
162 | -} else $flightcnt = 0; |
|
185 | + } else { |
|
186 | + $flightcnt = count($spotter_array); |
|
187 | + } |
|
188 | + if ($flightcnt == '') { |
|
189 | + $flightcnt = 0; |
|
190 | + } |
|
191 | + } else { |
|
192 | + $flightcnt = 0; |
|
193 | +} |
|
163 | 194 | |
164 | 195 | $sqltime = round(microtime(true)-$begintime,2); |
165 | 196 | |
166 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
167 | -else $usenextlatlon = true; |
|
197 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
198 | + $usenextlatlon = false; |
|
199 | +} else { |
|
200 | + $usenextlatlon = true; |
|
201 | +} |
|
168 | 202 | $j = 0; |
169 | 203 | $prev_flightaware_id = ''; |
170 | 204 | $aircrafts_shadow = array(); |
171 | 205 | $output = '{'; |
172 | 206 | $output .= '"type": "FeatureCollection",'; |
173 | - if ($min) $output .= '"minimal": "true",'; |
|
174 | - else $output .= '"minimal": "false",'; |
|
207 | + if ($min) { |
|
208 | + $output .= '"minimal": "true",'; |
|
209 | + } else { |
|
210 | + $output .= '"minimal": "false",'; |
|
211 | + } |
|
175 | 212 | $output .= '"fc": "'.$flightcnt.'",'; |
176 | 213 | $output .= '"sqt": "'.$sqltime.'",'; |
177 | 214 | |
@@ -215,18 +252,29 @@ discard block |
||
215 | 252 | } |
216 | 253 | $output .= '"properties": {'; |
217 | 254 | if (isset($spotter_item['flightaware_id'])) { |
218 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
219 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
255 | + if ($compress) { |
|
256 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
257 | + } else { |
|
258 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
259 | + } |
|
220 | 260 | } elseif (isset($spotter_item['famtrackid'])) { |
221 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
222 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
261 | + if ($compress) { |
|
262 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
263 | + } else { |
|
264 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
265 | + } |
|
223 | 266 | } elseif (isset($spotter_item['fammarine_id'])) { |
224 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
225 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
267 | + if ($compress) { |
|
268 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
269 | + } else { |
|
270 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
271 | + } |
|
226 | 272 | } |
227 | 273 | $output .= '"fc": "'.$flightcnt.'",'; |
228 | 274 | $output .= '"sqt": "'.$sqltime.'",'; |
229 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
275 | + if (isset($begindate)) { |
|
276 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
277 | + } |
|
230 | 278 | |
231 | 279 | /* |
232 | 280 | if ($min) $output .= '"minimal": "true",'; |
@@ -234,13 +282,21 @@ discard block |
||
234 | 282 | */ |
235 | 283 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
236 | 284 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
237 | - if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
238 | - else $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
285 | + if ($compress) { |
|
286 | + $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
287 | + } else { |
|
288 | + $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
289 | + } |
|
239 | 290 | } else { |
240 | - if ($compress) $output .= '"c": "NA",'; |
|
241 | - else $output .= '"callsign": "NA",'; |
|
291 | + if ($compress) { |
|
292 | + $output .= '"c": "NA",'; |
|
293 | + } else { |
|
294 | + $output .= '"callsign": "NA",'; |
|
295 | + } |
|
296 | + } |
|
297 | + if (isset($spotter_item['registration'])) { |
|
298 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
242 | 299 | } |
243 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
244 | 300 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
245 | 301 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
246 | 302 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -253,15 +309,21 @@ discard block |
||
253 | 309 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
254 | 310 | } |
255 | 311 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
256 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
257 | - else { |
|
312 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
313 | + $spotter_item['aircraft_shadow'] = ''; |
|
314 | + } else { |
|
258 | 315 | $aircraft_icao = $spotter_item['aircraft_icao']; |
259 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
260 | - else { |
|
316 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
317 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
318 | + } else { |
|
261 | 319 | $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 | - else $spotter_item['aircraft_shadow'] = ''; |
|
320 | + if (count($aircraft_info) > 0) { |
|
321 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
322 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
323 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
324 | + } else { |
|
325 | + $spotter_item['aircraft_shadow'] = ''; |
|
326 | + } |
|
265 | 327 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
266 | 328 | } |
267 | 329 | } |
@@ -269,73 +331,139 @@ discard block |
||
269 | 331 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
270 | 332 | if ($tracker) { |
271 | 333 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
272 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
273 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
334 | + if ($compress) { |
|
335 | + $output .= '"as": "ambulance.png",'; |
|
336 | + } else { |
|
337 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
338 | + } |
|
274 | 339 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
275 | - if ($compress) $output .= '"as": "police.png",'; |
|
276 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
340 | + if ($compress) { |
|
341 | + $output .= '"as": "police.png",'; |
|
342 | + } else { |
|
343 | + $output .= '"aircraft_shadow": "police.png",'; |
|
344 | + } |
|
277 | 345 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
278 | - if ($compress) $output .= '"as": "ship.png",'; |
|
279 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
346 | + if ($compress) { |
|
347 | + $output .= '"as": "ship.png",'; |
|
348 | + } else { |
|
349 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
350 | + } |
|
280 | 351 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
281 | - if ($compress) $output .= '"as": "ship.png",'; |
|
282 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
352 | + if ($compress) { |
|
353 | + $output .= '"as": "ship.png",'; |
|
354 | + } else { |
|
355 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
356 | + } |
|
283 | 357 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
284 | - if ($compress) $output .= '"as": "ship.png",'; |
|
285 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
358 | + if ($compress) { |
|
359 | + $output .= '"as": "ship.png",'; |
|
360 | + } else { |
|
361 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
362 | + } |
|
286 | 363 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
287 | - if ($compress) $output .= '"as": "truck.png",'; |
|
288 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
364 | + if ($compress) { |
|
365 | + $output .= '"as": "truck.png",'; |
|
366 | + } else { |
|
367 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
368 | + } |
|
289 | 369 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
290 | - if ($compress) $output .= '"as": "truck.png",'; |
|
291 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
370 | + if ($compress) { |
|
371 | + $output .= '"as": "truck.png",'; |
|
372 | + } else { |
|
373 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
374 | + } |
|
292 | 375 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
293 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
294 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
376 | + if ($compress) { |
|
377 | + $output .= '"as": "aircraft.png",'; |
|
378 | + } else { |
|
379 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
380 | + } |
|
295 | 381 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
296 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
297 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
382 | + if ($compress) { |
|
383 | + $output .= '"as": "aircraft.png",'; |
|
384 | + } else { |
|
385 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
386 | + } |
|
298 | 387 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
299 | - if ($compress) $output .= '"as": "helico.png",'; |
|
300 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
388 | + if ($compress) { |
|
389 | + $output .= '"as": "helico.png",'; |
|
390 | + } else { |
|
391 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
392 | + } |
|
301 | 393 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
302 | - if ($compress) $output .= '"as": "rail.png",'; |
|
303 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
394 | + if ($compress) { |
|
395 | + $output .= '"as": "rail.png",'; |
|
396 | + } else { |
|
397 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
398 | + } |
|
304 | 399 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
305 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
306 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
400 | + if ($compress) { |
|
401 | + $output .= '"as": "firetruck.png",'; |
|
402 | + } else { |
|
403 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
404 | + } |
|
307 | 405 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
308 | - if ($compress) $output .= '"as": "bus.png",'; |
|
309 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
406 | + if ($compress) { |
|
407 | + $output .= '"as": "bus.png",'; |
|
408 | + } else { |
|
409 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
410 | + } |
|
310 | 411 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
311 | - if ($compress) $output .= '"as": "phone.png",'; |
|
312 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
412 | + if ($compress) { |
|
413 | + $output .= '"as": "phone.png",'; |
|
414 | + } else { |
|
415 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
416 | + } |
|
313 | 417 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
314 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
315 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
418 | + if ($compress) { |
|
419 | + $output .= '"as": "jogger.png",'; |
|
420 | + } else { |
|
421 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
422 | + } |
|
316 | 423 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
317 | - if ($compress) $output .= '"as": "bike.png",'; |
|
318 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
424 | + if ($compress) { |
|
425 | + $output .= '"as": "bike.png",'; |
|
426 | + } else { |
|
427 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
428 | + } |
|
319 | 429 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
320 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
321 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
430 | + if ($compress) { |
|
431 | + $output .= '"as": "motorcycle.png",'; |
|
432 | + } else { |
|
433 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
434 | + } |
|
322 | 435 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
323 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
324 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
436 | + if ($compress) { |
|
437 | + $output .= '"as": "balloon.png",'; |
|
438 | + } else { |
|
439 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
440 | + } |
|
325 | 441 | } else { |
326 | - if ($compress) $output .= '"as": "car.png",'; |
|
327 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
442 | + if ($compress) { |
|
443 | + $output .= '"as": "car.png",'; |
|
444 | + } else { |
|
445 | + $output .= '"aircraft_shadow": "car.png",'; |
|
446 | + } |
|
328 | 447 | } |
329 | 448 | } elseif ($marine) { |
330 | - if ($compress) $output .= '"as": "ship.png",'; |
|
331 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
449 | + if ($compress) { |
|
450 | + $output .= '"as": "ship.png",'; |
|
451 | + } else { |
|
452 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
453 | + } |
|
332 | 454 | } else { |
333 | - if ($compress) $output .= '"as": "default.png",'; |
|
334 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
455 | + if ($compress) { |
|
456 | + $output .= '"as": "default.png",'; |
|
457 | + } else { |
|
458 | + $output .= '"aircraft_shadow": "default.png",'; |
|
459 | + } |
|
335 | 460 | } |
336 | 461 | } else { |
337 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
338 | - 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 | + } |
|
339 | 467 | } |
340 | 468 | if (isset($spotter_item['airline_name'])) { |
341 | 469 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -343,8 +471,11 @@ discard block |
||
343 | 471 | $output .= '"airline_name": "NA",'; |
344 | 472 | } |
345 | 473 | if (isset($spotter_item['departure_airport'])) { |
346 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
347 | - 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 | + } |
|
348 | 479 | } |
349 | 480 | if (isset($spotter_item['departure_airport_city'])) { |
350 | 481 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -356,8 +487,11 @@ discard block |
||
356 | 487 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
357 | 488 | } |
358 | 489 | if (isset($spotter_item['arrival_airport'])) { |
359 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
360 | - 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 | + } |
|
361 | 495 | } |
362 | 496 | if (isset($spotter_item['arrival_airport_city'])) { |
363 | 497 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -376,11 +510,17 @@ discard block |
||
376 | 510 | } |
377 | 511 | |
378 | 512 | if (isset($spotter_item['altitude'])) { |
379 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
380 | - 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'].'",'; |
|
381 | 523 | } |
382 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
383 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
384 | 524 | |
385 | 525 | if (isset($archivespeed)) { |
386 | 526 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
@@ -390,7 +530,9 @@ discard block |
||
390 | 530 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
391 | 531 | } |
392 | 532 | |
393 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
533 | + if (!$min) { |
|
534 | + $output .= '"image": "'.$image.'",'; |
|
535 | + } |
|
394 | 536 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
395 | 537 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
396 | 538 | } |
@@ -398,8 +540,11 @@ discard block |
||
398 | 540 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
399 | 541 | } |
400 | 542 | if (isset($spotter_item['squawk'])) { |
401 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
402 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
543 | + if ($compress) { |
|
544 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
545 | + } else { |
|
546 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
547 | + } |
|
403 | 548 | } |
404 | 549 | if (isset($spotter_item['squawk_usage'])) { |
405 | 550 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -418,14 +563,23 @@ discard block |
||
418 | 563 | } |
419 | 564 | // type when not aircraft ? |
420 | 565 | if (isset($spotter_item['type'])) { |
421 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
422 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
566 | + if ($compress) { |
|
567 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
568 | + } else { |
|
569 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
570 | + } |
|
423 | 571 | } elseif ($marine) { |
424 | - if ($compress) $output .= '"t": "ship"'; |
|
425 | - else $output .= '"type": "ship"'; |
|
572 | + if ($compress) { |
|
573 | + $output .= '"t": "ship"'; |
|
574 | + } else { |
|
575 | + $output .= '"type": "ship"'; |
|
576 | + } |
|
426 | 577 | } else { |
427 | - if ($compress) $output .= '"t": "aircraft"'; |
|
428 | - else $output .= '"type": "aircraft"'; |
|
578 | + if ($compress) { |
|
579 | + $output .= '"t": "aircraft"'; |
|
580 | + } else { |
|
581 | + $output .= '"type": "aircraft"'; |
|
582 | + } |
|
429 | 583 | } |
430 | 584 | $output .= '},'; |
431 | 585 | $output .= '"geometry": {'; |
@@ -493,7 +647,9 @@ discard block |
||
493 | 647 | } |
494 | 648 | */ |
495 | 649 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
496 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
650 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
651 | + $history = $_COOKIE['history']; |
|
652 | + } |
|
497 | 653 | |
498 | 654 | if ( |
499 | 655 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -525,8 +681,11 @@ discard block |
||
525 | 681 | $output_history .= ']}},'; |
526 | 682 | $output .= $output_history; |
527 | 683 | } |
528 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
529 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
684 | + if ($compress) { |
|
685 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
686 | + } else { |
|
687 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
688 | + } |
|
530 | 689 | } |
531 | 690 | $output_history .= '['; |
532 | 691 | $output_history .= $spotter_history['longitude'].', '; |
@@ -536,9 +695,14 @@ discard block |
||
536 | 695 | $prev_alt = $alt; |
537 | 696 | } else { |
538 | 697 | if ($d == false) { |
539 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
540 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
541 | - } else $d = true; |
|
698 | + if ($compress) { |
|
699 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
700 | + } else { |
|
701 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
702 | + } |
|
703 | + } else { |
|
704 | + $d = true; |
|
705 | + } |
|
542 | 706 | $output_history .= '['; |
543 | 707 | $output_history .= $spotter_history['longitude'].', '; |
544 | 708 | $output_history .= $spotter_history['latitude']; |
@@ -581,7 +745,9 @@ discard block |
||
581 | 745 | $output .= ']'; |
582 | 746 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
583 | 747 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
584 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
748 | + if (isset($begindate)) { |
|
749 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
750 | + } |
|
585 | 751 | $output .= '"fc": "'.$j.'"'; |
586 | 752 | } else { |
587 | 753 | $output .= '"features": '; |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | $s3 = sin($bank/2); |
44 | 44 | $c1c2 = $c1*$c2; |
45 | 45 | $s1s2 = $s1*$s2; |
46 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
47 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
48 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
49 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
50 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
46 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
47 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
48 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
49 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
50 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
51 | 51 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
52 | 52 | |
53 | 53 | } |
@@ -68,16 +68,16 @@ discard block |
||
68 | 68 | $min = false; |
69 | 69 | $allhistory = false; |
70 | 70 | $filter['source'] = array(); |
71 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
72 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
73 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
74 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
75 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
76 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
78 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
79 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
80 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
71 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
72 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
73 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
74 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
75 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
76 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
77 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
78 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
79 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
80 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
81 | 81 | /* |
82 | 82 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
83 | 83 | $min = true; |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | $from_archive = true; |
125 | 125 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
126 | 126 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
127 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
128 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
129 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
130 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
131 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
132 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
127 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
128 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
129 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
130 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
131 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
132 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
133 | 133 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
134 | 134 | $from_archive = true; |
135 | 135 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $begindate = $_COOKIE['archive_begin']; |
140 | 140 | $enddate = $_COOKIE['archive_end']; |
141 | 141 | |
142 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
143 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
144 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
142 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
143 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
144 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
145 | 145 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
146 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
146 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
147 | 147 | } elseif ($tracker) { |
148 | 148 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($filter); |
149 | 149 | } elseif ($marine) { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | if (!empty($spotter_array)) { |
156 | 156 | if (isset($_GET['archive'])) { |
157 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
157 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
158 | 158 | } elseif ($tracker) { |
159 | 159 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
160 | 160 | } elseif ($marine) { |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | if ($flightcnt == '') $flightcnt = 0; |
166 | 166 | } else $flightcnt = 0; |
167 | 167 | |
168 | -$sqltime = round(microtime(true)-$begintime,2); |
|
168 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
169 | 169 | $minitime = time(); |
170 | 170 | $maxitime = 0; |
171 | 171 | |
172 | 172 | |
173 | 173 | $modelsdb = array(); |
174 | 174 | if (file_exists('models/modelsdb')) { |
175 | - if (($handle = fopen('models/modelsdb','r')) !== FALSE) { |
|
176 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
177 | - if (isset($row[1]) ){ |
|
175 | + if (($handle = fopen('models/modelsdb', 'r')) !== FALSE) { |
|
176 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
177 | + if (isset($row[1])) { |
|
178 | 178 | $model = $row[0]; |
179 | 179 | $modelsdb[$model] = $row[1]; |
180 | 180 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $output .= '},'; |
210 | 210 | if (!empty($spotter_array) && is_array($spotter_array)) |
211 | 211 | { |
212 | - foreach($spotter_array as $spotter_item) |
|
212 | + foreach ($spotter_array as $spotter_item) |
|
213 | 213 | { |
214 | 214 | $j++; |
215 | 215 | date_default_timezone_set('UTC'); |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | $output .= '"cartographicDegrees": ['; |
498 | 498 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
499 | 499 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
500 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
500 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
501 | 501 | $output .= $spotter_item['longitude'].', '; |
502 | 502 | $output .= $spotter_item['latitude']; |
503 | 503 | $prevlong = $spotter_item['longitude']; |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
512 | 512 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
513 | 513 | } else { |
514 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
514 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
515 | 515 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
516 | 516 | if ($spotter_item['ground_speed'] == 0) { |
517 | 517 | $output .= $prevlong.', '; |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $output = substr($output, 0, -1); |
544 | 544 | } |
545 | 545 | $output .= ']'; |
546 | -$output = str_replace('%minitime%',date("c",$minitime),$output); |
|
547 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
546 | +$output = str_replace('%minitime%', date("c", $minitime), $output); |
|
547 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
548 | 548 | print $output; |
549 | 549 | ?> |
@@ -3,8 +3,12 @@ discard block |
||
3 | 3 | require_once('require/class.Common.php'); |
4 | 4 | $tracker = false; |
5 | 5 | $marine = false; |
6 | -if (isset($_GET['tracker'])) $tracker = true; |
|
7 | -if (isset($_GET['marine'])) $marine = true; |
|
6 | +if (isset($_GET['tracker'])) { |
|
7 | + $tracker = true; |
|
8 | +} |
|
9 | +if (isset($_GET['marine'])) { |
|
10 | + $marine = true; |
|
11 | +} |
|
8 | 12 | if ($tracker) { |
9 | 13 | require_once('require/class.Tracker.php'); |
10 | 14 | require_once('require/class.TrackerLive.php'); |
@@ -61,23 +65,46 @@ discard block |
||
61 | 65 | } |
62 | 66 | header('Content-Type: text/javascript'); |
63 | 67 | |
64 | -if (!isset($globalJsonCompress)) $compress = true; |
|
65 | -else $compress = $globalJsonCompress; |
|
68 | +if (!isset($globalJsonCompress)) { |
|
69 | + $compress = true; |
|
70 | +} else { |
|
71 | + $compress = $globalJsonCompress; |
|
72 | +} |
|
66 | 73 | |
67 | 74 | $from_archive = false; |
68 | 75 | $min = false; |
69 | 76 | $allhistory = false; |
70 | 77 | $filter['source'] = array(); |
71 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
72 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
73 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
74 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
75 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
76 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
78 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
79 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
80 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
79 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
80 | +} |
|
81 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
82 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
83 | +} |
|
84 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
85 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
86 | +} |
|
87 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
88 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
89 | +} |
|
90 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
91 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
92 | +} |
|
93 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
94 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
95 | +} |
|
96 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
97 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
98 | +} |
|
99 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
100 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
101 | +} |
|
102 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
103 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
104 | +} |
|
105 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
106 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
107 | +} |
|
81 | 108 | /* |
82 | 109 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
83 | 110 | $min = true; |
@@ -162,8 +189,12 @@ discard block |
||
162 | 189 | } else { |
163 | 190 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
164 | 191 | } |
165 | - if ($flightcnt == '') $flightcnt = 0; |
|
166 | -} else $flightcnt = 0; |
|
192 | + if ($flightcnt == '') { |
|
193 | + $flightcnt = 0; |
|
194 | + } |
|
195 | + } else { |
|
196 | + $flightcnt = 0; |
|
197 | +} |
|
167 | 198 | |
168 | 199 | $sqltime = round(microtime(true)-$begintime,2); |
169 | 200 | $minitime = time(); |
@@ -186,7 +217,9 @@ discard block |
||
186 | 217 | $j = 0; |
187 | 218 | $prev_flightaware_id = ''; |
188 | 219 | $speed = 1; |
189 | -if (isset($archivespeed)) $speed = $archivespeed; |
|
220 | +if (isset($archivespeed)) { |
|
221 | + $speed = $archivespeed; |
|
222 | +} |
|
190 | 223 | $output = '['; |
191 | 224 | if ($tracker) { |
192 | 225 | $output .= '{"id" : "document", "name" : "tracker","version" : "1.0"'; |
@@ -220,9 +253,13 @@ discard block |
||
220 | 253 | $image = "images/placeholder_thumb.png"; |
221 | 254 | } |
222 | 255 | |
223 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
224 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
225 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
256 | + if (isset($spotter_item['flightaware_id'])) { |
|
257 | + $id = $spotter_item['flightaware_id']; |
|
258 | + } elseif (isset($spotter_item['famtrackid'])) { |
|
259 | + $id = $spotter_item['famtrackid']; |
|
260 | + } elseif (isset($spotter_item['fammarine_id'])) { |
|
261 | + $id = $spotter_item['fammarine_id']; |
|
262 | + } |
|
226 | 263 | if ($prev_flightaware_id != $id) { |
227 | 264 | if ($prev_flightaware_id != '') { |
228 | 265 | $output .= ']'; |
@@ -268,7 +305,9 @@ discard block |
||
268 | 305 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
269 | 306 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
270 | 307 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
271 | - } else $aircraft_shadow = ''; |
|
308 | + } else { |
|
309 | + $aircraft_shadow = ''; |
|
310 | + } |
|
272 | 311 | if ($aircraft_shadow != '') { |
273 | 312 | if (isset($modelsdb[$aircraft_shadow])) { |
274 | 313 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20'; |
@@ -405,7 +444,9 @@ discard block |
||
405 | 444 | } |
406 | 445 | $output .= '},'; |
407 | 446 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
408 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
447 | + if ($spotter_item['aircraft_icao'] != '') { |
|
448 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
449 | + } |
|
409 | 450 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
410 | 451 | } |
411 | 452 | } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
@@ -427,7 +468,9 @@ discard block |
||
427 | 468 | } |
428 | 469 | $output .= '},'; |
429 | 470 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
430 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
471 | + if ($spotter_item['aircraft_icao'] != '') { |
|
472 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
473 | + } |
|
431 | 474 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
432 | 475 | } |
433 | 476 | } else { |
@@ -440,7 +483,9 @@ discard block |
||
440 | 483 | } |
441 | 484 | $output .= '},'; |
442 | 485 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
443 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
486 | + if ($spotter_item['aircraft_icao'] != '') { |
|
487 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
488 | + } |
|
444 | 489 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
445 | 490 | } |
446 | 491 | } elseif ($tracker && isset($spotter_item['type'])) { |
@@ -495,8 +540,12 @@ discard block |
||
495 | 540 | // $output .= '"interpolationDegree" : 5,'; |
496 | 541 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
497 | 542 | $output .= '"cartographicDegrees": ['; |
498 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
|
499 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
543 | + if ($minitime > strtotime($spotter_item['date'])) { |
|
544 | + $minitime = strtotime($spotter_item['date']); |
|
545 | + } |
|
546 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
547 | + $maxitime = strtotime($spotter_item['date']); |
|
548 | + } |
|
500 | 549 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
501 | 550 | $output .= $spotter_item['longitude'].', '; |
502 | 551 | $output .= $spotter_item['latitude']; |
@@ -505,19 +554,26 @@ discard block |
||
505 | 554 | if (!$tracker && !$marine) { |
506 | 555 | $output .= ', '.round($spotter_item['altitude']*30.48); |
507 | 556 | $prevalt = round($spotter_item['altitude']*30.48); |
508 | - } else $output .= ', 0'; |
|
557 | + } else { |
|
558 | + $output .= ', 0'; |
|
559 | + } |
|
509 | 560 | //$orientation = '"orientation" : { '; |
510 | 561 | //$orientation .= '"unitQuaternion": ['; |
511 | 562 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
512 | 563 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
513 | 564 | } else { |
514 | 565 | $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
515 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
566 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
567 | + $maxitime = strtotime($spotter_item['date']); |
|
568 | + } |
|
516 | 569 | if ($spotter_item['ground_speed'] == 0) { |
517 | 570 | $output .= $prevlong.', '; |
518 | 571 | $output .= $prevlat; |
519 | - if (!$tracker && !$marine) $output .= ', '.$prevalt; |
|
520 | - else $output .= ', 0'; |
|
572 | + if (!$tracker && !$marine) { |
|
573 | + $output .= ', '.$prevalt; |
|
574 | + } else { |
|
575 | + $output .= ', 0'; |
|
576 | + } |
|
521 | 577 | } else { |
522 | 578 | $output .= $spotter_item['longitude'].', '; |
523 | 579 | $output .= $spotter_item['latitude']; |
@@ -531,7 +587,9 @@ discard block |
||
531 | 587 | } else { |
532 | 588 | $output .= ', '.round($spotter_item['altitude']*30.48); |
533 | 589 | } |
534 | - } else $output .= ', 0'; |
|
590 | + } else { |
|
591 | + $output .= ', 0'; |
|
592 | + } |
|
535 | 593 | } |
536 | 594 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
537 | 595 | //$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |