@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // This script can be slow... |
3 | 3 | set_time_limit(0); |
4 | -ini_set('max_execution_time',6000); |
|
4 | +ini_set('max_execution_time', 6000); |
|
5 | 5 | require_once('require/class.Connection.php'); |
6 | 6 | require_once('require/class.Common.php'); |
7 | 7 | |
@@ -63,24 +63,24 @@ discard block |
||
63 | 63 | $min = false; |
64 | 64 | $allhistory = false; |
65 | 65 | $filter['source'] = array(); |
66 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
69 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
71 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
72 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
66 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
69 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
71 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
72 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
73 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
74 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
75 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
76 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
77 | 77 | |
78 | 78 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
79 | 79 | $min = true; |
80 | 80 | } else $min = false; |
81 | 81 | |
82 | 82 | if (isset($_GET['ident'])) { |
83 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
83 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
84 | 84 | $from_archive = true; |
85 | 85 | if ($tracker) { |
86 | 86 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $allhistory = true; |
95 | 95 | } |
96 | 96 | elseif (isset($_GET['flightaware_id'])) { |
97 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
97 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
98 | 98 | $from_archive = true; |
99 | 99 | if ($tracker) { |
100 | 100 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
@@ -109,23 +109,23 @@ discard block |
||
109 | 109 | } |
110 | 110 | elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
111 | 111 | $from_archive = true; |
112 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
112 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
113 | 113 | if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
114 | 114 | else $begindate = $begindate - 3000; |
115 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
116 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
115 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
116 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
117 | 117 | if ($begindate != '' && $enddate != '') { |
118 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
119 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
118 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
119 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
120 | 120 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
121 | 121 | if ($tracker) { |
122 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
122 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
123 | 123 | } |
124 | 124 | elseif ($marine) { |
125 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
125 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
126 | 126 | } |
127 | 127 | else { |
128 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
128 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | if ($flightcnt == '') $flightcnt = 0; |
137 | 137 | } else $flightcnt = 0; |
138 | 138 | |
139 | -$sqltime = round(microtime(true)-$begintime,2); |
|
139 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
140 | 140 | |
141 | 141 | $pfi = ''; |
142 | 142 | //var_dump($spotter_array); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $begin = true; |
152 | 152 | if (!empty($spotter_array) && is_array($spotter_array)) { |
153 | 153 | $output .= '"features": ['; |
154 | - foreach($spotter_array as $spotter_item) { |
|
154 | + foreach ($spotter_array as $spotter_item) { |
|
155 | 155 | $j++; |
156 | 156 | date_default_timezone_set('UTC'); |
157 | 157 | if ($tracker) { |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | if ($begin) { |
176 | 176 | if ($j > 1) { |
177 | 177 | if (isset($output_time)) { |
178 | - $output_time = substr($output_time, 0, -1); |
|
178 | + $output_time = substr($output_time, 0, -1); |
|
179 | 179 | $output .= '"time": ['.$output_time.']'; |
180 | 180 | } |
181 | 181 | $output .= '},'; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $output .= '"type": "LineString",'; |
185 | 185 | $output .= '"coordinates": ['; |
186 | 186 | if (isset($output_history)) { |
187 | - $output_history = substr($output_history, 0, -1); |
|
187 | + $output_history = substr($output_history, 0, -1); |
|
188 | 188 | $output .= $output_history; |
189 | 189 | } |
190 | 190 | $output .= ']}},'; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $output .= '"fi": "'.$pfi.'",'; |
216 | 216 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
217 | 217 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
218 | - $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
218 | + $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
219 | 219 | //" |
220 | 220 | } else { |
221 | 221 | $output .= '"c": "NA",'; |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | |
350 | 350 | if ($j > 1) { |
351 | 351 | if (isset($output_time)) { |
352 | - $output_time = substr($output_time, 0, -1); |
|
352 | + $output_time = substr($output_time, 0, -1); |
|
353 | 353 | $output .= '"time": ['.$output_time.']'; |
354 | 354 | } |
355 | 355 | $output .= '},'; |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $output .= '"type": "LineString",'; |
359 | 359 | $output .= '"coordinates": ['; |
360 | 360 | if (isset($output_history)) { |
361 | - $output_history = substr($output_history, 0, -1); |
|
361 | + $output_history = substr($output_history, 0, -1); |
|
362 | 362 | $output .= $output_history; |
363 | 363 | } |
364 | 364 | $output .= ']'; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $output = substr($output, 0, -1); |
370 | 370 | $output .= ']'; |
371 | 371 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
372 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
372 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
373 | 373 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
374 | 374 | $output .= '"fc": "'.$flightcnt.'"'; |
375 | 375 | } else { |
@@ -25,12 +25,10 @@ discard block |
||
25 | 25 | if ($tracker) { |
26 | 26 | require_once('require/class.Tracker.php'); |
27 | 27 | require_once('require/class.TrackerArchive.php'); |
28 | -} |
|
29 | -elseif ($marine) { |
|
28 | +} elseif ($marine) { |
|
30 | 29 | require_once('require/class.Marine.php'); |
31 | 30 | require_once('require/class.MarineArchive.php'); |
32 | -} |
|
33 | -else { |
|
31 | +} else { |
|
34 | 32 | require_once('require/class.Spotter.php'); |
35 | 33 | require_once('require/class.SpotterArchive.php'); |
36 | 34 | } |
@@ -38,12 +36,10 @@ discard block |
||
38 | 36 | if ($tracker) { |
39 | 37 | $Tracker = new Tracker(); |
40 | 38 | $TrackerArchive = new TrackerArchive(); |
41 | -} |
|
42 | -elseif ($marine) { |
|
39 | +} elseif ($marine) { |
|
43 | 40 | $Marine = new Marine(); |
44 | 41 | $MarineArchive = new MarineArchive(); |
45 | -} |
|
46 | -else { |
|
42 | +} else { |
|
47 | 43 | $Spotter = new Spotter(); |
48 | 44 | $SpotterArchive = new SpotterArchive(); |
49 | 45 | } |
@@ -56,62 +52,86 @@ discard block |
||
56 | 52 | } |
57 | 53 | header('Content-Type: text/javascript'); |
58 | 54 | |
59 | -if (!isset($globalJsonCompress)) $compress = true; |
|
60 | -else $compress = $globalJsonCompress; |
|
55 | +if (!isset($globalJsonCompress)) { |
|
56 | + $compress = true; |
|
57 | +} else { |
|
58 | + $compress = $globalJsonCompress; |
|
59 | +} |
|
61 | 60 | |
62 | 61 | $from_archive = false; |
63 | 62 | $min = false; |
64 | 63 | $allhistory = false; |
65 | 64 | $filter['source'] = array(); |
66 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
69 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
71 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
72 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
65 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
66 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
67 | +} |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
69 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
70 | +} |
|
71 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
72 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
73 | +} |
|
74 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
75 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
76 | +} |
|
77 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
78 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
79 | +} |
|
80 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
81 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
82 | +} |
|
83 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
84 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
85 | +} |
|
86 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
87 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
88 | +} |
|
89 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
90 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
91 | +} |
|
92 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
93 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
94 | +} |
|
95 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
96 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
97 | +} |
|
77 | 98 | |
78 | 99 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
79 | 100 | $min = true; |
80 | -} else $min = false; |
|
101 | +} else { |
|
102 | + $min = false; |
|
103 | +} |
|
81 | 104 | |
82 | 105 | if (isset($_GET['ident'])) { |
83 | 106 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
84 | 107 | $from_archive = true; |
85 | 108 | if ($tracker) { |
86 | 109 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
87 | - } |
|
88 | - elseif ($marine) { |
|
110 | + } elseif ($marine) { |
|
89 | 111 | $spotter_array = $MarineArchive->getLastArchiveMarineDataByIdent($ident); |
90 | - } |
|
91 | - else { |
|
112 | + } else { |
|
92 | 113 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident); |
93 | 114 | } |
94 | 115 | $allhistory = true; |
95 | -} |
|
96 | -elseif (isset($_GET['flightaware_id'])) { |
|
116 | +} elseif (isset($_GET['flightaware_id'])) { |
|
97 | 117 | $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
98 | 118 | $from_archive = true; |
99 | 119 | if ($tracker) { |
100 | 120 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
101 | - } |
|
102 | - elseif ($marine) { |
|
121 | + } elseif ($marine) { |
|
103 | 122 | $spotter_array = $MarineArchive->getLastArchiveMarineDataById($flightaware_id); |
104 | - } |
|
105 | - else { |
|
123 | + } else { |
|
106 | 124 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
107 | 125 | } |
108 | 126 | $allhistory = true; |
109 | -} |
|
110 | -elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
127 | +} elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
111 | 128 | $from_archive = true; |
112 | 129 | $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
113 | - if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
|
114 | - else $begindate = $begindate - 3000; |
|
130 | + if (isset($globalAircraftMaxUpdate)) { |
|
131 | + $begindate = $begindate - $globalAircraftMaxUpdate; |
|
132 | + } else { |
|
133 | + $begindate = $begindate - 3000; |
|
134 | + } |
|
115 | 135 | $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
116 | 136 | $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
117 | 137 | if ($begindate != '' && $enddate != '') { |
@@ -120,11 +140,9 @@ discard block |
||
120 | 140 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
121 | 141 | if ($tracker) { |
122 | 142 | $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
123 | - } |
|
124 | - elseif ($marine) { |
|
143 | + } elseif ($marine) { |
|
125 | 144 | $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
126 | - } |
|
127 | - else { |
|
145 | + } else { |
|
128 | 146 | $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
129 | 147 | } |
130 | 148 | } |
@@ -133,8 +151,12 @@ discard block |
||
133 | 151 | if (!empty($spotter_array)) { |
134 | 152 | //$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
135 | 153 | $flightcnt = 0; |
136 | - if ($flightcnt == '') $flightcnt = 0; |
|
137 | -} else $flightcnt = 0; |
|
154 | + if ($flightcnt == '') { |
|
155 | + $flightcnt = 0; |
|
156 | + } |
|
157 | + } else { |
|
158 | + $flightcnt = 0; |
|
159 | +} |
|
138 | 160 | |
139 | 161 | $sqltime = round(microtime(true)-$begintime,2); |
140 | 162 | |
@@ -144,8 +166,11 @@ discard block |
||
144 | 166 | $aircrafts_shadow = array(); |
145 | 167 | $output = '{'; |
146 | 168 | $output .= '"type": "FeatureCollection",'; |
147 | -if ($min) $output .= '"minimal": "true",'; |
|
148 | -else $output .= '"minimal": "false",'; |
|
169 | +if ($min) { |
|
170 | + $output .= '"minimal": "true",'; |
|
171 | +} else { |
|
172 | + $output .= '"minimal": "false",'; |
|
173 | +} |
|
149 | 174 | $output .= '"fc": "'.$flightcnt.'",'; |
150 | 175 | $output .= '"sqt": "'.$sqltime.'",'; |
151 | 176 | $begin = true; |
@@ -158,15 +183,17 @@ discard block |
||
158 | 183 | if ($pfi != $spotter_item['famtrackid']) { |
159 | 184 | $pfi = $spotter_item['famtrackid']; |
160 | 185 | $begin = true; |
161 | - } else $spotter_history_array = 0; |
|
162 | - } |
|
163 | - elseif ($marine) { |
|
186 | + } else { |
|
187 | + $spotter_history_array = 0; |
|
188 | + } |
|
189 | + } elseif ($marine) { |
|
164 | 190 | if ($pfi != $spotter_item['fammarine_d']) { |
165 | 191 | $pfi = $spotter_item['fammarine_id']; |
166 | 192 | $begin = true; |
167 | - } else $spotter_history_array = 0; |
|
168 | - } |
|
169 | - else { |
|
193 | + } else { |
|
194 | + $spotter_history_array = 0; |
|
195 | + } |
|
196 | + } else { |
|
170 | 197 | if ($pfi != $spotter_item['flightaware_id']) { |
171 | 198 | $pfi = $spotter_item['flightaware_id']; |
172 | 199 | $begin = true; |
@@ -203,7 +230,9 @@ discard block |
||
203 | 230 | $output_history .= '['.$spotter_item['longitude'].', '.$spotter_item['latitude'].'],'; |
204 | 231 | $output_time .= (strtotime($spotter_item['date'])*1000).','; |
205 | 232 | $previousts = strtotime($spotter_item['date']); |
206 | - if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) $end = true; |
|
233 | + if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) { |
|
234 | + $end = true; |
|
235 | + } |
|
207 | 236 | } |
208 | 237 | |
209 | 238 | if ($begin) { |
@@ -213,7 +242,9 @@ discard block |
||
213 | 242 | $output .= '"type": "Feature",'; |
214 | 243 | $output .= '"properties": {'; |
215 | 244 | $output .= '"fi": "'.$pfi.'",'; |
216 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
245 | + if (isset($begindate)) { |
|
246 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
247 | + } |
|
217 | 248 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
218 | 249 | $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
219 | 250 | //" |
@@ -221,14 +252,20 @@ discard block |
||
221 | 252 | $output .= '"c": "NA",'; |
222 | 253 | } |
223 | 254 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
224 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
225 | - else { |
|
255 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
256 | + $spotter_item['aircraft_shadow'] = ''; |
|
257 | + } else { |
|
226 | 258 | $aircraft_icao = $spotter_item['aircraft_icao']; |
227 | 259 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
228 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
229 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
230 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
231 | - else $spotter_item['aircraft_shadow'] = ''; |
|
260 | + if (count($aircraft_info) > 0) { |
|
261 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
262 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
263 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
264 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
265 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
266 | + } else { |
|
267 | + $spotter_item['aircraft_shadow'] = ''; |
|
268 | + } |
|
232 | 269 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
233 | 270 | } |
234 | 271 | } |
@@ -236,93 +273,139 @@ discard block |
||
236 | 273 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
237 | 274 | if ($tracker) { |
238 | 275 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
239 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
240 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
241 | - } |
|
242 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
243 | - if ($compress) $output .= '"as": "police.png",'; |
|
244 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
245 | - } |
|
246 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
247 | - if ($compress) $output .= '"as": "ship.png",'; |
|
248 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
249 | - } |
|
250 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
251 | - if ($compress) $output .= '"as": "ship.png",'; |
|
252 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
253 | - } |
|
254 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
255 | - if ($compress) $output .= '"as": "ship.png",'; |
|
256 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
276 | + if ($compress) { |
|
277 | + $output .= '"as": "ambulance.png",'; |
|
278 | + } else { |
|
279 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
280 | + } |
|
281 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
282 | + if ($compress) { |
|
283 | + $output .= '"as": "police.png",'; |
|
284 | + } else { |
|
285 | + $output .= '"aircraft_shadow": "police.png",'; |
|
286 | + } |
|
287 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
288 | + if ($compress) { |
|
289 | + $output .= '"as": "ship.png",'; |
|
290 | + } else { |
|
291 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
292 | + } |
|
293 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
294 | + if ($compress) { |
|
295 | + $output .= '"as": "ship.png",'; |
|
296 | + } else { |
|
297 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
298 | + } |
|
299 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
300 | + if ($compress) { |
|
301 | + $output .= '"as": "ship.png",'; |
|
302 | + } else { |
|
303 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
304 | + } |
|
305 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
306 | + if ($compress) { |
|
307 | + $output .= '"as": "truck.png",'; |
|
308 | + } else { |
|
309 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
310 | + } |
|
311 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
312 | + if ($compress) { |
|
313 | + $output .= '"as": "truck.png",'; |
|
314 | + } else { |
|
315 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
316 | + } |
|
317 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
318 | + if ($compress) { |
|
319 | + $output .= '"as": "aircraft.png",'; |
|
320 | + } else { |
|
321 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
322 | + } |
|
323 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
324 | + if ($compress) { |
|
325 | + $output .= '"as": "aircraft.png",'; |
|
326 | + } else { |
|
327 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
328 | + } |
|
329 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
330 | + if ($compress) { |
|
331 | + $output .= '"as": "helico.png",'; |
|
332 | + } else { |
|
333 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
334 | + } |
|
335 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
336 | + if ($compress) { |
|
337 | + $output .= '"as": "rail.png",'; |
|
338 | + } else { |
|
339 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
340 | + } |
|
341 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
342 | + if ($compress) { |
|
343 | + $output .= '"as": "firetruck.png",'; |
|
344 | + } else { |
|
345 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
346 | + } |
|
347 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
348 | + if ($compress) { |
|
349 | + $output .= '"as": "bus.png",'; |
|
350 | + } else { |
|
351 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
352 | + } |
|
353 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
354 | + if ($compress) { |
|
355 | + $output .= '"as": "phone.png",'; |
|
356 | + } else { |
|
357 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
358 | + } |
|
359 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
360 | + if ($compress) { |
|
361 | + $output .= '"as": "jogger.png",'; |
|
362 | + } else { |
|
363 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
364 | + } |
|
365 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
366 | + if ($compress) { |
|
367 | + $output .= '"as": "bike.png",'; |
|
368 | + } else { |
|
369 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
370 | + } |
|
371 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
372 | + if ($compress) { |
|
373 | + $output .= '"as": "motorcycle.png",'; |
|
374 | + } else { |
|
375 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
376 | + } |
|
377 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
378 | + if ($compress) { |
|
379 | + $output .= '"as": "balloon.png",'; |
|
380 | + } else { |
|
381 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
382 | + } |
|
383 | + } else { |
|
384 | + if ($compress) { |
|
385 | + $output .= '"as": "car.png",'; |
|
386 | + } else { |
|
387 | + $output .= '"aircraft_shadow": "car.png",'; |
|
388 | + } |
|
257 | 389 | } |
258 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
259 | - if ($compress) $output .= '"as": "truck.png",'; |
|
260 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
390 | + } elseif ($marine) { |
|
391 | + if ($compress) { |
|
392 | + $output .= '"as": "ship.png",'; |
|
393 | + } else { |
|
394 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
261 | 395 | } |
262 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
263 | - if ($compress) $output .= '"as": "truck.png",'; |
|
264 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
265 | - } |
|
266 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
267 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
268 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
269 | - } |
|
270 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
271 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
272 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
273 | - } |
|
274 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
275 | - if ($compress) $output .= '"as": "helico.png",'; |
|
276 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
277 | - } |
|
278 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
279 | - if ($compress) $output .= '"as": "rail.png",'; |
|
280 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
281 | - } |
|
282 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
283 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
284 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
285 | - } |
|
286 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
287 | - if ($compress) $output .= '"as": "bus.png",'; |
|
288 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
289 | - } |
|
290 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
291 | - if ($compress) $output .= '"as": "phone.png",'; |
|
292 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
293 | - } |
|
294 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
295 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
296 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
297 | - } |
|
298 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
299 | - if ($compress) $output .= '"as": "bike.png",'; |
|
300 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
301 | - } |
|
302 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
303 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
304 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
305 | - } |
|
306 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
307 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
308 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
309 | - } |
|
310 | - else { |
|
311 | - if ($compress) $output .= '"as": "car.png",'; |
|
312 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
396 | + } else { |
|
397 | + if ($compress) { |
|
398 | + $output .= '"as": "default.png",'; |
|
399 | + } else { |
|
400 | + $output .= '"aircraft_shadow": "default.png",'; |
|
313 | 401 | } |
314 | 402 | } |
315 | - elseif ($marine) { |
|
316 | - if ($compress) $output .= '"as": "ship.png",'; |
|
317 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
318 | - } |
|
319 | - else { |
|
320 | - if ($compress) $output .= '"as": "default.png",'; |
|
321 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
322 | - } |
|
323 | 403 | } else { |
324 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
325 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
404 | + if ($compress) { |
|
405 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
406 | + } else { |
|
407 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
408 | + } |
|
326 | 409 | } |
327 | 410 | |
328 | 411 | if (isset($spotter_item['date_iso_8601'])) { |
@@ -370,7 +453,9 @@ discard block |
||
370 | 453 | $output .= ']'; |
371 | 454 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
372 | 455 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
373 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
456 | + if (isset($begindate)) { |
|
457 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
458 | + } |
|
374 | 459 | $output .= '"fc": "'.$flightcnt.'"'; |
375 | 460 | } else { |
376 | 461 | $output .= '"features": '; |