@@ -18,27 +18,52 @@ discard block |
||
18 | 18 | } |
19 | 19 | header('Content-Type: text/javascript'); |
20 | 20 | |
21 | -if (!isset($globalJsonCompress)) $compress = true; |
|
22 | -else $compress = $globalJsonCompress; |
|
21 | +if (!isset($globalJsonCompress)) { |
|
22 | + $compress = true; |
|
23 | +} else { |
|
24 | + $compress = $globalJsonCompress; |
|
25 | +} |
|
23 | 26 | |
24 | 27 | $from_archive = false; |
25 | 28 | $min = true; |
26 | 29 | $allhistory = false; |
27 | 30 | $filter['source'] = array(); |
28 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
29 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
30 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
31 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
32 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
33 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
34 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
35 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
36 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
37 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
31 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
32 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
33 | +} |
|
34 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
35 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
36 | +} |
|
37 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
38 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
39 | +} |
|
40 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
41 | + $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
42 | +} |
|
43 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
44 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
45 | +} |
|
46 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
47 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
48 | +} |
|
49 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
50 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
51 | +} |
|
52 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
53 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
54 | +} |
|
55 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
56 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
57 | +} |
|
58 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
59 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
60 | +} |
|
38 | 61 | |
39 | 62 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
40 | 63 | $min = true; |
41 | -} else $min = false; |
|
64 | +} else { |
|
65 | + $min = false; |
|
66 | +} |
|
42 | 67 | |
43 | 68 | if (isset($_GET['ident'])) { |
44 | 69 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
@@ -88,20 +113,30 @@ discard block |
||
88 | 113 | } |
89 | 114 | */ |
90 | 115 | $flightcnt = count($spotter_array); |
91 | - if ($flightcnt == '') $flightcnt = 0; |
|
92 | -} else $flightcnt = 0; |
|
116 | + if ($flightcnt == '') { |
|
117 | + $flightcnt = 0; |
|
118 | + } |
|
119 | + } else { |
|
120 | + $flightcnt = 0; |
|
121 | +} |
|
93 | 122 | |
94 | 123 | $sqltime = round(microtime(true)-$begintime,2); |
95 | 124 | |
96 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
97 | -else $usenextlatlon = true; |
|
125 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
126 | + $usenextlatlon = false; |
|
127 | +} else { |
|
128 | + $usenextlatlon = true; |
|
129 | +} |
|
98 | 130 | $j = 0; |
99 | 131 | $prev_flightaware_id = ''; |
100 | 132 | $aircrafts_shadow = array(); |
101 | 133 | $output = '{'; |
102 | 134 | $output .= '"type": "FeatureCollection",'; |
103 | - if ($min) $output .= '"minimal": "true",'; |
|
104 | - else $output .= '"minimal": "false",'; |
|
135 | + if ($min) { |
|
136 | + $output .= '"minimal": "true",'; |
|
137 | + } else { |
|
138 | + $output .= '"minimal": "false",'; |
|
139 | + } |
|
105 | 140 | $output .= '"fc": "'.$flightcnt.'",'; |
106 | 141 | $output .= '"sqt": "'.$sqltime.'",'; |
107 | 142 | |
@@ -138,11 +173,16 @@ discard block |
||
138 | 173 | //$output .= '"sqt": "'.$sqltime.'",'; |
139 | 174 | $output .= '"id": "'.$spotter_item['flightaware_id'].'",'; |
140 | 175 | $output .= '"properties": {'; |
141 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
142 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
176 | + if ($compress) { |
|
177 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
178 | + } else { |
|
179 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
180 | + } |
|
143 | 181 | $output .= '"fc": "'.$flightcnt.'",'; |
144 | 182 | $output .= '"sqt": "'.$sqltime.'",'; |
145 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
183 | + if (isset($begindate)) { |
|
184 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
185 | + } |
|
146 | 186 | |
147 | 187 | /* |
148 | 188 | if ($min) $output .= '"minimal": "true",'; |
@@ -150,13 +190,21 @@ discard block |
||
150 | 190 | */ |
151 | 191 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
152 | 192 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
153 | - if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
154 | - else $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
193 | + if ($compress) { |
|
194 | + $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
195 | + } else { |
|
196 | + $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
197 | + } |
|
155 | 198 | } else { |
156 | - if ($compress) $output .= '"c": "NA",'; |
|
157 | - else $output .= '"callsign": "NA",'; |
|
199 | + if ($compress) { |
|
200 | + $output .= '"c": "NA",'; |
|
201 | + } else { |
|
202 | + $output .= '"callsign": "NA",'; |
|
203 | + } |
|
204 | + } |
|
205 | + if (isset($spotter_item['registration'])) { |
|
206 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
158 | 207 | } |
159 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
160 | 208 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
161 | 209 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
162 | 210 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -169,25 +217,37 @@ discard block |
||
169 | 217 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
170 | 218 | } |
171 | 219 | if (!isset($spotter_item['aircraft_shadow'])) { |
172 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
173 | - else { |
|
220 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
221 | + $spotter_item['aircraft_shadow'] = ''; |
|
222 | + } else { |
|
174 | 223 | $aircraft_icao = $spotter_item['aircraft_icao']; |
175 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
176 | - else { |
|
224 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
225 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
226 | + } else { |
|
177 | 227 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
178 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
179 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
180 | - else $spotter_item['aircraft_shadow'] = ''; |
|
228 | + if (count($aircraft_info) > 0) { |
|
229 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
230 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
231 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
232 | + } else { |
|
233 | + $spotter_item['aircraft_shadow'] = ''; |
|
234 | + } |
|
181 | 235 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
182 | 236 | } |
183 | 237 | } |
184 | 238 | } |
185 | 239 | if ($spotter_item['aircraft_shadow'] == '') { |
186 | - if ($compress) $output .= '"as": "default.png",'; |
|
187 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
240 | + if ($compress) { |
|
241 | + $output .= '"as": "default.png",'; |
|
242 | + } else { |
|
243 | + $output .= '"aircraft_shadow": "default.png",'; |
|
244 | + } |
|
188 | 245 | } else { |
189 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
190 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
246 | + if ($compress) { |
|
247 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
248 | + } else { |
|
249 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
250 | + } |
|
191 | 251 | } |
192 | 252 | if (isset($spotter_item['airline_name'])) { |
193 | 253 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -195,8 +255,11 @@ discard block |
||
195 | 255 | $output .= '"airline_name": "NA",'; |
196 | 256 | } |
197 | 257 | if (isset($spotter_item['departure_airport'])) { |
198 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
199 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
258 | + if ($compress) { |
|
259 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
260 | + } else { |
|
261 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
262 | + } |
|
200 | 263 | } |
201 | 264 | if (isset($spotter_item['departure_airport_city'])) { |
202 | 265 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -208,8 +271,11 @@ discard block |
||
208 | 271 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
209 | 272 | } |
210 | 273 | if (isset($spotter_item['arrival_airport'])) { |
211 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
212 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
274 | + if ($compress) { |
|
275 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
276 | + } else { |
|
277 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
278 | + } |
|
213 | 279 | } |
214 | 280 | if (isset($spotter_item['arrival_airport_city'])) { |
215 | 281 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -227,10 +293,16 @@ discard block |
||
227 | 293 | $output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",'; |
228 | 294 | } |
229 | 295 | |
230 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
231 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
232 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
233 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
296 | + if ($compress) { |
|
297 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
298 | + } else { |
|
299 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
300 | + } |
|
301 | + if ($compress) { |
|
302 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
303 | + } else { |
|
304 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
305 | + } |
|
234 | 306 | |
235 | 307 | if (isset($archivespeed)) { |
236 | 308 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
@@ -240,7 +312,9 @@ discard block |
||
240 | 312 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
241 | 313 | } |
242 | 314 | |
243 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
315 | + if (!$min) { |
|
316 | + $output .= '"image": "'.$image.'",'; |
|
317 | + } |
|
244 | 318 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
245 | 319 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
246 | 320 | } |
@@ -248,8 +322,11 @@ discard block |
||
248 | 322 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
249 | 323 | } |
250 | 324 | if (isset($spotter_item['squawk'])) { |
251 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
252 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
325 | + if ($compress) { |
|
326 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
327 | + } else { |
|
328 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
329 | + } |
|
253 | 330 | } |
254 | 331 | if (isset($spotter_item['squawk_usage'])) { |
255 | 332 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -267,8 +344,11 @@ discard block |
||
267 | 344 | $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
268 | 345 | } |
269 | 346 | // type when not aircraft ? |
270 | - if ($compress) $output .= '"t": "aircraft"'; |
|
271 | - else $output .= '"type": "aircraft"'; |
|
347 | + if ($compress) { |
|
348 | + $output .= '"t": "aircraft"'; |
|
349 | + } else { |
|
350 | + $output .= '"type": "aircraft"'; |
|
351 | + } |
|
272 | 352 | $output .= '},'; |
273 | 353 | $output .= '"geometry": {'; |
274 | 354 | $output .= '"type": "Point",'; |
@@ -335,7 +415,9 @@ discard block |
||
335 | 415 | } |
336 | 416 | */ |
337 | 417 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
338 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
418 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
419 | + $history = $_COOKIE['history']; |
|
420 | + } |
|
339 | 421 | |
340 | 422 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
341 | 423 | || (!isset($_COOKIE['flightpath']) |
@@ -357,8 +439,11 @@ discard block |
||
357 | 439 | $output_history .= ']}},'; |
358 | 440 | $output .= $output_history; |
359 | 441 | } |
360 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
361 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
442 | + if ($compress) { |
|
443 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
444 | + } else { |
|
445 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
446 | + } |
|
362 | 447 | } |
363 | 448 | $output_history .= '['; |
364 | 449 | $output_history .= $spotter_history['longitude'].', '; |
@@ -404,7 +489,9 @@ discard block |
||
404 | 489 | $output .= ']'; |
405 | 490 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
406 | 491 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
407 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
492 | + if (isset($begindate)) { |
|
493 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
494 | + } |
|
408 | 495 | $output .= '"fc": "'.$j.'"'; |
409 | 496 | } else { |
410 | 497 | $output .= '"features": '; |
@@ -258,7 +258,9 @@ discard block |
||
258 | 258 | // Update table countries |
259 | 259 | if ($Connection->tableExists('airspace')) { |
260 | 260 | $error .= update_db::update_countries(); |
261 | - if ($error != '') return $error; |
|
261 | + if ($error != '') { |
|
262 | + return $error; |
|
263 | + } |
|
262 | 264 | } |
263 | 265 | // Update schema_version to 7 |
264 | 266 | $query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'"; |
@@ -314,7 +316,9 @@ discard block |
||
314 | 316 | $error = ''; |
315 | 317 | // Update table aircraft |
316 | 318 | $error .= create_db::import_file('../db/source_location.sql'); |
317 | - if ($error != '') return $error; |
|
319 | + if ($error != '') { |
|
320 | + return $error; |
|
321 | + } |
|
318 | 322 | // Update schema_version to 6 |
319 | 323 | $query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'"; |
320 | 324 | try { |
@@ -331,7 +335,9 @@ discard block |
||
331 | 335 | $error = ''; |
332 | 336 | // Update table aircraft |
333 | 337 | $error .= create_db::import_file('../db/notam.sql'); |
334 | - if ($error != '') return $error; |
|
338 | + if ($error != '') { |
|
339 | + return $error; |
|
340 | + } |
|
335 | 341 | $query = "DELETE FROM config WHERE name = 'last_update_db'; |
336 | 342 | INSERT INTO config (name,value) VALUES ('last_update_db',NOW()); |
337 | 343 | DELETE FROM config WHERE name = 'last_update_notam_db'; |
@@ -365,7 +371,9 @@ discard block |
||
365 | 371 | $error = ''; |
366 | 372 | // Update table atc |
367 | 373 | $error .= create_db::import_file('../db/atc.sql'); |
368 | - if ($error != '') return $error; |
|
374 | + if ($error != '') { |
|
375 | + return $error; |
|
376 | + } |
|
369 | 377 | |
370 | 378 | $query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'"; |
371 | 379 | try { |
@@ -389,13 +397,21 @@ discard block |
||
389 | 397 | $error = ''; |
390 | 398 | // Add tables |
391 | 399 | $error .= create_db::import_file('../db/aircraft_owner.sql'); |
392 | - if ($error != '') return $error; |
|
400 | + if ($error != '') { |
|
401 | + return $error; |
|
402 | + } |
|
393 | 403 | $error .= create_db::import_file('../db/metar.sql'); |
394 | - if ($error != '') return $error; |
|
404 | + if ($error != '') { |
|
405 | + return $error; |
|
406 | + } |
|
395 | 407 | $error .= create_db::import_file('../db/taf.sql'); |
396 | - if ($error != '') return $error; |
|
408 | + if ($error != '') { |
|
409 | + return $error; |
|
410 | + } |
|
397 | 411 | $error .= create_db::import_file('../db/airport.sql'); |
398 | - if ($error != '') return $error; |
|
412 | + if ($error != '') { |
|
413 | + return $error; |
|
414 | + } |
|
399 | 415 | |
400 | 416 | $query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'"; |
401 | 417 | try { |
@@ -469,19 +485,33 @@ discard block |
||
469 | 485 | $error = ''; |
470 | 486 | // Add tables |
471 | 487 | $error .= create_db::import_file('../db/stats.sql'); |
472 | - if ($error != '') return $error; |
|
488 | + if ($error != '') { |
|
489 | + return $error; |
|
490 | + } |
|
473 | 491 | $error .= create_db::import_file('../db/stats_aircraft.sql'); |
474 | - if ($error != '') return $error; |
|
492 | + if ($error != '') { |
|
493 | + return $error; |
|
494 | + } |
|
475 | 495 | $error .= create_db::import_file('../db/stats_airline.sql'); |
476 | - if ($error != '') return $error; |
|
496 | + if ($error != '') { |
|
497 | + return $error; |
|
498 | + } |
|
477 | 499 | $error .= create_db::import_file('../db/stats_airport.sql'); |
478 | - if ($error != '') return $error; |
|
500 | + if ($error != '') { |
|
501 | + return $error; |
|
502 | + } |
|
479 | 503 | $error .= create_db::import_file('../db/stats_owner.sql'); |
480 | - if ($error != '') return $error; |
|
504 | + if ($error != '') { |
|
505 | + return $error; |
|
506 | + } |
|
481 | 507 | $error .= create_db::import_file('../db/stats_pilot.sql'); |
482 | - if ($error != '') return $error; |
|
508 | + if ($error != '') { |
|
509 | + return $error; |
|
510 | + } |
|
483 | 511 | $error .= create_db::import_file('../db/spotter_archive_output.sql'); |
484 | - if ($error != '') return $error; |
|
512 | + if ($error != '') { |
|
513 | + return $error; |
|
514 | + } |
|
485 | 515 | |
486 | 516 | $query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'"; |
487 | 517 | try { |
@@ -521,7 +551,9 @@ discard block |
||
521 | 551 | // Add tables |
522 | 552 | if (!$Connection->tableExists('stats_flight')) { |
523 | 553 | $error .= create_db::import_file('../db/stats_flight.sql'); |
524 | - if ($error != '') return $error; |
|
554 | + if ($error != '') { |
|
555 | + return $error; |
|
556 | + } |
|
525 | 557 | } |
526 | 558 | $query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'"; |
527 | 559 | try { |
@@ -545,7 +577,9 @@ discard block |
||
545 | 577 | } catch(PDOException $e) { |
546 | 578 | return "error (update stats) : ".$e->getMessage()."\n"; |
547 | 579 | } |
548 | - if ($error != '') return $error; |
|
580 | + if ($error != '') { |
|
581 | + return $error; |
|
582 | + } |
|
549 | 583 | $query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'"; |
550 | 584 | try { |
551 | 585 | $sth = $Connection->db->prepare($query); |
@@ -566,7 +600,9 @@ discard block |
||
566 | 600 | if (!$Connection->tableExists('stats_callsign')) { |
567 | 601 | $error .= create_db::import_file('../db/stats_callsign.sql'); |
568 | 602 | } |
569 | - if ($error != '') return $error; |
|
603 | + if ($error != '') { |
|
604 | + return $error; |
|
605 | + } |
|
570 | 606 | $query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'"; |
571 | 607 | try { |
572 | 608 | $sth = $Connection->db->prepare($query); |
@@ -584,7 +620,9 @@ discard block |
||
584 | 620 | if (!$Connection->tableExists('stats_country')) { |
585 | 621 | $error .= create_db::import_file('../db/stats_country.sql'); |
586 | 622 | } |
587 | - if ($error != '') return $error; |
|
623 | + if ($error != '') { |
|
624 | + return $error; |
|
625 | + } |
|
588 | 626 | $query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'"; |
589 | 627 | try { |
590 | 628 | $sth = $Connection->db->prepare($query); |
@@ -607,7 +645,9 @@ discard block |
||
607 | 645 | return "error (update stats) : ".$e->getMessage()."\n"; |
608 | 646 | } |
609 | 647 | } |
610 | - if ($error != '') return $error; |
|
648 | + if ($error != '') { |
|
649 | + return $error; |
|
650 | + } |
|
611 | 651 | $query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'"; |
612 | 652 | try { |
613 | 653 | $sth = $Connection->db->prepare($query); |
@@ -623,7 +663,9 @@ discard block |
||
623 | 663 | $error = ''; |
624 | 664 | // Update airport table |
625 | 665 | $error .= create_db::import_file('../db/airport.sql'); |
626 | - if ($error != '') return 'Import airport.sql : '.$error; |
|
666 | + if ($error != '') { |
|
667 | + return 'Import airport.sql : '.$error; |
|
668 | + } |
|
627 | 669 | // Remove primary key on Spotter_Archive |
628 | 670 | $query = "alter table spotter_archive drop spotter_archive_id"; |
629 | 671 | try { |
@@ -699,7 +741,9 @@ discard block |
||
699 | 741 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
700 | 742 | } |
701 | 743 | } |
702 | - if ($error != '') return $error; |
|
744 | + if ($error != '') { |
|
745 | + return $error; |
|
746 | + } |
|
703 | 747 | $query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'"; |
704 | 748 | try { |
705 | 749 | $sth = $Connection->db->prepare($query); |
@@ -717,7 +761,9 @@ discard block |
||
717 | 761 | // Update airline table |
718 | 762 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
719 | 763 | $error .= create_db::import_file('../db/airlines.sql'); |
720 | - if ($error != '') return 'Import airlines.sql : '.$error; |
|
764 | + if ($error != '') { |
|
765 | + return 'Import airlines.sql : '.$error; |
|
766 | + } |
|
721 | 767 | } |
722 | 768 | if (!$Connection->checkColumnName('aircraft_modes','type_flight')) { |
723 | 769 | // Add column over_country |
@@ -729,7 +775,9 @@ discard block |
||
729 | 775 | return "error (add over_country) : ".$e->getMessage()."\n"; |
730 | 776 | } |
731 | 777 | } |
732 | - if ($error != '') return $error; |
|
778 | + if ($error != '') { |
|
779 | + return $error; |
|
780 | + } |
|
733 | 781 | /* |
734 | 782 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
735 | 783 | // Force update ModeS (this will put type_flight data |
@@ -759,7 +807,9 @@ discard block |
||
759 | 807 | } catch(PDOException $e) { |
760 | 808 | return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n"; |
761 | 809 | } |
762 | - if ($error != '') return $error; |
|
810 | + if ($error != '') { |
|
811 | + return $error; |
|
812 | + } |
|
763 | 813 | } |
764 | 814 | $query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'"; |
765 | 815 | try { |
@@ -782,7 +832,9 @@ discard block |
||
782 | 832 | } else { |
783 | 833 | $error .= create_db::import_file('../db/pgsql/stats_source.sql'); |
784 | 834 | } |
785 | - if ($error != '') return $error; |
|
835 | + if ($error != '') { |
|
836 | + return $error; |
|
837 | + } |
|
786 | 838 | } |
787 | 839 | $query = "UPDATE config SET value = '23' WHERE name = 'schema_version'"; |
788 | 840 | try { |
@@ -804,12 +856,16 @@ discard block |
||
804 | 856 | if ($globalDBdriver == 'mysql') { |
805 | 857 | if (!$Connection->tableExists('tle')) { |
806 | 858 | $error .= create_db::import_file('../db/tle.sql'); |
807 | - if ($error != '') return $error; |
|
859 | + if ($error != '') { |
|
860 | + return $error; |
|
861 | + } |
|
808 | 862 | } |
809 | 863 | } else { |
810 | 864 | if (!$Connection->tableExists('tle')) { |
811 | 865 | $error .= create_db::import_file('../db/pgsql/tle.sql'); |
812 | - if ($error != '') return $error; |
|
866 | + if ($error != '') { |
|
867 | + return $error; |
|
868 | + } |
|
813 | 869 | } |
814 | 870 | $query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)"; |
815 | 871 | try { |
@@ -849,7 +905,9 @@ discard block |
||
849 | 905 | } else { |
850 | 906 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
851 | 907 | } |
852 | - if ($error != '') return 'Import airlines.sql : '.$error; |
|
908 | + if ($error != '') { |
|
909 | + return 'Import airlines.sql : '.$error; |
|
910 | + } |
|
853 | 911 | if (!$Connection->checkColumnName('airlines','forsource')) { |
854 | 912 | // Add forsource to airlines |
855 | 913 | $query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL"; |
@@ -1332,20 +1390,28 @@ discard block |
||
1332 | 1390 | } |
1333 | 1391 | if ($globalDBdriver == 'mysql') { |
1334 | 1392 | $error .= create_db::import_file('../db/airlines.sql'); |
1335 | - if ($error != '') return $error; |
|
1393 | + if ($error != '') { |
|
1394 | + return $error; |
|
1395 | + } |
|
1336 | 1396 | } else { |
1337 | 1397 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
1338 | - if ($error != '') return $error; |
|
1398 | + if ($error != '') { |
|
1399 | + return $error; |
|
1400 | + } |
|
1339 | 1401 | } |
1340 | 1402 | if ((isset($globalVATSIM) && $globalVATSIM) || (isset($globalIVAO) && $globalIVAO)) { |
1341 | 1403 | include_once('class/class.update_db.php'); |
1342 | 1404 | if (isset($globalVATSIM) && $globalVATSIM) { |
1343 | 1405 | $error .= update_db::update_vatsim(); |
1344 | - if ($error != '') return $error; |
|
1406 | + if ($error != '') { |
|
1407 | + return $error; |
|
1408 | + } |
|
1345 | 1409 | } |
1346 | 1410 | if (isset($globalIVAO) && $globalIVAO && file_exists('tmp/ivae_feb2013.zip')) { |
1347 | 1411 | $error .= update_db::update_IVAO(); |
1348 | - if ($error != '') return $error; |
|
1412 | + if ($error != '') { |
|
1413 | + return $error; |
|
1414 | + } |
|
1349 | 1415 | } |
1350 | 1416 | } |
1351 | 1417 | |
@@ -1367,8 +1433,11 @@ discard block |
||
1367 | 1433 | if ($Connection->tableExists('aircraft')) { |
1368 | 1434 | if (!$Connection->tableExists('config')) { |
1369 | 1435 | $version = '1'; |
1370 | - if ($update) return self::update_from_1(); |
|
1371 | - else return $version; |
|
1436 | + if ($update) { |
|
1437 | + return self::update_from_1(); |
|
1438 | + } else { |
|
1439 | + return $version; |
|
1440 | + } |
|
1372 | 1441 | } else { |
1373 | 1442 | $Connection = new Connection(); |
1374 | 1443 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
@@ -1382,134 +1451,232 @@ discard block |
||
1382 | 1451 | if ($update) { |
1383 | 1452 | if ($result['value'] == '2') { |
1384 | 1453 | $error = self::update_from_2(); |
1385 | - if ($error != '') return $error; |
|
1386 | - else return self::check_version(true); |
|
1454 | + if ($error != '') { |
|
1455 | + return $error; |
|
1456 | + } else { |
|
1457 | + return self::check_version(true); |
|
1458 | + } |
|
1387 | 1459 | } elseif ($result['value'] == '3') { |
1388 | 1460 | $error = self::update_from_3(); |
1389 | - if ($error != '') return $error; |
|
1390 | - else return self::check_version(true); |
|
1461 | + if ($error != '') { |
|
1462 | + return $error; |
|
1463 | + } else { |
|
1464 | + return self::check_version(true); |
|
1465 | + } |
|
1391 | 1466 | } elseif ($result['value'] == '4') { |
1392 | 1467 | $error = self::update_from_4(); |
1393 | - if ($error != '') return $error; |
|
1394 | - else return self::check_version(true); |
|
1468 | + if ($error != '') { |
|
1469 | + return $error; |
|
1470 | + } else { |
|
1471 | + return self::check_version(true); |
|
1472 | + } |
|
1395 | 1473 | } elseif ($result['value'] == '5') { |
1396 | 1474 | $error = self::update_from_5(); |
1397 | - if ($error != '') return $error; |
|
1398 | - else return self::check_version(true); |
|
1475 | + if ($error != '') { |
|
1476 | + return $error; |
|
1477 | + } else { |
|
1478 | + return self::check_version(true); |
|
1479 | + } |
|
1399 | 1480 | } elseif ($result['value'] == '6') { |
1400 | 1481 | $error = self::update_from_6(); |
1401 | - if ($error != '') return $error; |
|
1402 | - else return self::check_version(true); |
|
1482 | + if ($error != '') { |
|
1483 | + return $error; |
|
1484 | + } else { |
|
1485 | + return self::check_version(true); |
|
1486 | + } |
|
1403 | 1487 | } elseif ($result['value'] == '7') { |
1404 | 1488 | $error = self::update_from_7(); |
1405 | - if ($error != '') return $error; |
|
1406 | - else return self::check_version(true); |
|
1489 | + if ($error != '') { |
|
1490 | + return $error; |
|
1491 | + } else { |
|
1492 | + return self::check_version(true); |
|
1493 | + } |
|
1407 | 1494 | } elseif ($result['value'] == '8') { |
1408 | 1495 | $error = self::update_from_8(); |
1409 | - if ($error != '') return $error; |
|
1410 | - else return self::check_version(true); |
|
1496 | + if ($error != '') { |
|
1497 | + return $error; |
|
1498 | + } else { |
|
1499 | + return self::check_version(true); |
|
1500 | + } |
|
1411 | 1501 | } elseif ($result['value'] == '9') { |
1412 | 1502 | $error = self::update_from_9(); |
1413 | - if ($error != '') return $error; |
|
1414 | - else return self::check_version(true); |
|
1503 | + if ($error != '') { |
|
1504 | + return $error; |
|
1505 | + } else { |
|
1506 | + return self::check_version(true); |
|
1507 | + } |
|
1415 | 1508 | } elseif ($result['value'] == '10') { |
1416 | 1509 | $error = self::update_from_10(); |
1417 | - if ($error != '') return $error; |
|
1418 | - else return self::check_version(true); |
|
1510 | + if ($error != '') { |
|
1511 | + return $error; |
|
1512 | + } else { |
|
1513 | + return self::check_version(true); |
|
1514 | + } |
|
1419 | 1515 | } elseif ($result['value'] == '11') { |
1420 | 1516 | $error = self::update_from_11(); |
1421 | - if ($error != '') return $error; |
|
1422 | - else return self::check_version(true); |
|
1517 | + if ($error != '') { |
|
1518 | + return $error; |
|
1519 | + } else { |
|
1520 | + return self::check_version(true); |
|
1521 | + } |
|
1423 | 1522 | } elseif ($result['value'] == '12') { |
1424 | 1523 | $error = self::update_from_12(); |
1425 | - if ($error != '') return $error; |
|
1426 | - else return self::check_version(true); |
|
1524 | + if ($error != '') { |
|
1525 | + return $error; |
|
1526 | + } else { |
|
1527 | + return self::check_version(true); |
|
1528 | + } |
|
1427 | 1529 | } elseif ($result['value'] == '13') { |
1428 | 1530 | $error = self::update_from_13(); |
1429 | - if ($error != '') return $error; |
|
1430 | - else return self::check_version(true); |
|
1531 | + if ($error != '') { |
|
1532 | + return $error; |
|
1533 | + } else { |
|
1534 | + return self::check_version(true); |
|
1535 | + } |
|
1431 | 1536 | } elseif ($result['value'] == '14') { |
1432 | 1537 | $error = self::update_from_14(); |
1433 | - if ($error != '') return $error; |
|
1434 | - else return self::check_version(true); |
|
1538 | + if ($error != '') { |
|
1539 | + return $error; |
|
1540 | + } else { |
|
1541 | + return self::check_version(true); |
|
1542 | + } |
|
1435 | 1543 | } elseif ($result['value'] == '15') { |
1436 | 1544 | $error = self::update_from_15(); |
1437 | - if ($error != '') return $error; |
|
1438 | - else return self::check_version(true); |
|
1545 | + if ($error != '') { |
|
1546 | + return $error; |
|
1547 | + } else { |
|
1548 | + return self::check_version(true); |
|
1549 | + } |
|
1439 | 1550 | } elseif ($result['value'] == '16') { |
1440 | 1551 | $error = self::update_from_16(); |
1441 | - if ($error != '') return $error; |
|
1442 | - else return self::check_version(true); |
|
1552 | + if ($error != '') { |
|
1553 | + return $error; |
|
1554 | + } else { |
|
1555 | + return self::check_version(true); |
|
1556 | + } |
|
1443 | 1557 | } elseif ($result['value'] == '17') { |
1444 | 1558 | $error = self::update_from_17(); |
1445 | - if ($error != '') return $error; |
|
1446 | - else return self::check_version(true); |
|
1559 | + if ($error != '') { |
|
1560 | + return $error; |
|
1561 | + } else { |
|
1562 | + return self::check_version(true); |
|
1563 | + } |
|
1447 | 1564 | } elseif ($result['value'] == '18') { |
1448 | 1565 | $error = self::update_from_18(); |
1449 | - if ($error != '') return $error; |
|
1450 | - else return self::check_version(true); |
|
1566 | + if ($error != '') { |
|
1567 | + return $error; |
|
1568 | + } else { |
|
1569 | + return self::check_version(true); |
|
1570 | + } |
|
1451 | 1571 | } elseif ($result['value'] == '19') { |
1452 | 1572 | $error = self::update_from_19(); |
1453 | - if ($error != '') return $error; |
|
1454 | - else return self::check_version(true); |
|
1573 | + if ($error != '') { |
|
1574 | + return $error; |
|
1575 | + } else { |
|
1576 | + return self::check_version(true); |
|
1577 | + } |
|
1455 | 1578 | } elseif ($result['value'] == '20') { |
1456 | 1579 | $error = self::update_from_20(); |
1457 | - if ($error != '') return $error; |
|
1458 | - else return self::check_version(true); |
|
1580 | + if ($error != '') { |
|
1581 | + return $error; |
|
1582 | + } else { |
|
1583 | + return self::check_version(true); |
|
1584 | + } |
|
1459 | 1585 | } elseif ($result['value'] == '21') { |
1460 | 1586 | $error = self::update_from_21(); |
1461 | - if ($error != '') return $error; |
|
1462 | - else return self::check_version(true); |
|
1587 | + if ($error != '') { |
|
1588 | + return $error; |
|
1589 | + } else { |
|
1590 | + return self::check_version(true); |
|
1591 | + } |
|
1463 | 1592 | } elseif ($result['value'] == '22') { |
1464 | 1593 | $error = self::update_from_22(); |
1465 | - if ($error != '') return $error; |
|
1466 | - else return self::check_version(true); |
|
1594 | + if ($error != '') { |
|
1595 | + return $error; |
|
1596 | + } else { |
|
1597 | + return self::check_version(true); |
|
1598 | + } |
|
1467 | 1599 | } elseif ($result['value'] == '23') { |
1468 | 1600 | $error = self::update_from_23(); |
1469 | - if ($error != '') return $error; |
|
1470 | - else return self::check_version(true); |
|
1601 | + if ($error != '') { |
|
1602 | + return $error; |
|
1603 | + } else { |
|
1604 | + return self::check_version(true); |
|
1605 | + } |
|
1471 | 1606 | } elseif ($result['value'] == '24') { |
1472 | 1607 | $error = self::update_from_24(); |
1473 | - if ($error != '') return $error; |
|
1474 | - else return self::check_version(true); |
|
1608 | + if ($error != '') { |
|
1609 | + return $error; |
|
1610 | + } else { |
|
1611 | + return self::check_version(true); |
|
1612 | + } |
|
1475 | 1613 | } elseif ($result['value'] == '25') { |
1476 | 1614 | $error = self::update_from_25(); |
1477 | - if ($error != '') return $error; |
|
1478 | - else return self::check_version(true); |
|
1615 | + if ($error != '') { |
|
1616 | + return $error; |
|
1617 | + } else { |
|
1618 | + return self::check_version(true); |
|
1619 | + } |
|
1479 | 1620 | } elseif ($result['value'] == '26') { |
1480 | 1621 | $error = self::update_from_26(); |
1481 | - if ($error != '') return $error; |
|
1482 | - else return self::check_version(true); |
|
1622 | + if ($error != '') { |
|
1623 | + return $error; |
|
1624 | + } else { |
|
1625 | + return self::check_version(true); |
|
1626 | + } |
|
1483 | 1627 | } elseif ($result['value'] == '27') { |
1484 | 1628 | $error = self::update_from_27(); |
1485 | - if ($error != '') return $error; |
|
1486 | - else return self::check_version(true); |
|
1629 | + if ($error != '') { |
|
1630 | + return $error; |
|
1631 | + } else { |
|
1632 | + return self::check_version(true); |
|
1633 | + } |
|
1487 | 1634 | } elseif ($result['value'] == '28') { |
1488 | 1635 | $error = self::update_from_28(); |
1489 | - if ($error != '') return $error; |
|
1490 | - else return self::check_version(true); |
|
1636 | + if ($error != '') { |
|
1637 | + return $error; |
|
1638 | + } else { |
|
1639 | + return self::check_version(true); |
|
1640 | + } |
|
1491 | 1641 | } elseif ($result['value'] == '29') { |
1492 | 1642 | $error = self::update_from_29(); |
1493 | - if ($error != '') return $error; |
|
1494 | - else return self::check_version(true); |
|
1643 | + if ($error != '') { |
|
1644 | + return $error; |
|
1645 | + } else { |
|
1646 | + return self::check_version(true); |
|
1647 | + } |
|
1495 | 1648 | } elseif ($result['value'] == '30') { |
1496 | 1649 | $error = self::update_from_30(); |
1497 | - if ($error != '') return $error; |
|
1498 | - else return self::check_version(true); |
|
1650 | + if ($error != '') { |
|
1651 | + return $error; |
|
1652 | + } else { |
|
1653 | + return self::check_version(true); |
|
1654 | + } |
|
1499 | 1655 | } elseif ($result['value'] == '31') { |
1500 | 1656 | $error = self::update_from_31(); |
1501 | - if ($error != '') return $error; |
|
1502 | - else return self::check_version(true); |
|
1657 | + if ($error != '') { |
|
1658 | + return $error; |
|
1659 | + } else { |
|
1660 | + return self::check_version(true); |
|
1661 | + } |
|
1503 | 1662 | } elseif ($result['value'] == '32') { |
1504 | 1663 | $error = self::update_from_32(); |
1505 | - if ($error != '') return $error; |
|
1506 | - else return self::check_version(true); |
|
1507 | - } else return ''; |
|
1664 | + if ($error != '') { |
|
1665 | + return $error; |
|
1666 | + } else { |
|
1667 | + return self::check_version(true); |
|
1668 | + } |
|
1669 | + } else { |
|
1670 | + return ''; |
|
1671 | + } |
|
1672 | + } else { |
|
1673 | + return $result['value']; |
|
1508 | 1674 | } |
1509 | - else return $result['value']; |
|
1510 | 1675 | } |
1511 | 1676 | |
1512 | - } else return $version; |
|
1677 | + } else { |
|
1678 | + return $version; |
|
1679 | + } |
|
1513 | 1680 | } |
1514 | 1681 | |
1515 | 1682 | } |
@@ -5,8 +5,11 @@ discard block |
||
5 | 5 | setcookie("MapFormat",'2d'); |
6 | 6 | |
7 | 7 | // Compressed GeoJson is used if true |
8 | -if (!isset($globalJsonCompress)) $compress = true; |
|
9 | -else $compress = $globalJsonCompress; |
|
8 | +if (!isset($globalJsonCompress)) { |
|
9 | + $compress = true; |
|
10 | +} else { |
|
11 | + $compress = $globalJsonCompress; |
|
12 | +} |
|
10 | 13 | if (isset($_GET['archive'])) { |
11 | 14 | //$archiveupdatetime = 50; |
12 | 15 | $archiveupdatetime = $globalMapRefresh; |
@@ -16,8 +19,11 @@ discard block |
||
16 | 19 | //$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10)); |
17 | 20 | //$lastupd = 20; |
18 | 21 | $lastupd = $_GET['archivespeed']*$archiveupdatetime; |
19 | - if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate']; |
|
20 | - else $enddate = time(); |
|
22 | + if (isset($_GET['enddate']) && $_GET['enddate'] != '') { |
|
23 | + $enddate = $_GET['enddate']; |
|
24 | + } else { |
|
25 | + $enddate = time(); |
|
26 | + } |
|
21 | 27 | setcookie("archive_begin",$begindate); |
22 | 28 | setcookie("archive_end",$enddate); |
23 | 29 | setcookie("archive_update",$lastupd); |
@@ -123,7 +129,17 @@ discard block |
||
123 | 129 | } |
124 | 130 | |
125 | 131 | //create the map |
126 | - map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom); |
|
132 | + map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) { |
|
133 | + print $latitude; |
|
134 | +} else { |
|
135 | + print $globalCenterLatitude; |
|
136 | +} |
|
137 | +?>,<?php if (isset($longitude)) { |
|
138 | + print $longitude; |
|
139 | +} else { |
|
140 | + print $globalCenterLongitude; |
|
141 | +} |
|
142 | +?>], zoom); |
|
127 | 143 | <?php |
128 | 144 | } else { |
129 | 145 | ?> |
@@ -136,9 +152,19 @@ discard block |
||
136 | 152 | || navigator.userAgent.match(/BlackBerry/i) |
137 | 153 | || navigator.userAgent.match(/Windows Phone/i)) |
138 | 154 | { |
139 | - var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>; |
|
155 | + var zoom = <?php if (isset($globalLiveZoom)) { |
|
156 | + print $globalLiveZoom-1; |
|
157 | +} else { |
|
158 | + print '8'; |
|
159 | +} |
|
160 | +?>; |
|
140 | 161 | } else { |
141 | - var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>; |
|
162 | + var zoom = <?php if (isset($globalLiveZoom)) { |
|
163 | + print $globalLiveZoom; |
|
164 | +} else { |
|
165 | + print '9'; |
|
166 | +} |
|
167 | +?>; |
|
142 | 168 | } |
143 | 169 | |
144 | 170 | //create the map |
@@ -163,16 +189,27 @@ discard block |
||
163 | 189 | bounds = L.latLngBounds(southWest,northEast); |
164 | 190 | //a few title layers |
165 | 191 | <?php |
166 | - if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType']; |
|
167 | - else $MapType = $globalMapProvider; |
|
192 | + if (isset($_COOKIE['MapType'])) { |
|
193 | + $MapType = $_COOKIE['MapType']; |
|
194 | + } else { |
|
195 | + $MapType = $globalMapProvider; |
|
196 | + } |
|
168 | 197 | |
169 | 198 | if ($MapType == 'Mapbox') { |
170 | - if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId; |
|
171 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
172 | -?> |
|
199 | + if ($_COOKIE['MapTypeId'] == 'default') { |
|
200 | + $MapBoxId = $globalMapboxId; |
|
201 | + } else { |
|
202 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
203 | + } |
|
204 | + ?> |
|
173 | 205 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
174 | 206 | maxZoom: 18, |
175 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
207 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
208 | + print 'false'; |
|
209 | +} else { |
|
210 | + print 'true'; |
|
211 | +} |
|
212 | +?>, |
|
176 | 213 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
177 | 214 | '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + |
178 | 215 | 'Imagery © <a href="http://mapbox.com">Mapbox</a>', |
@@ -184,7 +221,12 @@ discard block |
||
184 | 221 | ?> |
185 | 222 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
186 | 223 | maxZoom: 18, |
187 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
224 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
225 | + print 'false'; |
|
226 | +} else { |
|
227 | + print 'true'; |
|
228 | +} |
|
229 | +?>, |
|
188 | 230 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
189 | 231 | '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>' |
190 | 232 | }).addTo(map); |
@@ -230,20 +272,26 @@ discard block |
||
230 | 272 | map.addLayer(yandexLayer); |
231 | 273 | <?php |
232 | 274 | } elseif ($MapType == 'Bing-Aerial') { |
233 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
234 | -?> |
|
275 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
276 | + setcookie('MapType','OpenStreetMap'); |
|
277 | + } |
|
278 | + ?> |
|
235 | 279 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'}); |
236 | 280 | map.addLayer(bingLayer); |
237 | 281 | <?php |
238 | 282 | } elseif ($MapType == 'Bing-Hybrid') { |
239 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
240 | -?> |
|
283 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
284 | + setcookie('MapType','OpenStreetMap'); |
|
285 | + } |
|
286 | + ?> |
|
241 | 287 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'}); |
242 | 288 | map.addLayer(bingLayer); |
243 | 289 | <?php |
244 | 290 | } elseif ($MapType == 'Bing-Road') { |
245 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
246 | -?> |
|
291 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
292 | + setcookie('MapType','OpenStreetMap'); |
|
293 | + } |
|
294 | + ?> |
|
247 | 295 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'}); |
248 | 296 | map.addLayer(bingLayer); |
249 | 297 | <?php |
@@ -291,7 +339,12 @@ discard block |
||
291 | 339 | } |
292 | 340 | } elseif ($globalBounding == 'circle') { |
293 | 341 | ?> |
294 | - var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{ |
|
342 | + var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) { |
|
343 | + print $globalBoundingCircleSize; |
|
344 | +} else { |
|
345 | + print '70000'; |
|
346 | +} |
|
347 | +?>,{ |
|
295 | 348 | color: '#92C7D1', |
296 | 349 | fillColor: '#92C7D1', |
297 | 350 | fillOpacity: 0.3, |
@@ -350,8 +403,11 @@ discard block |
||
350 | 403 | |
351 | 404 | function update_airportsLayer() { |
352 | 405 | <?php |
353 | - if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom']; |
|
354 | - else $getZoom = '7'; |
|
406 | + if (isset($_COOKIE['AirportZoom'])) { |
|
407 | + $getZoom = $_COOKIE['AirportZoom']; |
|
408 | + } else { |
|
409 | + $getZoom = '7'; |
|
410 | + } |
|
355 | 411 | ?> |
356 | 412 | //if (map.getZoom() <= <?php print $getZoom; ?>) { |
357 | 413 | if (typeof airportsLayer != 'undefined') { |
@@ -687,9 +743,13 @@ discard block |
||
687 | 743 | if (callsign != ""){ markerLabel += callsign; } |
688 | 744 | if (departure_airport_code != "" && arrival_airport_code != "" && departure_airport_code != "NA" && arrival_airport_code != "NA"){ markerLabel += ' ( '+departure_airport_code+' - '+arrival_airport_code+' )'; } |
689 | 745 | <?php |
690 | - if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor']; |
|
691 | - elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor; |
|
692 | - else $IconColor = '1a3151'; |
|
746 | + if (isset($_COOKIE['IconColor'])) { |
|
747 | + $IconColor = $_COOKIE['IconColor']; |
|
748 | + } elseif (isset($globalAircraftIconColor)) { |
|
749 | + $IconColor = $globalAircraftIconColor; |
|
750 | + } else { |
|
751 | + $IconColor = '1a3151'; |
|
752 | + } |
|
693 | 753 | if (!isset($ident) && !isset($flightaware_id)) { |
694 | 754 | ?> |
695 | 755 | info_update(feature.properties.fc); |
@@ -737,7 +797,12 @@ discard block |
||
737 | 797 | <?php |
738 | 798 | } else { |
739 | 799 | ?> |
740 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
800 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
801 | + print $archiveupdatetime*1000; |
|
802 | +} else { |
|
803 | + print $globalMapRefresh*1000+20000; |
|
804 | +} |
|
805 | +?>+feature.properties.sqt*1000); |
|
741 | 806 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
742 | 807 | <?php |
743 | 808 | } |
@@ -786,7 +851,12 @@ discard block |
||
786 | 851 | <?php |
787 | 852 | } else { |
788 | 853 | ?> |
789 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
854 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
855 | + print $archiveupdatetime*1000; |
|
856 | +} else { |
|
857 | + print $globalMapRefresh*1000+20000; |
|
858 | +} |
|
859 | +?>+feature.properties.sqt*1000); |
|
790 | 860 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
791 | 861 | <?php |
792 | 862 | } |
@@ -834,7 +904,12 @@ discard block |
||
834 | 904 | <?php |
835 | 905 | } else { |
836 | 906 | ?> |
837 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
907 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
908 | + print $archiveupdatetime*1000; |
|
909 | +} else { |
|
910 | + print $globalMapRefresh*1000+20000; |
|
911 | +} |
|
912 | +?>+feature.properties.sqt*1000); |
|
838 | 913 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
839 | 914 | <?php |
840 | 915 | } |
@@ -1177,14 +1252,24 @@ discard block |
||
1177 | 1252 | if (isset($_GET['archive'])) { |
1178 | 1253 | ?> |
1179 | 1254 | //then load it again every 30 seconds |
1180 | -// var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>); |
|
1255 | +// var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) { |
|
1256 | + print ($globalMapRefresh*1000)/2; |
|
1257 | +} else { |
|
1258 | + print '15000'; |
|
1259 | +} |
|
1260 | +?>); |
|
1181 | 1261 | reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php print $archiveupdatetime*1000; ?>); |
1182 | 1262 | <?php |
1183 | 1263 | } else { |
1184 | 1264 | ?> |
1185 | 1265 | //then load it again every 30 seconds |
1186 | 1266 | reloadPage = setInterval( |
1187 | - function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
1267 | + function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) { |
|
1268 | + print $globalMapRefresh*1000; |
|
1269 | +} else { |
|
1270 | + print '30000'; |
|
1271 | +} |
|
1272 | +?>); |
|
1188 | 1273 | var currentdate = new Date(); |
1189 | 1274 | var currentyear = new Date().getFullYear(); |
1190 | 1275 | var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0)); |
@@ -1196,7 +1281,12 @@ discard block |
||
1196 | 1281 | if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
1197 | 1282 | ?> |
1198 | 1283 | update_polarLayer(); |
1199 | -setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
1284 | +setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) { |
|
1285 | + print $globalMapRefresh*1000*2; |
|
1286 | +} else { |
|
1287 | + print '60000'; |
|
1288 | +} |
|
1289 | +?>); |
|
1200 | 1290 | <?php |
1201 | 1291 | } |
1202 | 1292 | ?> |
@@ -1212,7 +1302,12 @@ discard block |
||
1212 | 1302 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
1213 | 1303 | ?> |
1214 | 1304 | update_atcLayer(); |
1215 | -setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
1305 | +setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) { |
|
1306 | + print $globalMapRefresh*1000*2; |
|
1307 | +} else { |
|
1308 | + print '60000'; |
|
1309 | +} |
|
1310 | +?>); |
|
1216 | 1311 | <?php |
1217 | 1312 | } |
1218 | 1313 | ?> |
@@ -40,23 +40,46 @@ discard block |
||
40 | 40 | } |
41 | 41 | header('Content-Type: text/javascript'); |
42 | 42 | |
43 | -if (!isset($globalJsonCompress)) $compress = true; |
|
44 | -else $compress = $globalJsonCompress; |
|
43 | +if (!isset($globalJsonCompress)) { |
|
44 | + $compress = true; |
|
45 | +} else { |
|
46 | + $compress = $globalJsonCompress; |
|
47 | +} |
|
45 | 48 | |
46 | 49 | $from_archive = false; |
47 | 50 | $min = false; |
48 | 51 | $allhistory = false; |
49 | 52 | $filter['source'] = array(); |
50 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
51 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
52 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
53 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
54 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
55 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
56 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
57 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
58 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
59 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
53 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
54 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
55 | +} |
|
56 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
57 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
58 | +} |
|
59 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
60 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | +} |
|
62 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
63 | + $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
64 | +} |
|
65 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
66 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
67 | +} |
|
68 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
69 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
70 | +} |
|
71 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
72 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
73 | +} |
|
74 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
75 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
76 | +} |
|
77 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
78 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
79 | +} |
|
80 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
81 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
82 | +} |
|
60 | 83 | /* |
61 | 84 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
62 | 85 | $min = true; |
@@ -133,8 +156,12 @@ discard block |
||
133 | 156 | } else { |
134 | 157 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
135 | 158 | } |
136 | - if ($flightcnt == '') $flightcnt = 0; |
|
137 | -} else $flightcnt = 0; |
|
159 | + if ($flightcnt == '') { |
|
160 | + $flightcnt = 0; |
|
161 | + } |
|
162 | + } else { |
|
163 | + $flightcnt = 0; |
|
164 | +} |
|
138 | 165 | |
139 | 166 | $sqltime = round(microtime(true)-$begintime,2); |
140 | 167 | $minitime = time(); |
@@ -157,7 +184,9 @@ discard block |
||
157 | 184 | $j = 0; |
158 | 185 | $prev_flightaware_id = ''; |
159 | 186 | $speed = 1; |
160 | -if (isset($archivespeed)) $speed = $archivespeed; |
|
187 | +if (isset($archivespeed)) { |
|
188 | + $speed = $archivespeed; |
|
189 | +} |
|
161 | 190 | $output = '['; |
162 | 191 | $output .= '{"id" : "document", "name" : "fam","version" : "1.0"'; |
163 | 192 | // $output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
@@ -227,7 +256,9 @@ discard block |
||
227 | 256 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
228 | 257 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
229 | 258 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
230 | - } else $aircraft_shadow = ''; |
|
259 | + } else { |
|
260 | + $aircraft_shadow = ''; |
|
261 | + } |
|
231 | 262 | if ($aircraft_shadow != '') { |
232 | 263 | if (isset($modelsdb[$aircraft_shadow])) { |
233 | 264 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20 ,'; |
@@ -324,7 +355,9 @@ discard block |
||
324 | 355 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20,'; |
325 | 356 | $output .= '"heightReference": "'.$heightrelative.'"},'; |
326 | 357 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
327 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
358 | + if ($spotter_item['aircraft_icao'] != '') { |
|
359 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
360 | + } |
|
328 | 361 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
329 | 362 | } |
330 | 363 | } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
@@ -336,7 +369,9 @@ discard block |
||
336 | 369 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20,'; |
337 | 370 | $output .= '"heightReference": "'.$heightrelative.'"},'; |
338 | 371 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
339 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
372 | + if ($spotter_item['aircraft_icao'] != '') { |
|
373 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
374 | + } |
|
340 | 375 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
341 | 376 | } |
342 | 377 | |
@@ -344,7 +379,9 @@ discard block |
||
344 | 379 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20,'; |
345 | 380 | $output .= '"heightReference": "'.$heightrelative.'"},'; |
346 | 381 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
347 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
382 | + if ($spotter_item['aircraft_icao'] != '') { |
|
383 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
384 | + } |
|
348 | 385 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
349 | 386 | } |
350 | 387 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
@@ -357,8 +394,12 @@ discard block |
||
357 | 394 | // $output .= '"interpolationDegree" : 5,'; |
358 | 395 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
359 | 396 | $output .= '"cartographicDegrees": ['; |
360 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
|
361 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
397 | + if ($minitime > strtotime($spotter_item['date'])) { |
|
398 | + $minitime = strtotime($spotter_item['date']); |
|
399 | + } |
|
400 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
401 | + $maxitime = strtotime($spotter_item['date']); |
|
402 | + } |
|
362 | 403 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
363 | 404 | $output .= $spotter_item['longitude'].', '; |
364 | 405 | $output .= $spotter_item['latitude'].', '; |
@@ -372,7 +413,9 @@ discard block |
||
372 | 413 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
373 | 414 | } else { |
374 | 415 | $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
375 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
416 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
417 | + $maxitime = strtotime($spotter_item['date']); |
|
418 | + } |
|
376 | 419 | if ($spotter_item['ground_speed'] == 0) { |
377 | 420 | $output .= $prevlong.', '; |
378 | 421 | $output .= $prevlat.', '; |
@@ -27,7 +27,9 @@ discard block |
||
27 | 27 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
28 | 28 | } |
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) { |
|
31 | + $filter = array_merge($filter,$globalFilter); |
|
32 | + } |
|
31 | 33 | $filter_query_join = ''; |
32 | 34 | $filter_query_where = ''; |
33 | 35 | foreach($filters as $flt) { |
@@ -80,8 +82,11 @@ discard block |
||
80 | 82 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
81 | 83 | } |
82 | 84 | } |
83 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
84 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
85 | + if ($filter_query_where == '' && $where) { |
|
86 | + $filter_query_where = ' WHERE'; |
|
87 | + } elseif ($filter_query_where != '' && $and) { |
|
88 | + $filter_query_where .= ' AND'; |
|
89 | + } |
|
85 | 90 | $filter_query = $filter_query_join.$filter_query_where; |
86 | 91 | return $filter_query; |
87 | 92 | } |
@@ -101,10 +106,18 @@ discard block |
||
101 | 106 | $Image = new Image($this->db); |
102 | 107 | $Schedule = new Schedule($this->db); |
103 | 108 | $ACARS = new ACARS($this->db); |
104 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
105 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
106 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
107 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
109 | + if (!isset($globalIVAO)) { |
|
110 | + $globalIVAO = FALSE; |
|
111 | + } |
|
112 | + if (!isset($globalVATSIM)) { |
|
113 | + $globalVATSIM = FALSE; |
|
114 | + } |
|
115 | + if (!isset($globalphpVMS)) { |
|
116 | + $globalphpVMS = FALSE; |
|
117 | + } |
|
118 | + if (!isset($globalVAM)) { |
|
119 | + $globalVAM = FALSE; |
|
120 | + } |
|
108 | 121 | date_default_timezone_set('UTC'); |
109 | 122 | |
110 | 123 | if (!is_string($query)) |
@@ -151,21 +164,35 @@ discard block |
||
151 | 164 | } else { |
152 | 165 | $temp_array['spotter_id'] = ''; |
153 | 166 | } |
154 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
155 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
167 | + if (isset($row['flightaware_id'])) { |
|
168 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
169 | + } |
|
170 | + if (isset($row['modes'])) { |
|
171 | + $temp_array['modes'] = $row['modes']; |
|
172 | + } |
|
156 | 173 | $temp_array['ident'] = $row['ident']; |
157 | 174 | if (isset($row['registration']) && $row['registration'] != '') { |
158 | 175 | $temp_array['registration'] = $row['registration']; |
159 | 176 | } elseif (isset($temp_array['modes'])) { |
160 | 177 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
161 | - } else $temp_array['registration'] = ''; |
|
162 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
178 | + } else { |
|
179 | + $temp_array['registration'] = ''; |
|
180 | + } |
|
181 | + if (isset($row['aircraft_icao'])) { |
|
182 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
183 | + } |
|
163 | 184 | |
164 | 185 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
165 | 186 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
166 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
167 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
168 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
187 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
188 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
189 | + } |
|
190 | + if (isset($row['latitude'])) { |
|
191 | + $temp_array['latitude'] = $row['latitude']; |
|
192 | + } |
|
193 | + if (isset($row['longitude'])) { |
|
194 | + $temp_array['longitude'] = $row['longitude']; |
|
195 | + } |
|
169 | 196 | /* |
170 | 197 | if (Connection->tableExists('countries')) { |
171 | 198 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -175,8 +202,12 @@ discard block |
||
175 | 202 | } |
176 | 203 | } |
177 | 204 | */ |
178 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
179 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
205 | + if (isset($row['waypoints'])) { |
|
206 | + $temp_array['waypoints'] = $row['waypoints']; |
|
207 | + } |
|
208 | + if (isset($row['format_source'])) { |
|
209 | + $temp_array['format_source'] = $row['format_source']; |
|
210 | + } |
|
180 | 211 | if (isset($row['route_stop'])) { |
181 | 212 | $temp_array['route_stop'] = $row['route_stop']; |
182 | 213 | if ($row['route_stop'] != '') { |
@@ -195,13 +226,19 @@ discard block |
||
195 | 226 | } |
196 | 227 | } |
197 | 228 | } |
198 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
229 | + if (isset($row['altitude'])) { |
|
230 | + $temp_array['altitude'] = $row['altitude']; |
|
231 | + } |
|
199 | 232 | if (isset($row['heading'])) { |
200 | 233 | $temp_array['heading'] = $row['heading']; |
201 | 234 | $heading_direction = $this->parseDirection($row['heading']); |
202 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
235 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
236 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
237 | + } |
|
238 | + } |
|
239 | + if (isset($row['ground_speed'])) { |
|
240 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
203 | 241 | } |
204 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
205 | 242 | $temp_array['image'] = ""; |
206 | 243 | $temp_array['image_thumbnail'] = ""; |
207 | 244 | $temp_array['image_source'] = ""; |
@@ -209,7 +246,9 @@ discard block |
||
209 | 246 | |
210 | 247 | if (isset($row['highlight'])) { |
211 | 248 | $temp_array['highlight'] = $row['highlight']; |
212 | - } else $temp_array['highlight'] = ''; |
|
249 | + } else { |
|
250 | + $temp_array['highlight'] = ''; |
|
251 | + } |
|
213 | 252 | |
214 | 253 | if (isset($row['date'])) { |
215 | 254 | $dateArray = $this->parseDateString($row['date']); |
@@ -257,7 +296,9 @@ discard block |
||
257 | 296 | |
258 | 297 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
259 | 298 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
260 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
299 | + } else { |
|
300 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
301 | + } |
|
261 | 302 | } else { |
262 | 303 | $temp_array['aircraft_shadow'] = 'default.png'; |
263 | 304 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -265,11 +306,17 @@ discard block |
||
265 | 306 | } |
266 | 307 | } |
267 | 308 | $fromsource = NULL; |
268 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
269 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
270 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
271 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
272 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
309 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
310 | + $fromsource = $globalAirlinesSource; |
|
311 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
312 | + $fromsource = 'vatsim'; |
|
313 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
314 | + $fromsource = 'ivao'; |
|
315 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
316 | + $fromsource = 'vatsim'; |
|
317 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
318 | + $fromsource = 'ivao'; |
|
319 | + } |
|
273 | 320 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
274 | 321 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
275 | 322 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -292,12 +339,18 @@ discard block |
||
292 | 339 | } |
293 | 340 | } else { |
294 | 341 | $temp_array['airline_icao'] = $row['airline_icao']; |
295 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
296 | - else $temp_array['airline_iata'] = 'N/A'; |
|
342 | + if (isset($row['airline_iata'])) { |
|
343 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
344 | + } else { |
|
345 | + $temp_array['airline_iata'] = 'N/A'; |
|
346 | + } |
|
297 | 347 | $temp_array['airline_name'] = $row['airline_name']; |
298 | 348 | $temp_array['airline_country'] = $row['airline_country']; |
299 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
300 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
349 | + if (isset($row['airline_callsign'])) { |
|
350 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
351 | + } else { |
|
352 | + $temp_array['airline_callsign'] = 'N/A'; |
|
353 | + } |
|
301 | 354 | $temp_array['airline_type'] = $row['airline_type']; |
302 | 355 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
303 | 356 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -324,7 +377,9 @@ discard block |
||
324 | 377 | } |
325 | 378 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
326 | 379 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
327 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
380 | + if ($owner_info['owner'] != '') { |
|
381 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
382 | + } |
|
328 | 383 | $temp_array['aircraft_base'] = $owner_info['base']; |
329 | 384 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
330 | 385 | } |
@@ -332,9 +387,14 @@ discard block |
||
332 | 387 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
333 | 388 | { |
334 | 389 | if ($globalIVAO) { |
335 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
336 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
337 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
390 | + if (isset($temp_array['airline_icao'])) { |
|
391 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
392 | + } else { |
|
393 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
394 | + } |
|
395 | + } else { |
|
396 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
397 | + } |
|
338 | 398 | if (count($image_array) > 0) { |
339 | 399 | $temp_array['image'] = $image_array[0]['image']; |
340 | 400 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -386,7 +446,9 @@ discard block |
||
386 | 446 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
387 | 447 | if ($row['departure_airport_icao'] != '') { |
388 | 448 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
389 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
449 | + if (!isset($departure_airport_array[0]['name'])) { |
|
450 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
451 | + } |
|
390 | 452 | /* |
391 | 453 | } elseif ($row['departure_airport_name'] != '') { |
392 | 454 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -394,7 +456,9 @@ discard block |
||
394 | 456 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
395 | 457 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
396 | 458 | */ |
397 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
459 | + } else { |
|
460 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
461 | + } |
|
398 | 462 | if (isset($departure_airport_array[0]['name'])) { |
399 | 463 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
400 | 464 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -414,8 +478,12 @@ discard block |
||
414 | 478 | |
415 | 479 | if ($row['arrival_airport_icao'] != '') { |
416 | 480 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
417 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
418 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
481 | + if (count($arrival_airport_array) == 0) { |
|
482 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
483 | + } |
|
484 | + } else { |
|
485 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
486 | + } |
|
419 | 487 | if (isset($arrival_airport_array[0]['name'])) { |
420 | 488 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
421 | 489 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -431,27 +499,45 @@ discard block |
||
431 | 499 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
432 | 500 | } |
433 | 501 | */ |
434 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
435 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
436 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
437 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
438 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
502 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
503 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
504 | + } |
|
505 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
506 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
507 | + } |
|
508 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
509 | + $temp_array['source_name'] = $row['source_name']; |
|
510 | + } |
|
511 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
512 | + $temp_array['over_country'] = $row['over_country']; |
|
513 | + } |
|
514 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
515 | + $temp_array['distance'] = $row['distance']; |
|
516 | + } |
|
439 | 517 | if (isset($row['squawk'])) { |
440 | 518 | $temp_array['squawk'] = $row['squawk']; |
441 | 519 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
442 | 520 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
443 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
521 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
522 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
523 | + } |
|
444 | 524 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
445 | 525 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
446 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
447 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
526 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
527 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
528 | + } |
|
529 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
530 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
531 | + } |
|
448 | 532 | } |
449 | 533 | |
450 | 534 | $temp_array['query_number_rows'] = $num_rows; |
451 | 535 | |
452 | 536 | $spotter_array[] = $temp_array; |
453 | 537 | } |
454 | - if ($num_rows == 0) return array(); |
|
538 | + if ($num_rows == 0) { |
|
539 | + return array(); |
|
540 | + } |
|
455 | 541 | $spotter_array[0]['query_number_rows'] = $num_rows; |
456 | 542 | return $spotter_array; |
457 | 543 | } |
@@ -484,7 +570,9 @@ discard block |
||
484 | 570 | foreach ($q_array as $q_item){ |
485 | 571 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
486 | 572 | $additional_query .= " AND ("; |
487 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
573 | + if (is_int($q_item)) { |
|
574 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
575 | + } |
|
488 | 576 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
489 | 577 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
490 | 578 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -505,7 +593,9 @@ discard block |
||
505 | 593 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
506 | 594 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
507 | 595 | $translate = $Translation->ident2icao($q_item); |
508 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
596 | + if ($translate != $q_item) { |
|
597 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
598 | + } |
|
509 | 599 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
510 | 600 | $additional_query .= ")"; |
511 | 601 | } |
@@ -732,7 +822,9 @@ discard block |
||
732 | 822 | date_default_timezone_set($globalTimezone); |
733 | 823 | $datetime = new DateTime(); |
734 | 824 | $offset = $datetime->format('P'); |
735 | - } else $offset = '+00:00'; |
|
825 | + } else { |
|
826 | + $offset = '+00:00'; |
|
827 | + } |
|
736 | 828 | |
737 | 829 | if ($date_array[1] != "") |
738 | 830 | { |
@@ -764,8 +856,12 @@ discard block |
||
764 | 856 | { |
765 | 857 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
766 | 858 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
767 | - } else $limit_query = ""; |
|
768 | - } else $limit_query = ""; |
|
859 | + } else { |
|
860 | + $limit_query = ""; |
|
861 | + } |
|
862 | + } else { |
|
863 | + $limit_query = ""; |
|
864 | + } |
|
769 | 865 | |
770 | 866 | |
771 | 867 | if ($sort != "") |
@@ -833,8 +929,12 @@ discard block |
||
833 | 929 | { |
834 | 930 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
835 | 931 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
836 | - } else $limit_query = ""; |
|
837 | - } else $limit_query = ""; |
|
932 | + } else { |
|
933 | + $limit_query = ""; |
|
934 | + } |
|
935 | + } else { |
|
936 | + $limit_query = ""; |
|
937 | + } |
|
838 | 938 | |
839 | 939 | if ($sort != "") |
840 | 940 | { |
@@ -1158,7 +1258,9 @@ discard block |
||
1158 | 1258 | global $global_query; |
1159 | 1259 | |
1160 | 1260 | date_default_timezone_set('UTC'); |
1161 | - if ($id == '') return array(); |
|
1261 | + if ($id == '') { |
|
1262 | + return array(); |
|
1263 | + } |
|
1162 | 1264 | $additional_query = "spotter_output.spotter_id = :id"; |
1163 | 1265 | $query_values = array(':id' => $id); |
1164 | 1266 | |
@@ -1790,7 +1892,9 @@ discard block |
||
1790 | 1892 | { |
1791 | 1893 | $highlight = $row['highlight']; |
1792 | 1894 | } |
1793 | - if (isset($highlight)) return $highlight; |
|
1895 | + if (isset($highlight)) { |
|
1896 | + return $highlight; |
|
1897 | + } |
|
1794 | 1898 | } |
1795 | 1899 | |
1796 | 1900 | |
@@ -1818,7 +1922,9 @@ discard block |
||
1818 | 1922 | $sth->closeCursor(); |
1819 | 1923 | if (count($row) > 0) { |
1820 | 1924 | return $row['usage']; |
1821 | - } else return ''; |
|
1925 | + } else { |
|
1926 | + return ''; |
|
1927 | + } |
|
1822 | 1928 | } |
1823 | 1929 | |
1824 | 1930 | /** |
@@ -1843,7 +1949,9 @@ discard block |
||
1843 | 1949 | $sth->closeCursor(); |
1844 | 1950 | if (count($row) > 0) { |
1845 | 1951 | return $row['icao']; |
1846 | - } else return ''; |
|
1952 | + } else { |
|
1953 | + return ''; |
|
1954 | + } |
|
1847 | 1955 | } |
1848 | 1956 | |
1849 | 1957 | /** |
@@ -1871,7 +1979,9 @@ discard block |
||
1871 | 1979 | $airport_longitude = $row['longitude']; |
1872 | 1980 | $Common = new Common(); |
1873 | 1981 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
1874 | - } else return ''; |
|
1982 | + } else { |
|
1983 | + return ''; |
|
1984 | + } |
|
1875 | 1985 | } |
1876 | 1986 | |
1877 | 1987 | /** |
@@ -1983,7 +2093,9 @@ discard block |
||
1983 | 2093 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1984 | 2094 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1985 | 2095 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1986 | - } else return array(); |
|
2096 | + } else { |
|
2097 | + return array(); |
|
2098 | + } |
|
1987 | 2099 | if ($globalDBdriver == 'mysql') { |
1988 | 2100 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
1989 | 2101 | } else { |
@@ -2018,7 +2130,9 @@ discard block |
||
2018 | 2130 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2019 | 2131 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2020 | 2132 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2021 | - } else return array(); |
|
2133 | + } else { |
|
2134 | + return array(); |
|
2135 | + } |
|
2022 | 2136 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
2023 | 2137 | $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
2024 | 2138 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2053,7 +2167,9 @@ discard block |
||
2053 | 2167 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
2054 | 2168 | { |
2055 | 2169 | global $globalUseRealAirlines; |
2056 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
2170 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
2171 | + $fromsource = NULL; |
|
2172 | + } |
|
2057 | 2173 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
2058 | 2174 | if ($airline_icao == 'NA') { |
2059 | 2175 | $airline_array = array(); |
@@ -2103,7 +2219,9 @@ discard block |
||
2103 | 2219 | $sth->execute(array(':fromsource' => $fromsource)); |
2104 | 2220 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2105 | 2221 | $sth->closeCursor(); |
2106 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao); |
|
2222 | + if ($row['nb'] == 0) { |
|
2223 | + $result = $this->getAllAirlineInfo($airline_icao); |
|
2224 | + } |
|
2107 | 2225 | } |
2108 | 2226 | return $result; |
2109 | 2227 | } |
@@ -2119,7 +2237,9 @@ discard block |
||
2119 | 2237 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
2120 | 2238 | { |
2121 | 2239 | global $globalUseRealAirlines; |
2122 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
2240 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
2241 | + $fromsource = NULL; |
|
2242 | + } |
|
2123 | 2243 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
2124 | 2244 | $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
2125 | 2245 | $sth = $this->db->prepare($query); |
@@ -2135,7 +2255,9 @@ discard block |
||
2135 | 2255 | $sth->execute(array(':fromsource' => $fromsource)); |
2136 | 2256 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2137 | 2257 | $sth->closeCursor(); |
2138 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
2258 | + if ($row['nb'] == 0) { |
|
2259 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
2260 | + } |
|
2139 | 2261 | } |
2140 | 2262 | return $result; |
2141 | 2263 | } |
@@ -2198,15 +2320,20 @@ discard block |
||
2198 | 2320 | 'A320-211' => 'A320', |
2199 | 2321 | '747-8i' => 'B748', |
2200 | 2322 | 'A380' => 'A388'); |
2201 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
2323 | + if (isset($all_aircraft[$aircraft_type])) { |
|
2324 | + return $all_aircraft[$aircraft_type]; |
|
2325 | + } |
|
2202 | 2326 | |
2203 | 2327 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
2204 | 2328 | $aircraft_type = strtoupper($aircraft_type); |
2205 | 2329 | $sth = $this->db->prepare($query); |
2206 | 2330 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
2207 | 2331 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
2208 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
2209 | - else return ''; |
|
2332 | + if (isset($result[0]['icao'])) { |
|
2333 | + return $result[0]['icao']; |
|
2334 | + } else { |
|
2335 | + return ''; |
|
2336 | + } |
|
2210 | 2337 | } |
2211 | 2338 | |
2212 | 2339 | /** |
@@ -2229,7 +2356,9 @@ discard block |
||
2229 | 2356 | $sth->closeCursor(); |
2230 | 2357 | if (isset($row['icaotypecode'])) { |
2231 | 2358 | return $row['icaotypecode']; |
2232 | - } else return ''; |
|
2359 | + } else { |
|
2360 | + return ''; |
|
2361 | + } |
|
2233 | 2362 | } |
2234 | 2363 | |
2235 | 2364 | /** |
@@ -2252,7 +2381,9 @@ discard block |
||
2252 | 2381 | $sth->closeCursor(); |
2253 | 2382 | if (isset($row['icaotypecode'])) { |
2254 | 2383 | return $row['icaotypecode']; |
2255 | - } else return ''; |
|
2384 | + } else { |
|
2385 | + return ''; |
|
2386 | + } |
|
2256 | 2387 | } |
2257 | 2388 | |
2258 | 2389 | /** |
@@ -2274,7 +2405,9 @@ discard block |
||
2274 | 2405 | $sth->closeCursor(); |
2275 | 2406 | if (isset($row['operator_correct'])) { |
2276 | 2407 | return $row['operator_correct']; |
2277 | - } else return $operator; |
|
2408 | + } else { |
|
2409 | + return $operator; |
|
2410 | + } |
|
2278 | 2411 | } |
2279 | 2412 | |
2280 | 2413 | /** |
@@ -2287,7 +2420,9 @@ discard block |
||
2287 | 2420 | public function getRouteInfo($callsign) |
2288 | 2421 | { |
2289 | 2422 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
2290 | - if ($callsign == '') return array(); |
|
2423 | + if ($callsign == '') { |
|
2424 | + return array(); |
|
2425 | + } |
|
2291 | 2426 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
2292 | 2427 | |
2293 | 2428 | $sth = $this->db->prepare($query); |
@@ -2297,7 +2432,9 @@ discard block |
||
2297 | 2432 | $sth->closeCursor(); |
2298 | 2433 | if (count($row) > 0) { |
2299 | 2434 | return $row; |
2300 | - } else return array(); |
|
2435 | + } else { |
|
2436 | + return array(); |
|
2437 | + } |
|
2301 | 2438 | } |
2302 | 2439 | |
2303 | 2440 | /** |
@@ -2350,7 +2487,9 @@ discard block |
||
2350 | 2487 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
2351 | 2488 | $sth->closeCursor(); |
2352 | 2489 | return $result; |
2353 | - } else return array(); |
|
2490 | + } else { |
|
2491 | + return array(); |
|
2492 | + } |
|
2354 | 2493 | } |
2355 | 2494 | |
2356 | 2495 | |
@@ -2509,8 +2648,11 @@ discard block |
||
2509 | 2648 | $query .= " ORDER BY spotter_output.source_name ASC"; |
2510 | 2649 | |
2511 | 2650 | $sth = $this->db->prepare($query); |
2512 | - if (!empty($query_values)) $sth->execute($query_values); |
|
2513 | - else $sth->execute(); |
|
2651 | + if (!empty($query_values)) { |
|
2652 | + $sth->execute($query_values); |
|
2653 | + } else { |
|
2654 | + $sth->execute(); |
|
2655 | + } |
|
2514 | 2656 | |
2515 | 2657 | $source_array = array(); |
2516 | 2658 | $temp_array = array(); |
@@ -2543,9 +2685,13 @@ discard block |
||
2543 | 2685 | WHERE spotter_output.airline_icao <> '' |
2544 | 2686 | ORDER BY spotter_output.airline_name ASC"; |
2545 | 2687 | */ |
2546 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
2547 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
2548 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
2688 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
2689 | + $forsource = $globalAirlinesSource; |
|
2690 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
2691 | + $forsource = 'vatsim'; |
|
2692 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
2693 | + $forsource = 'ivao'; |
|
2694 | + } |
|
2549 | 2695 | if ($forsource === NULL) { |
2550 | 2696 | $query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC"; |
2551 | 2697 | $query_data = array(); |
@@ -2588,9 +2734,13 @@ discard block |
||
2588 | 2734 | { |
2589 | 2735 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
2590 | 2736 | $filter_query = $this->getFilter($filters,true,true); |
2591 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
2592 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
2593 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
2737 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
2738 | + $forsource = $globalAirlinesSource; |
|
2739 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
2740 | + $forsource = 'vatsim'; |
|
2741 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
2742 | + $forsource = 'ivao'; |
|
2743 | + } |
|
2594 | 2744 | if ($forsource === NULL) { |
2595 | 2745 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
2596 | 2746 | $query_data = array(); |
@@ -2865,7 +3015,9 @@ discard block |
||
2865 | 3015 | date_default_timezone_set($globalTimezone); |
2866 | 3016 | $datetime = new DateTime(); |
2867 | 3017 | $offset = $datetime->format('P'); |
2868 | - } else $offset = '+00:00'; |
|
3018 | + } else { |
|
3019 | + $offset = '+00:00'; |
|
3020 | + } |
|
2869 | 3021 | if ($airport_icao == '') { |
2870 | 3022 | if ($globalDBdriver == 'mysql') { |
2871 | 3023 | $query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -2897,7 +3049,9 @@ discard block |
||
2897 | 3049 | date_default_timezone_set($globalTimezone); |
2898 | 3050 | $datetime = new DateTime(); |
2899 | 3051 | $offset = $datetime->format('P'); |
2900 | - } else $offset = '+00:00'; |
|
3052 | + } else { |
|
3053 | + $offset = '+00:00'; |
|
3054 | + } |
|
2901 | 3055 | if ($airport_icao == '') { |
2902 | 3056 | if ($globalDBdriver == 'mysql') { |
2903 | 3057 | $query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -2930,7 +3084,9 @@ discard block |
||
2930 | 3084 | date_default_timezone_set($globalTimezone); |
2931 | 3085 | $datetime = new DateTime(); |
2932 | 3086 | $offset = $datetime->format('P'); |
2933 | - } else $offset = '+00:00'; |
|
3087 | + } else { |
|
3088 | + $offset = '+00:00'; |
|
3089 | + } |
|
2934 | 3090 | if ($airport_icao == '') { |
2935 | 3091 | if ($globalDBdriver == 'mysql') { |
2936 | 3092 | $query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -2969,7 +3125,9 @@ discard block |
||
2969 | 3125 | date_default_timezone_set($globalTimezone); |
2970 | 3126 | $datetime = new DateTime(); |
2971 | 3127 | $offset = $datetime->format('P'); |
2972 | - } else $offset = '+00:00'; |
|
3128 | + } else { |
|
3129 | + $offset = '+00:00'; |
|
3130 | + } |
|
2973 | 3131 | if ($airport_icao == '') { |
2974 | 3132 | if ($globalDBdriver == 'mysql') { |
2975 | 3133 | $query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3014,7 +3172,9 @@ discard block |
||
3014 | 3172 | date_default_timezone_set($globalTimezone); |
3015 | 3173 | $datetime = new DateTime(); |
3016 | 3174 | $offset = $datetime->format('P'); |
3017 | - } else $offset = '+00:00'; |
|
3175 | + } else { |
|
3176 | + $offset = '+00:00'; |
|
3177 | + } |
|
3018 | 3178 | if ($airport_icao == '') { |
3019 | 3179 | if ($globalDBdriver == 'mysql') { |
3020 | 3180 | $query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3049,7 +3209,9 @@ discard block |
||
3049 | 3209 | date_default_timezone_set($globalTimezone); |
3050 | 3210 | $datetime = new DateTime(); |
3051 | 3211 | $offset = $datetime->format('P'); |
3052 | - } else $offset = '+00:00'; |
|
3212 | + } else { |
|
3213 | + $offset = '+00:00'; |
|
3214 | + } |
|
3053 | 3215 | if ($airport_icao == '') { |
3054 | 3216 | if ($globalDBdriver == 'mysql') { |
3055 | 3217 | $query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3091,7 +3253,9 @@ discard block |
||
3091 | 3253 | date_default_timezone_set($globalTimezone); |
3092 | 3254 | $datetime = new DateTime(); |
3093 | 3255 | $offset = $datetime->format('P'); |
3094 | - } else $offset = '+00:00'; |
|
3256 | + } else { |
|
3257 | + $offset = '+00:00'; |
|
3258 | + } |
|
3095 | 3259 | if ($airport_icao == '') { |
3096 | 3260 | if ($globalDBdriver == 'mysql') { |
3097 | 3261 | $query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3125,7 +3289,9 @@ discard block |
||
3125 | 3289 | date_default_timezone_set($globalTimezone); |
3126 | 3290 | $datetime = new DateTime(); |
3127 | 3291 | $offset = $datetime->format('P'); |
3128 | - } else $offset = '+00:00'; |
|
3292 | + } else { |
|
3293 | + $offset = '+00:00'; |
|
3294 | + } |
|
3129 | 3295 | if ($airport_icao == '') { |
3130 | 3296 | if ($globalDBdriver == 'mysql') { |
3131 | 3297 | $query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3173,7 +3339,9 @@ discard block |
||
3173 | 3339 | date_default_timezone_set($globalTimezone); |
3174 | 3340 | $datetime = new DateTime(); |
3175 | 3341 | $offset = $datetime->format('P'); |
3176 | - } else $offset = '+00:00'; |
|
3342 | + } else { |
|
3343 | + $offset = '+00:00'; |
|
3344 | + } |
|
3177 | 3345 | |
3178 | 3346 | if ($globalDBdriver == 'mysql') { |
3179 | 3347 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3293,7 +3461,9 @@ discard block |
||
3293 | 3461 | */ |
3294 | 3462 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
3295 | 3463 | { |
3296 | - if ($groundspeed == '') $groundspeed = NULL; |
|
3464 | + if ($groundspeed == '') { |
|
3465 | + $groundspeed = NULL; |
|
3466 | + } |
|
3297 | 3467 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
3298 | 3468 | $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
3299 | 3469 | |
@@ -3343,10 +3513,18 @@ discard block |
||
3343 | 3513 | $Image = new Image($this->db); |
3344 | 3514 | $Common = new Common(); |
3345 | 3515 | |
3346 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
3347 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
3348 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
3349 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
3516 | + if (!isset($globalIVAO)) { |
|
3517 | + $globalIVAO = FALSE; |
|
3518 | + } |
|
3519 | + if (!isset($globalVATSIM)) { |
|
3520 | + $globalVATSIM = FALSE; |
|
3521 | + } |
|
3522 | + if (!isset($globalphpVMS)) { |
|
3523 | + $globalphpVMS = FALSE; |
|
3524 | + } |
|
3525 | + if (!isset($globalVAM)) { |
|
3526 | + $globalVAM = FALSE; |
|
3527 | + } |
|
3350 | 3528 | date_default_timezone_set('UTC'); |
3351 | 3529 | |
3352 | 3530 | //getting the registration |
@@ -3359,23 +3537,33 @@ discard block |
||
3359 | 3537 | if ($ModeS != '') { |
3360 | 3538 | $timeelapsed = microtime(true); |
3361 | 3539 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
3362 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3540 | + if ($globalDebugTimeElapsed) { |
|
3541 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3542 | + } |
|
3363 | 3543 | } else { |
3364 | 3544 | $myhex = explode('-',$flightaware_id); |
3365 | 3545 | if (count($myhex) > 0) { |
3366 | 3546 | $timeelapsed = microtime(true); |
3367 | 3547 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
3368 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3548 | + if ($globalDebugTimeElapsed) { |
|
3549 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3550 | + } |
|
3369 | 3551 | } |
3370 | 3552 | } |
3371 | 3553 | } |
3372 | 3554 | } |
3373 | 3555 | $fromsource = NULL; |
3374 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
3375 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
3376 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
3377 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
3378 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
3556 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
3557 | + $fromsource = $globalAirlinesSource; |
|
3558 | + } elseif ($format_source == 'vatsimtxt') { |
|
3559 | + $fromsource = 'vatsim'; |
|
3560 | + } elseif ($format_source == 'whazzup') { |
|
3561 | + $fromsource = 'ivao'; |
|
3562 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
3563 | + $fromsource = 'vatsim'; |
|
3564 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
3565 | + $fromsource = 'ivao'; |
|
3566 | + } |
|
3379 | 3567 | //getting the airline information |
3380 | 3568 | if ($ident != "") |
3381 | 3569 | { |
@@ -3399,15 +3587,21 @@ discard block |
||
3399 | 3587 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
3400 | 3588 | $airline_array = $this->getAllAirlineInfo("NA"); |
3401 | 3589 | } |
3402 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3590 | + if ($globalDebugTimeElapsed) { |
|
3591 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3592 | + } |
|
3403 | 3593 | |
3404 | 3594 | } else { |
3405 | 3595 | $timeelapsed = microtime(true); |
3406 | 3596 | $airline_array = $this->getAllAirlineInfo("NA"); |
3407 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3597 | + if ($globalDebugTimeElapsed) { |
|
3598 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3599 | + } |
|
3408 | 3600 | } |
3409 | 3601 | } |
3410 | - } else $airline_array = array(); |
|
3602 | + } else { |
|
3603 | + $airline_array = array(); |
|
3604 | + } |
|
3411 | 3605 | |
3412 | 3606 | //getting the aircraft information |
3413 | 3607 | $aircraft_array = array(); |
@@ -3421,27 +3615,37 @@ discard block |
||
3421 | 3615 | { |
3422 | 3616 | $timeelapsed = microtime(true); |
3423 | 3617 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3424 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3618 | + if ($globalDebugTimeElapsed) { |
|
3619 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3620 | + } |
|
3425 | 3621 | } else { |
3426 | 3622 | $timeelapsed = microtime(true); |
3427 | 3623 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3428 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3624 | + if ($globalDebugTimeElapsed) { |
|
3625 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3626 | + } |
|
3429 | 3627 | } |
3430 | 3628 | } |
3431 | 3629 | } else { |
3432 | 3630 | if ($ModeS != '') { |
3433 | 3631 | $timeelapsed = microtime(true); |
3434 | 3632 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
3435 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3633 | + if ($globalDebugTimeElapsed) { |
|
3634 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3635 | + } |
|
3436 | 3636 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
3437 | 3637 | { |
3438 | 3638 | $timeelapsed = microtime(true); |
3439 | 3639 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3440 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3640 | + if ($globalDebugTimeElapsed) { |
|
3641 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3642 | + } |
|
3441 | 3643 | } else { |
3442 | 3644 | $timeelapsed = microtime(true); |
3443 | 3645 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3444 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3646 | + if ($globalDebugTimeElapsed) { |
|
3647 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3648 | + } |
|
3445 | 3649 | } |
3446 | 3650 | } |
3447 | 3651 | } |
@@ -3457,7 +3661,9 @@ discard block |
||
3457 | 3661 | } else { |
3458 | 3662 | $timeelapsed = microtime(true); |
3459 | 3663 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
3460 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3664 | + if ($globalDebugTimeElapsed) { |
|
3665 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3666 | + } |
|
3461 | 3667 | } |
3462 | 3668 | } |
3463 | 3669 | |
@@ -3472,7 +3678,9 @@ discard block |
||
3472 | 3678 | } else { |
3473 | 3679 | $timeelapsed = microtime(true); |
3474 | 3680 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
3475 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3681 | + if ($globalDebugTimeElapsed) { |
|
3682 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3683 | + } |
|
3476 | 3684 | } |
3477 | 3685 | } |
3478 | 3686 | |
@@ -3506,7 +3714,9 @@ discard block |
||
3506 | 3714 | { |
3507 | 3715 | return false; |
3508 | 3716 | } |
3509 | - } else $altitude = 0; |
|
3717 | + } else { |
|
3718 | + $altitude = 0; |
|
3719 | + } |
|
3510 | 3720 | |
3511 | 3721 | if ($heading != "") |
3512 | 3722 | { |
@@ -3535,7 +3745,9 @@ discard block |
||
3535 | 3745 | { |
3536 | 3746 | $timeelapsed = microtime(true); |
3537 | 3747 | $image_array = $Image->getSpotterImage($registration); |
3538 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3748 | + if ($globalDebugTimeElapsed) { |
|
3749 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3750 | + } |
|
3539 | 3751 | if (!isset($image_array[0]['registration'])) |
3540 | 3752 | { |
3541 | 3753 | //echo "Add image !!!! \n"; |
@@ -3543,14 +3755,21 @@ discard block |
||
3543 | 3755 | } |
3544 | 3756 | $timeelapsed = microtime(true); |
3545 | 3757 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
3546 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3547 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
3758 | + if ($globalDebugTimeElapsed) { |
|
3759 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3760 | + } |
|
3761 | + if ($owner_info['owner'] != '') { |
|
3762 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
3763 | + } |
|
3548 | 3764 | } |
3549 | 3765 | |
3550 | 3766 | if ($globalIVAO && $aircraft_icao != '') |
3551 | 3767 | { |
3552 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
3553 | - else $airline_icao = ''; |
|
3768 | + if (isset($airline_array[0]['icao'])) { |
|
3769 | + $airline_icao = $airline_array[0]['icao']; |
|
3770 | + } else { |
|
3771 | + $airline_icao = ''; |
|
3772 | + } |
|
3554 | 3773 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
3555 | 3774 | if (!isset($image_array[0]['registration'])) |
3556 | 3775 | { |
@@ -3595,16 +3814,28 @@ discard block |
||
3595 | 3814 | { |
3596 | 3815 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
3597 | 3816 | } |
3598 | - if ($registration == '') $registration = 'NA'; |
|
3817 | + if ($registration == '') { |
|
3818 | + $registration = 'NA'; |
|
3819 | + } |
|
3599 | 3820 | if ($latitude == '' && $longitude == '') { |
3600 | 3821 | $latitude = 0; |
3601 | 3822 | $longitude = 0; |
3602 | 3823 | } |
3603 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
3604 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
3605 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
3606 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
3607 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
3824 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
3825 | + $squawk = NULL; |
|
3826 | + } |
|
3827 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
3828 | + $verticalrate = NULL; |
|
3829 | + } |
|
3830 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
3831 | + $heading = 0; |
|
3832 | + } |
|
3833 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
3834 | + $groundspeed = 0; |
|
3835 | + } |
|
3836 | + if (!isset($aircraft_owner)) { |
|
3837 | + $aircraft_owner = NULL; |
|
3838 | + } |
|
3608 | 3839 | $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
3609 | 3840 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
3610 | 3841 | |
@@ -3615,9 +3846,13 @@ discard block |
||
3615 | 3846 | if ($airline_type == '') { |
3616 | 3847 | $timeelapsed = microtime(true); |
3617 | 3848 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
3618 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3849 | + if ($globalDebugTimeElapsed) { |
|
3850 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3851 | + } |
|
3852 | + } |
|
3853 | + if ($airline_type == null) { |
|
3854 | + $airline_type = ''; |
|
3619 | 3855 | } |
3620 | - if ($airline_type == null) $airline_type = ''; |
|
3621 | 3856 | $aircraft_type = $aircraft_array[0]['type']; |
3622 | 3857 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
3623 | 3858 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3753,7 +3988,9 @@ discard block |
||
3753 | 3988 | } |
3754 | 3989 | } |
3755 | 3990 | $query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
3756 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
3991 | + if ($limit) { |
|
3992 | + $query .= " LIMIT 10 OFFSET 0"; |
|
3993 | + } |
|
3757 | 3994 | |
3758 | 3995 | $sth = $this->db->prepare($query); |
3759 | 3996 | $sth->execute(); |
@@ -3798,7 +4035,9 @@ discard block |
||
3798 | 4035 | } |
3799 | 4036 | } |
3800 | 4037 | $query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
3801 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4038 | + if ($limit) { |
|
4039 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4040 | + } |
|
3802 | 4041 | |
3803 | 4042 | |
3804 | 4043 | $sth = $this->db->prepare($query); |
@@ -3844,7 +4083,9 @@ discard block |
||
3844 | 4083 | } |
3845 | 4084 | } |
3846 | 4085 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
3847 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4086 | + if ($limit) { |
|
4087 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4088 | + } |
|
3848 | 4089 | |
3849 | 4090 | |
3850 | 4091 | $sth = $this->db->prepare($query); |
@@ -3892,7 +4133,9 @@ discard block |
||
3892 | 4133 | } |
3893 | 4134 | } |
3894 | 4135 | $query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
3895 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4136 | + if ($limit) { |
|
4137 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4138 | + } |
|
3896 | 4139 | |
3897 | 4140 | |
3898 | 4141 | $sth = $this->db->prepare($query); |
@@ -3937,7 +4180,9 @@ discard block |
||
3937 | 4180 | } |
3938 | 4181 | } |
3939 | 4182 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
3940 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4183 | + if ($limit) { |
|
4184 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4185 | + } |
|
3941 | 4186 | |
3942 | 4187 | |
3943 | 4188 | $sth = $this->db->prepare($query); |
@@ -4180,7 +4425,9 @@ discard block |
||
4180 | 4425 | date_default_timezone_set($globalTimezone); |
4181 | 4426 | $datetime = new DateTime($date); |
4182 | 4427 | $offset = $datetime->format('P'); |
4183 | - } else $offset = '+00:00'; |
|
4428 | + } else { |
|
4429 | + $offset = '+00:00'; |
|
4430 | + } |
|
4184 | 4431 | |
4185 | 4432 | if ($globalDBdriver == 'mysql') { |
4186 | 4433 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4228,7 +4475,9 @@ discard block |
||
4228 | 4475 | date_default_timezone_set($globalTimezone); |
4229 | 4476 | $datetime = new DateTime($date); |
4230 | 4477 | $offset = $datetime->format('P'); |
4231 | - } else $offset = '+00:00'; |
|
4478 | + } else { |
|
4479 | + $offset = '+00:00'; |
|
4480 | + } |
|
4232 | 4481 | |
4233 | 4482 | if ($globalDBdriver == 'mysql') { |
4234 | 4483 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4446,7 +4695,9 @@ discard block |
||
4446 | 4695 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
4447 | 4696 | GROUP BY spotter_output.airline_country |
4448 | 4697 | ORDER BY airline_country_count DESC"; |
4449 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4698 | + if ($limit) { |
|
4699 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4700 | + } |
|
4450 | 4701 | |
4451 | 4702 | $sth = $this->db->prepare($query); |
4452 | 4703 | $sth->execute(); |
@@ -4474,7 +4725,9 @@ discard block |
||
4474 | 4725 | global $globalDBdriver; |
4475 | 4726 | //$filter_query = $this->getFilter($filters,true,true); |
4476 | 4727 | $Connection= new Connection($this->db); |
4477 | - if (!$Connection->tableExists('countries')) return array(); |
|
4728 | + if (!$Connection->tableExists('countries')) { |
|
4729 | + return array(); |
|
4730 | + } |
|
4478 | 4731 | /* |
4479 | 4732 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
4480 | 4733 | FROM countries c, spotter_output s |
@@ -4506,7 +4759,9 @@ discard block |
||
4506 | 4759 | } |
4507 | 4760 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country "; |
4508 | 4761 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
4509 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4762 | + if ($limit) { |
|
4763 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4764 | + } |
|
4510 | 4765 | |
4511 | 4766 | |
4512 | 4767 | $sth = $this->db->prepare($query); |
@@ -4556,7 +4811,9 @@ discard block |
||
4556 | 4811 | } |
4557 | 4812 | |
4558 | 4813 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
4559 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4814 | + if ($limit) { |
|
4815 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4816 | + } |
|
4560 | 4817 | |
4561 | 4818 | $sth = $this->db->prepare($query); |
4562 | 4819 | $sth->execute(); |
@@ -4602,7 +4859,9 @@ discard block |
||
4602 | 4859 | } |
4603 | 4860 | |
4604 | 4861 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
4605 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4862 | + if ($limit) { |
|
4863 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4864 | + } |
|
4606 | 4865 | |
4607 | 4866 | $sth = $this->db->prepare($query); |
4608 | 4867 | $sth->execute(); |
@@ -4649,7 +4908,9 @@ discard block |
||
4649 | 4908 | } |
4650 | 4909 | |
4651 | 4910 | $query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
4652 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4911 | + if ($limit) { |
|
4912 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4913 | + } |
|
4653 | 4914 | |
4654 | 4915 | $sth = $this->db->prepare($query); |
4655 | 4916 | $sth->execute(); |
@@ -4702,7 +4963,9 @@ discard block |
||
4702 | 4963 | if($row['registration'] != "") |
4703 | 4964 | { |
4704 | 4965 | $image_array = $Image->getSpotterImage($row['registration']); |
4705 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
4966 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
4967 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
4968 | + } |
|
4706 | 4969 | } |
4707 | 4970 | $temp_array['registration_count'] = $row['registration_count']; |
4708 | 4971 | |
@@ -4777,7 +5040,9 @@ discard block |
||
4777 | 5040 | if($row['registration'] != "") |
4778 | 5041 | { |
4779 | 5042 | $image_array = $Image->getSpotterImage($row['registration']); |
4780 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5043 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5044 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5045 | + } |
|
4781 | 5046 | } |
4782 | 5047 | $temp_array['registration_count'] = $row['registration_count']; |
4783 | 5048 | |
@@ -4884,7 +5149,9 @@ discard block |
||
4884 | 5149 | if($row['registration'] != "") |
4885 | 5150 | { |
4886 | 5151 | $image_array = $Image->getSpotterImage($row['registration']); |
4887 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5152 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5153 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5154 | + } |
|
4888 | 5155 | } |
4889 | 5156 | $temp_array['registration_count'] = $row['registration_count']; |
4890 | 5157 | $aircraft_array[] = $temp_array; |
@@ -5009,7 +5276,9 @@ discard block |
||
5009 | 5276 | date_default_timezone_set($globalTimezone); |
5010 | 5277 | $datetime = new DateTime($date); |
5011 | 5278 | $offset = $datetime->format('P'); |
5012 | - } else $offset = '+00:00'; |
|
5279 | + } else { |
|
5280 | + $offset = '+00:00'; |
|
5281 | + } |
|
5013 | 5282 | |
5014 | 5283 | if ($globalDBdriver == 'mysql') { |
5015 | 5284 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5056,7 +5325,9 @@ discard block |
||
5056 | 5325 | date_default_timezone_set($globalTimezone); |
5057 | 5326 | $datetime = new DateTime($date); |
5058 | 5327 | $offset = $datetime->format('P'); |
5059 | - } else $offset = '+00:00'; |
|
5328 | + } else { |
|
5329 | + $offset = '+00:00'; |
|
5330 | + } |
|
5060 | 5331 | |
5061 | 5332 | if ($globalDBdriver == 'mysql') { |
5062 | 5333 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
@@ -5085,7 +5356,9 @@ discard block |
||
5085 | 5356 | if($row['registration'] != "") |
5086 | 5357 | { |
5087 | 5358 | $image_array = $Image->getSpotterImage($row['registration']); |
5088 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5359 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5360 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5361 | + } |
|
5089 | 5362 | } |
5090 | 5363 | $temp_array['registration_count'] = $row['registration_count']; |
5091 | 5364 | |
@@ -5110,7 +5383,9 @@ discard block |
||
5110 | 5383 | date_default_timezone_set($globalTimezone); |
5111 | 5384 | $datetime = new DateTime($date); |
5112 | 5385 | $offset = $datetime->format('P'); |
5113 | - } else $offset = '+00:00'; |
|
5386 | + } else { |
|
5387 | + $offset = '+00:00'; |
|
5388 | + } |
|
5114 | 5389 | |
5115 | 5390 | if ($globalDBdriver == 'mysql') { |
5116 | 5391 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5208,8 +5483,11 @@ discard block |
||
5208 | 5483 | if($row['registration'] != "") |
5209 | 5484 | { |
5210 | 5485 | $image_array = $Image->getSpotterImage($row['registration']); |
5211 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5212 | - else $temp_array['image_thumbnail'] = ''; |
|
5486 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5487 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5488 | + } else { |
|
5489 | + $temp_array['image_thumbnail'] = ''; |
|
5490 | + } |
|
5213 | 5491 | } |
5214 | 5492 | $temp_array['registration_count'] = $row['registration_count']; |
5215 | 5493 | $aircraft_array[] = $temp_array; |
@@ -5316,7 +5594,9 @@ discard block |
||
5316 | 5594 | if($row['registration'] != "") |
5317 | 5595 | { |
5318 | 5596 | $image_array = $Image->getSpotterImage($row['registration']); |
5319 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5597 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5598 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5599 | + } |
|
5320 | 5600 | } |
5321 | 5601 | $temp_array['registration_count'] = $row['registration_count']; |
5322 | 5602 | |
@@ -5433,7 +5713,9 @@ discard block |
||
5433 | 5713 | if($row['registration'] != "") |
5434 | 5714 | { |
5435 | 5715 | $image_array = $Image->getSpotterImage($row['registration']); |
5436 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5716 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5717 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5718 | + } |
|
5437 | 5719 | } |
5438 | 5720 | $temp_array['registration_count'] = $row['registration_count']; |
5439 | 5721 | |
@@ -5545,7 +5827,9 @@ discard block |
||
5545 | 5827 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5546 | 5828 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5547 | 5829 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
5548 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5830 | + if ($limit) { |
|
5831 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5832 | + } |
|
5549 | 5833 | |
5550 | 5834 | $sth = $this->db->prepare($query); |
5551 | 5835 | $sth->execute(); |
@@ -5564,7 +5848,9 @@ discard block |
||
5564 | 5848 | if($row['registration'] != "") |
5565 | 5849 | { |
5566 | 5850 | $image_array = $Image->getSpotterImage($row['registration']); |
5567 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5851 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5852 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5853 | + } |
|
5568 | 5854 | } |
5569 | 5855 | |
5570 | 5856 | $aircraft_array[] = $temp_array; |
@@ -5605,7 +5891,9 @@ discard block |
||
5605 | 5891 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5606 | 5892 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5607 | 5893 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
5608 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5894 | + if ($limit) { |
|
5895 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5896 | + } |
|
5609 | 5897 | |
5610 | 5898 | $sth = $this->db->prepare($query); |
5611 | 5899 | $sth->execute(); |
@@ -5625,7 +5913,9 @@ discard block |
||
5625 | 5913 | if($row['registration'] != "") |
5626 | 5914 | { |
5627 | 5915 | $image_array = $Image->getSpotterImage($row['registration']); |
5628 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5916 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5917 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5918 | + } |
|
5629 | 5919 | } |
5630 | 5920 | |
5631 | 5921 | $aircraft_array[] = $temp_array; |
@@ -5666,7 +5956,9 @@ discard block |
||
5666 | 5956 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5667 | 5957 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
5668 | 5958 | ORDER BY airport_departure_icao_count DESC"; |
5669 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5959 | + if ($limit) { |
|
5960 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5961 | + } |
|
5670 | 5962 | |
5671 | 5963 | $sth = $this->db->prepare($query); |
5672 | 5964 | $sth->execute(); |
@@ -5718,7 +6010,9 @@ discard block |
||
5718 | 6010 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5719 | 6011 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
5720 | 6012 | ORDER BY airport_departure_icao_count DESC"; |
5721 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6013 | + if ($limit) { |
|
6014 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6015 | + } |
|
5722 | 6016 | |
5723 | 6017 | $sth = $this->db->prepare($query); |
5724 | 6018 | $sth->execute(); |
@@ -5770,7 +6064,9 @@ discard block |
||
5770 | 6064 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5771 | 6065 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
5772 | 6066 | ORDER BY airport_departure_icao_count DESC"; |
5773 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6067 | + if ($limit) { |
|
6068 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6069 | + } |
|
5774 | 6070 | //echo $query; |
5775 | 6071 | $sth = $this->db->prepare($query); |
5776 | 6072 | $sth->execute(); |
@@ -5822,7 +6118,9 @@ discard block |
||
5822 | 6118 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5823 | 6119 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
5824 | 6120 | ORDER BY airport_departure_icao_count DESC"; |
5825 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6121 | + if ($limit) { |
|
6122 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6123 | + } |
|
5826 | 6124 | |
5827 | 6125 | $sth = $this->db->prepare($query); |
5828 | 6126 | $sth->execute(); |
@@ -6217,7 +6515,9 @@ discard block |
||
6217 | 6515 | date_default_timezone_set($globalTimezone); |
6218 | 6516 | $datetime = new DateTime($date); |
6219 | 6517 | $offset = $datetime->format('P'); |
6220 | - } else $offset = '+00:00'; |
|
6518 | + } else { |
|
6519 | + $offset = '+00:00'; |
|
6520 | + } |
|
6221 | 6521 | |
6222 | 6522 | if ($globalDBdriver == 'mysql') { |
6223 | 6523 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
@@ -6267,7 +6567,9 @@ discard block |
||
6267 | 6567 | date_default_timezone_set($globalTimezone); |
6268 | 6568 | $datetime = new DateTime($date); |
6269 | 6569 | $offset = $datetime->format('P'); |
6270 | - } else $offset = '+00:00'; |
|
6570 | + } else { |
|
6571 | + $offset = '+00:00'; |
|
6572 | + } |
|
6271 | 6573 | |
6272 | 6574 | if ($globalDBdriver == 'mysql') { |
6273 | 6575 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -6480,7 +6782,9 @@ discard block |
||
6480 | 6782 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6481 | 6783 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6482 | 6784 | ORDER BY airport_arrival_icao_count DESC"; |
6483 | - if ($limit) $query .= " LIMIT 10"; |
|
6785 | + if ($limit) { |
|
6786 | + $query .= " LIMIT 10"; |
|
6787 | + } |
|
6484 | 6788 | |
6485 | 6789 | |
6486 | 6790 | $sth = $this->db->prepare($query); |
@@ -6500,7 +6804,9 @@ discard block |
||
6500 | 6804 | if ($icaoaskey) { |
6501 | 6805 | $icao = $row['arrival_airport_icao']; |
6502 | 6806 | $airport_array[$icao] = $temp_array; |
6503 | - } else $airport_array[] = $temp_array; |
|
6807 | + } else { |
|
6808 | + $airport_array[] = $temp_array; |
|
6809 | + } |
|
6504 | 6810 | } |
6505 | 6811 | |
6506 | 6812 | return $airport_array; |
@@ -6537,7 +6843,9 @@ discard block |
||
6537 | 6843 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6538 | 6844 | $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6539 | 6845 | ORDER BY airport_arrival_icao_count DESC"; |
6540 | - if ($limit) $query .= " LIMIT 10"; |
|
6846 | + if ($limit) { |
|
6847 | + $query .= " LIMIT 10"; |
|
6848 | + } |
|
6541 | 6849 | |
6542 | 6850 | |
6543 | 6851 | $sth = $this->db->prepare($query); |
@@ -6558,7 +6866,9 @@ discard block |
||
6558 | 6866 | if ($icaoaskey) { |
6559 | 6867 | $icao = $row['arrival_airport_icao']; |
6560 | 6868 | $airport_array[$icao] = $temp_array; |
6561 | - } else $airport_array[] = $temp_array; |
|
6869 | + } else { |
|
6870 | + $airport_array[] = $temp_array; |
|
6871 | + } |
|
6562 | 6872 | } |
6563 | 6873 | |
6564 | 6874 | return $airport_array; |
@@ -6595,7 +6905,9 @@ discard block |
||
6595 | 6905 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6596 | 6906 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
6597 | 6907 | ORDER BY airport_arrival_icao_count DESC"; |
6598 | - if ($limit) $query .= " LIMIT 10"; |
|
6908 | + if ($limit) { |
|
6909 | + $query .= " LIMIT 10"; |
|
6910 | + } |
|
6599 | 6911 | |
6600 | 6912 | |
6601 | 6913 | $sth = $this->db->prepare($query); |
@@ -6615,7 +6927,9 @@ discard block |
||
6615 | 6927 | if ($icaoaskey) { |
6616 | 6928 | $icao = $row['arrival_airport_icao']; |
6617 | 6929 | $airport_array[$icao] = $temp_array; |
6618 | - } else $airport_array[] = $temp_array; |
|
6930 | + } else { |
|
6931 | + $airport_array[] = $temp_array; |
|
6932 | + } |
|
6619 | 6933 | } |
6620 | 6934 | |
6621 | 6935 | return $airport_array; |
@@ -6652,7 +6966,9 @@ discard block |
||
6652 | 6966 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6653 | 6967 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
6654 | 6968 | ORDER BY airport_arrival_icao_count DESC"; |
6655 | - if ($limit) $query .= " LIMIT 10"; |
|
6969 | + if ($limit) { |
|
6970 | + $query .= " LIMIT 10"; |
|
6971 | + } |
|
6656 | 6972 | |
6657 | 6973 | |
6658 | 6974 | $sth = $this->db->prepare($query); |
@@ -6673,7 +6989,9 @@ discard block |
||
6673 | 6989 | if ($icaoaskey) { |
6674 | 6990 | $icao = $row['arrival_airport_icao']; |
6675 | 6991 | $airport_array[$icao] = $temp_array; |
6676 | - } else $airport_array[] = $temp_array; |
|
6992 | + } else { |
|
6993 | + $airport_array[] = $temp_array; |
|
6994 | + } |
|
6677 | 6995 | } |
6678 | 6996 | |
6679 | 6997 | return $airport_array; |
@@ -7054,7 +7372,9 @@ discard block |
||
7054 | 7372 | date_default_timezone_set($globalTimezone); |
7055 | 7373 | $datetime = new DateTime($date); |
7056 | 7374 | $offset = $datetime->format('P'); |
7057 | - } else $offset = '+00:00'; |
|
7375 | + } else { |
|
7376 | + $offset = '+00:00'; |
|
7377 | + } |
|
7058 | 7378 | |
7059 | 7379 | if ($globalDBdriver == 'mysql') { |
7060 | 7380 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
@@ -7104,7 +7424,9 @@ discard block |
||
7104 | 7424 | date_default_timezone_set($globalTimezone); |
7105 | 7425 | $datetime = new DateTime($date); |
7106 | 7426 | $offset = $datetime->format('P'); |
7107 | - } else $offset = '+00:00'; |
|
7427 | + } else { |
|
7428 | + $offset = '+00:00'; |
|
7429 | + } |
|
7108 | 7430 | |
7109 | 7431 | if ($globalDBdriver == 'mysql') { |
7110 | 7432 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -7327,7 +7649,9 @@ discard block |
||
7327 | 7649 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
7328 | 7650 | $query .= " GROUP BY spotter_output.arrival_airport_country |
7329 | 7651 | ORDER BY airport_arrival_country_count DESC"; |
7330 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
7652 | + if ($limit) { |
|
7653 | + $query .= " LIMIT 10 OFFSET 0"; |
|
7654 | + } |
|
7331 | 7655 | |
7332 | 7656 | |
7333 | 7657 | $sth = $this->db->prepare($query); |
@@ -7614,7 +7938,9 @@ discard block |
||
7614 | 7938 | date_default_timezone_set($globalTimezone); |
7615 | 7939 | $datetime = new DateTime($date); |
7616 | 7940 | $offset = $datetime->format('P'); |
7617 | - } else $offset = '+00:00'; |
|
7941 | + } else { |
|
7942 | + $offset = '+00:00'; |
|
7943 | + } |
|
7618 | 7944 | |
7619 | 7945 | if ($globalDBdriver == 'mysql') { |
7620 | 7946 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
@@ -7790,15 +8116,23 @@ discard block |
||
7790 | 8116 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
7791 | 8117 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
7792 | 8118 | if ($olderthanmonths > 0) { |
7793 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
7794 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
8119 | + if ($globalDBdriver == 'mysql') { |
|
8120 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
8121 | + } else { |
|
8122 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
8123 | + } |
|
7795 | 8124 | } |
7796 | 8125 | if ($sincedate != '') { |
7797 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
7798 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
8126 | + if ($globalDBdriver == 'mysql') { |
|
8127 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
8128 | + } else { |
|
8129 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
8130 | + } |
|
7799 | 8131 | } |
7800 | 8132 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
7801 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
8133 | + if ($limit) { |
|
8134 | + $query .= " LIMIT 10 OFFSET 0"; |
|
8135 | + } |
|
7802 | 8136 | |
7803 | 8137 | $sth = $this->db->prepare($query); |
7804 | 8138 | $sth->execute(); |
@@ -7832,15 +8166,23 @@ discard block |
||
7832 | 8166 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
7833 | 8167 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
7834 | 8168 | if ($olderthanmonths > 0) { |
7835 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
7836 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
8169 | + if ($globalDBdriver == 'mysql') { |
|
8170 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
8171 | + } else { |
|
8172 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
8173 | + } |
|
7837 | 8174 | } |
7838 | 8175 | if ($sincedate != '') { |
7839 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
7840 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
8176 | + if ($globalDBdriver == 'mysql') { |
|
8177 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
8178 | + } else { |
|
8179 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
8180 | + } |
|
7841 | 8181 | } |
7842 | 8182 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
7843 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
8183 | + if ($limit) { |
|
8184 | + $query .= " LIMIT 10 OFFSET 0"; |
|
8185 | + } |
|
7844 | 8186 | |
7845 | 8187 | $sth = $this->db->prepare($query); |
7846 | 8188 | $sth->execute(); |
@@ -7877,7 +8219,9 @@ discard block |
||
7877 | 8219 | date_default_timezone_set($globalTimezone); |
7878 | 8220 | $datetime = new DateTime(); |
7879 | 8221 | $offset = $datetime->format('P'); |
7880 | - } else $offset = '+00:00'; |
|
8222 | + } else { |
|
8223 | + $offset = '+00:00'; |
|
8224 | + } |
|
7881 | 8225 | |
7882 | 8226 | if ($globalDBdriver == 'mysql') { |
7883 | 8227 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7926,7 +8270,9 @@ discard block |
||
7926 | 8270 | date_default_timezone_set($globalTimezone); |
7927 | 8271 | $datetime = new DateTime(); |
7928 | 8272 | $offset = $datetime->format('P'); |
7929 | - } else $offset = '+00:00'; |
|
8273 | + } else { |
|
8274 | + $offset = '+00:00'; |
|
8275 | + } |
|
7930 | 8276 | $filter_query = $this->getFilter($filters,true,true); |
7931 | 8277 | if ($globalDBdriver == 'mysql') { |
7932 | 8278 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7975,7 +8321,9 @@ discard block |
||
7975 | 8321 | date_default_timezone_set($globalTimezone); |
7976 | 8322 | $datetime = new DateTime(); |
7977 | 8323 | $offset = $datetime->format('P'); |
7978 | - } else $offset = '+00:00'; |
|
8324 | + } else { |
|
8325 | + $offset = '+00:00'; |
|
8326 | + } |
|
7979 | 8327 | $filter_query = $this->getFilter($filters,true,true); |
7980 | 8328 | if ($globalDBdriver == 'mysql') { |
7981 | 8329 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8021,7 +8369,9 @@ discard block |
||
8021 | 8369 | date_default_timezone_set($globalTimezone); |
8022 | 8370 | $datetime = new DateTime(); |
8023 | 8371 | $offset = $datetime->format('P'); |
8024 | - } else $offset = '+00:00'; |
|
8372 | + } else { |
|
8373 | + $offset = '+00:00'; |
|
8374 | + } |
|
8025 | 8375 | $filter_query = $this->getFilter($filters,true,true); |
8026 | 8376 | if ($globalDBdriver == 'mysql') { |
8027 | 8377 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8069,7 +8419,9 @@ discard block |
||
8069 | 8419 | date_default_timezone_set($globalTimezone); |
8070 | 8420 | $datetime = new DateTime(); |
8071 | 8421 | $offset = $datetime->format('P'); |
8072 | - } else $offset = '+00:00'; |
|
8422 | + } else { |
|
8423 | + $offset = '+00:00'; |
|
8424 | + } |
|
8073 | 8425 | |
8074 | 8426 | if ($globalDBdriver == 'mysql') { |
8075 | 8427 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8117,7 +8469,9 @@ discard block |
||
8117 | 8469 | date_default_timezone_set($globalTimezone); |
8118 | 8470 | $datetime = new DateTime(); |
8119 | 8471 | $offset = $datetime->format('P'); |
8120 | - } else $offset = '+00:00'; |
|
8472 | + } else { |
|
8473 | + $offset = '+00:00'; |
|
8474 | + } |
|
8121 | 8475 | |
8122 | 8476 | if ($globalDBdriver == 'mysql') { |
8123 | 8477 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -8164,7 +8518,9 @@ discard block |
||
8164 | 8518 | date_default_timezone_set($globalTimezone); |
8165 | 8519 | $datetime = new DateTime(); |
8166 | 8520 | $offset = $datetime->format('P'); |
8167 | - } else $offset = '+00:00'; |
|
8521 | + } else { |
|
8522 | + $offset = '+00:00'; |
|
8523 | + } |
|
8168 | 8524 | |
8169 | 8525 | if ($globalDBdriver == 'mysql') { |
8170 | 8526 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -8212,7 +8568,9 @@ discard block |
||
8212 | 8568 | date_default_timezone_set($globalTimezone); |
8213 | 8569 | $datetime = new DateTime(); |
8214 | 8570 | $offset = $datetime->format('P'); |
8215 | - } else $offset = '+00:00'; |
|
8571 | + } else { |
|
8572 | + $offset = '+00:00'; |
|
8573 | + } |
|
8216 | 8574 | $filter_query = $this->getFilter($filters,true,true); |
8217 | 8575 | if ($globalDBdriver == 'mysql') { |
8218 | 8576 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -8257,7 +8615,9 @@ discard block |
||
8257 | 8615 | date_default_timezone_set($globalTimezone); |
8258 | 8616 | $datetime = new DateTime(); |
8259 | 8617 | $offset = $datetime->format('P'); |
8260 | - } else $offset = '+00:00'; |
|
8618 | + } else { |
|
8619 | + $offset = '+00:00'; |
|
8620 | + } |
|
8261 | 8621 | $filter_query = $this->getFilter($filters,true,true); |
8262 | 8622 | |
8263 | 8623 | if ($globalDBdriver == 'mysql') { |
@@ -8304,7 +8664,9 @@ discard block |
||
8304 | 8664 | date_default_timezone_set($globalTimezone); |
8305 | 8665 | $datetime = new DateTime(); |
8306 | 8666 | $offset = $datetime->format('P'); |
8307 | - } else $offset = '+00:00'; |
|
8667 | + } else { |
|
8668 | + $offset = '+00:00'; |
|
8669 | + } |
|
8308 | 8670 | |
8309 | 8671 | if ($globalDBdriver == 'mysql') { |
8310 | 8672 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
@@ -8350,7 +8712,9 @@ discard block |
||
8350 | 8712 | date_default_timezone_set($globalTimezone); |
8351 | 8713 | $datetime = new DateTime(); |
8352 | 8714 | $offset = $datetime->format('P'); |
8353 | - } else $offset = '+00:00'; |
|
8715 | + } else { |
|
8716 | + $offset = '+00:00'; |
|
8717 | + } |
|
8354 | 8718 | $filter_query = $this->getFilter($filters,true,true); |
8355 | 8719 | |
8356 | 8720 | if ($globalDBdriver == 'mysql') { |
@@ -8397,7 +8761,9 @@ discard block |
||
8397 | 8761 | date_default_timezone_set($globalTimezone); |
8398 | 8762 | $datetime = new DateTime(); |
8399 | 8763 | $offset = $datetime->format('P'); |
8400 | - } else $offset = '+00:00'; |
|
8764 | + } else { |
|
8765 | + $offset = '+00:00'; |
|
8766 | + } |
|
8401 | 8767 | |
8402 | 8768 | if ($globalDBdriver == 'mysql') { |
8403 | 8769 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
@@ -8444,7 +8810,9 @@ discard block |
||
8444 | 8810 | date_default_timezone_set($globalTimezone); |
8445 | 8811 | $datetime = new DateTime(); |
8446 | 8812 | $offset = $datetime->format('P'); |
8447 | - } else $offset = '+00:00'; |
|
8813 | + } else { |
|
8814 | + $offset = '+00:00'; |
|
8815 | + } |
|
8448 | 8816 | |
8449 | 8817 | if ($globalDBdriver == 'mysql') { |
8450 | 8818 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
@@ -8489,7 +8857,9 @@ discard block |
||
8489 | 8857 | date_default_timezone_set($globalTimezone); |
8490 | 8858 | $datetime = new DateTime(); |
8491 | 8859 | $offset = $datetime->format('P'); |
8492 | - } else $offset = '+00:00'; |
|
8860 | + } else { |
|
8861 | + $offset = '+00:00'; |
|
8862 | + } |
|
8493 | 8863 | $filter_query = $this->getFilter($filters,true,true); |
8494 | 8864 | |
8495 | 8865 | if ($globalDBdriver == 'mysql') { |
@@ -8537,7 +8907,9 @@ discard block |
||
8537 | 8907 | date_default_timezone_set($globalTimezone); |
8538 | 8908 | $datetime = new DateTime(); |
8539 | 8909 | $offset = $datetime->format('P'); |
8540 | - } else $offset = '+00:00'; |
|
8910 | + } else { |
|
8911 | + $offset = '+00:00'; |
|
8912 | + } |
|
8541 | 8913 | |
8542 | 8914 | if ($globalDBdriver == 'mysql') { |
8543 | 8915 | $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
@@ -8583,7 +8955,9 @@ discard block |
||
8583 | 8955 | date_default_timezone_set($globalTimezone); |
8584 | 8956 | $datetime = new DateTime(); |
8585 | 8957 | $offset = $datetime->format('P'); |
8586 | - } else $offset = '+00:00'; |
|
8958 | + } else { |
|
8959 | + $offset = '+00:00'; |
|
8960 | + } |
|
8587 | 8961 | $filter_query = $this->getFilter($filters,true,true); |
8588 | 8962 | |
8589 | 8963 | if ($globalDBdriver == 'mysql') { |
@@ -8631,7 +9005,9 @@ discard block |
||
8631 | 9005 | date_default_timezone_set($globalTimezone); |
8632 | 9006 | $datetime = new DateTime(); |
8633 | 9007 | $offset = $datetime->format('P'); |
8634 | - } else $offset = '+00:00'; |
|
9008 | + } else { |
|
9009 | + $offset = '+00:00'; |
|
9010 | + } |
|
8635 | 9011 | |
8636 | 9012 | if ($globalDBdriver == 'mysql') { |
8637 | 9013 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
@@ -8678,7 +9054,9 @@ discard block |
||
8678 | 9054 | date_default_timezone_set($globalTimezone); |
8679 | 9055 | $datetime = new DateTime(); |
8680 | 9056 | $offset = $datetime->format('P'); |
8681 | - } else $offset = '+00:00'; |
|
9057 | + } else { |
|
9058 | + $offset = '+00:00'; |
|
9059 | + } |
|
8682 | 9060 | $filter_query = $this->getFilter($filters,true,true); |
8683 | 9061 | if ($globalDBdriver == 'mysql') { |
8684 | 9062 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -8727,7 +9105,9 @@ discard block |
||
8727 | 9105 | date_default_timezone_set($globalTimezone); |
8728 | 9106 | $datetime = new DateTime(); |
8729 | 9107 | $offset = $datetime->format('P'); |
8730 | - } else $offset = '+00:00'; |
|
9108 | + } else { |
|
9109 | + $offset = '+00:00'; |
|
9110 | + } |
|
8731 | 9111 | |
8732 | 9112 | $orderby_sql = ''; |
8733 | 9113 | if ($orderby == "hour") |
@@ -8793,7 +9173,9 @@ discard block |
||
8793 | 9173 | date_default_timezone_set($globalTimezone); |
8794 | 9174 | $datetime = new DateTime(); |
8795 | 9175 | $offset = $datetime->format('P'); |
8796 | - } else $offset = '+00:00'; |
|
9176 | + } else { |
|
9177 | + $offset = '+00:00'; |
|
9178 | + } |
|
8797 | 9179 | |
8798 | 9180 | $orderby_sql = ''; |
8799 | 9181 | if ($orderby == "hour") |
@@ -8860,7 +9242,9 @@ discard block |
||
8860 | 9242 | date_default_timezone_set($globalTimezone); |
8861 | 9243 | $datetime = new DateTime(); |
8862 | 9244 | $offset = $datetime->format('P'); |
8863 | - } else $offset = '+00:00'; |
|
9245 | + } else { |
|
9246 | + $offset = '+00:00'; |
|
9247 | + } |
|
8864 | 9248 | |
8865 | 9249 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
8866 | 9250 | |
@@ -8911,7 +9295,9 @@ discard block |
||
8911 | 9295 | date_default_timezone_set($globalTimezone); |
8912 | 9296 | $datetime = new DateTime(); |
8913 | 9297 | $offset = $datetime->format('P'); |
8914 | - } else $offset = '+00:00'; |
|
9298 | + } else { |
|
9299 | + $offset = '+00:00'; |
|
9300 | + } |
|
8915 | 9301 | |
8916 | 9302 | if ($globalDBdriver == 'mysql') { |
8917 | 9303 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8958,7 +9344,9 @@ discard block |
||
8958 | 9344 | date_default_timezone_set($globalTimezone); |
8959 | 9345 | $datetime = new DateTime(); |
8960 | 9346 | $offset = $datetime->format('P'); |
8961 | - } else $offset = '+00:00'; |
|
9347 | + } else { |
|
9348 | + $offset = '+00:00'; |
|
9349 | + } |
|
8962 | 9350 | |
8963 | 9351 | if ($globalDBdriver == 'mysql') { |
8964 | 9352 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9005,7 +9393,9 @@ discard block |
||
9005 | 9393 | date_default_timezone_set($globalTimezone); |
9006 | 9394 | $datetime = new DateTime(); |
9007 | 9395 | $offset = $datetime->format('P'); |
9008 | - } else $offset = '+00:00'; |
|
9396 | + } else { |
|
9397 | + $offset = '+00:00'; |
|
9398 | + } |
|
9009 | 9399 | |
9010 | 9400 | if ($globalDBdriver == 'mysql') { |
9011 | 9401 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9053,7 +9443,9 @@ discard block |
||
9053 | 9443 | date_default_timezone_set($globalTimezone); |
9054 | 9444 | $datetime = new DateTime(); |
9055 | 9445 | $offset = $datetime->format('P'); |
9056 | - } else $offset = '+00:00'; |
|
9446 | + } else { |
|
9447 | + $offset = '+00:00'; |
|
9448 | + } |
|
9057 | 9449 | |
9058 | 9450 | if ($globalDBdriver == 'mysql') { |
9059 | 9451 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9101,7 +9493,9 @@ discard block |
||
9101 | 9493 | date_default_timezone_set($globalTimezone); |
9102 | 9494 | $datetime = new DateTime($date); |
9103 | 9495 | $offset = $datetime->format('P'); |
9104 | - } else $offset = '+00:00'; |
|
9496 | + } else { |
|
9497 | + $offset = '+00:00'; |
|
9498 | + } |
|
9105 | 9499 | |
9106 | 9500 | if ($globalDBdriver == 'mysql') { |
9107 | 9501 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9149,7 +9543,9 @@ discard block |
||
9149 | 9543 | date_default_timezone_set($globalTimezone); |
9150 | 9544 | $datetime = new DateTime(); |
9151 | 9545 | $offset = $datetime->format('P'); |
9152 | - } else $offset = '+00:00'; |
|
9546 | + } else { |
|
9547 | + $offset = '+00:00'; |
|
9548 | + } |
|
9153 | 9549 | |
9154 | 9550 | if ($globalDBdriver == 'mysql') { |
9155 | 9551 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9199,7 +9595,9 @@ discard block |
||
9199 | 9595 | date_default_timezone_set($globalTimezone); |
9200 | 9596 | $datetime = new DateTime(); |
9201 | 9597 | $offset = $datetime->format('P'); |
9202 | - } else $offset = '+00:00'; |
|
9598 | + } else { |
|
9599 | + $offset = '+00:00'; |
|
9600 | + } |
|
9203 | 9601 | |
9204 | 9602 | if ($globalDBdriver == 'mysql') { |
9205 | 9603 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9246,7 +9644,9 @@ discard block |
||
9246 | 9644 | date_default_timezone_set($globalTimezone); |
9247 | 9645 | $datetime = new DateTime(); |
9248 | 9646 | $offset = $datetime->format('P'); |
9249 | - } else $offset = '+00:00'; |
|
9647 | + } else { |
|
9648 | + $offset = '+00:00'; |
|
9649 | + } |
|
9250 | 9650 | |
9251 | 9651 | if ($globalDBdriver == 'mysql') { |
9252 | 9652 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9414,7 +9814,9 @@ discard block |
||
9414 | 9814 | date_default_timezone_set($globalTimezone); |
9415 | 9815 | $datetime = new DateTime(); |
9416 | 9816 | $offset = $datetime->format('P'); |
9417 | - } else $offset = '+00:00'; |
|
9817 | + } else { |
|
9818 | + $offset = '+00:00'; |
|
9819 | + } |
|
9418 | 9820 | |
9419 | 9821 | if ($globalDBdriver == 'mysql') { |
9420 | 9822 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9600,7 +10002,9 @@ discard block |
||
9600 | 10002 | */ |
9601 | 10003 | public function parseDirection($direction = 0) |
9602 | 10004 | { |
9603 | - if ($direction == '') $direction = 0; |
|
10005 | + if ($direction == '') { |
|
10006 | + $direction = 0; |
|
10007 | + } |
|
9604 | 10008 | $direction_array = array(); |
9605 | 10009 | $temp_array = array(); |
9606 | 10010 | |
@@ -9701,7 +10105,9 @@ discard block |
||
9701 | 10105 | if (isset($result->AirlineFlightInfoResult)) |
9702 | 10106 | { |
9703 | 10107 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
9704 | - } else return ''; |
|
10108 | + } else { |
|
10109 | + return ''; |
|
10110 | + } |
|
9705 | 10111 | |
9706 | 10112 | $registration = $this->convertAircraftRegistration($registration); |
9707 | 10113 | |
@@ -9730,7 +10136,9 @@ discard block |
||
9730 | 10136 | if (count($row) > 0) { |
9731 | 10137 | //return $row['Registration']; |
9732 | 10138 | return $row['registration']; |
9733 | - } else return ''; |
|
10139 | + } else { |
|
10140 | + return ''; |
|
10141 | + } |
|
9734 | 10142 | |
9735 | 10143 | } |
9736 | 10144 | |
@@ -9753,9 +10161,14 @@ discard block |
||
9753 | 10161 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
9754 | 10162 | $sth->closeCursor(); |
9755 | 10163 | if (count($row) > 0) { |
9756 | - if ($row['type_flight'] == null) return ''; |
|
9757 | - else return $row['type_flight']; |
|
9758 | - } else return ''; |
|
10164 | + if ($row['type_flight'] == null) { |
|
10165 | + return ''; |
|
10166 | + } else { |
|
10167 | + return $row['type_flight']; |
|
10168 | + } |
|
10169 | + } else { |
|
10170 | + return ''; |
|
10171 | + } |
|
9759 | 10172 | |
9760 | 10173 | } |
9761 | 10174 | |
@@ -9773,7 +10186,9 @@ discard block |
||
9773 | 10186 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
9774 | 10187 | |
9775 | 10188 | $Connection = new Connection($this->db); |
9776 | - if (!$Connection->tableExists('countries')) return ''; |
|
10189 | + if (!$Connection->tableExists('countries')) { |
|
10190 | + return ''; |
|
10191 | + } |
|
9777 | 10192 | |
9778 | 10193 | try { |
9779 | 10194 | /* |
@@ -9793,9 +10208,13 @@ discard block |
||
9793 | 10208 | $sth->closeCursor(); |
9794 | 10209 | if (count($row) > 0) { |
9795 | 10210 | return $row; |
9796 | - } else return ''; |
|
10211 | + } else { |
|
10212 | + return ''; |
|
10213 | + } |
|
9797 | 10214 | } catch (PDOException $e) { |
9798 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
10215 | + if (isset($globalDebug) && $globalDebug) { |
|
10216 | + echo 'Error : '.$e->getMessage()."\n"; |
|
10217 | + } |
|
9799 | 10218 | return ''; |
9800 | 10219 | } |
9801 | 10220 | |
@@ -9813,7 +10232,9 @@ discard block |
||
9813 | 10232 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
9814 | 10233 | |
9815 | 10234 | $Connection = new Connection($this->db); |
9816 | - if (!$Connection->tableExists('countries')) return ''; |
|
10235 | + if (!$Connection->tableExists('countries')) { |
|
10236 | + return ''; |
|
10237 | + } |
|
9817 | 10238 | |
9818 | 10239 | try { |
9819 | 10240 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -9825,9 +10246,13 @@ discard block |
||
9825 | 10246 | $sth->closeCursor(); |
9826 | 10247 | if (count($row) > 0) { |
9827 | 10248 | return $row; |
9828 | - } else return ''; |
|
10249 | + } else { |
|
10250 | + return ''; |
|
10251 | + } |
|
9829 | 10252 | } catch (PDOException $e) { |
9830 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
10253 | + if (isset($globalDebug) && $globalDebug) { |
|
10254 | + echo 'Error : '.$e->getMessage()."\n"; |
|
10255 | + } |
|
9831 | 10256 | return ''; |
9832 | 10257 | } |
9833 | 10258 | |
@@ -10058,7 +10483,9 @@ discard block |
||
10058 | 10483 | { |
10059 | 10484 | global $globalBitlyAccessToken; |
10060 | 10485 | |
10061 | - if ($globalBitlyAccessToken == '') return $url; |
|
10486 | + if ($globalBitlyAccessToken == '') { |
|
10487 | + return $url; |
|
10488 | + } |
|
10062 | 10489 | |
10063 | 10490 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
10064 | 10491 | |
@@ -10207,7 +10634,9 @@ discard block |
||
10207 | 10634 | |
10208 | 10635 | |
10209 | 10636 | // routes |
10210 | - if ($globalDebug) print "Routes...\n"; |
|
10637 | + if ($globalDebug) { |
|
10638 | + print "Routes...\n"; |
|
10639 | + } |
|
10211 | 10640 | if ($globalDBdriver == 'mysql') { |
10212 | 10641 | $query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
10213 | 10642 | } else { |
@@ -10226,7 +10655,9 @@ discard block |
||
10226 | 10655 | } |
10227 | 10656 | } |
10228 | 10657 | |
10229 | - if ($globalDebug) print "Airlines...\n"; |
|
10658 | + if ($globalDebug) { |
|
10659 | + print "Airlines...\n"; |
|
10660 | + } |
|
10230 | 10661 | //airlines |
10231 | 10662 | if ($globalDBdriver == 'mysql') { |
10232 | 10663 | $query = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
@@ -10240,10 +10671,15 @@ discard block |
||
10240 | 10671 | if (is_numeric(substr($row['ident'], -1, 1))) |
10241 | 10672 | { |
10242 | 10673 | $fromsource = NULL; |
10243 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
10244 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
10245 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
10246 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
10674 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
10675 | + $fromsource = 'vatsim'; |
|
10676 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
10677 | + $fromsource = 'ivao'; |
|
10678 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
10679 | + $fromsource = 'vatsim'; |
|
10680 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
10681 | + $fromsource = 'ivao'; |
|
10682 | + } |
|
10247 | 10683 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
10248 | 10684 | if (isset($airline_array[0]['name'])) { |
10249 | 10685 | $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
@@ -10253,13 +10689,17 @@ discard block |
||
10253 | 10689 | } |
10254 | 10690 | } |
10255 | 10691 | |
10256 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
10692 | + if ($globalDebug) { |
|
10693 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
10694 | + } |
|
10257 | 10695 | //duplicate modes |
10258 | 10696 | $query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL"; |
10259 | 10697 | $sth = $this->db->prepare($query); |
10260 | 10698 | $sth->execute(); |
10261 | 10699 | |
10262 | - if ($globalDebug) print "Aircraft...\n"; |
|
10700 | + if ($globalDebug) { |
|
10701 | + print "Aircraft...\n"; |
|
10702 | + } |
|
10263 | 10703 | //aircraft |
10264 | 10704 | if ($globalDBdriver == 'mysql') { |
10265 | 10705 | $query = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -10302,26 +10742,38 @@ discard block |
||
10302 | 10742 | if (isset($closestAirports[0])) { |
10303 | 10743 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
10304 | 10744 | $airport_icao = $closestAirports[0]['icao']; |
10305 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
10745 | + if ($globalDebug) { |
|
10746 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
10747 | + } |
|
10306 | 10748 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
10307 | 10749 | foreach ($closestAirports as $airport) { |
10308 | 10750 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
10309 | 10751 | $airport_icao = $airport['icao']; |
10310 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
10752 | + if ($globalDebug) { |
|
10753 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
10754 | + } |
|
10311 | 10755 | break; |
10312 | 10756 | } |
10313 | 10757 | } |
10314 | 10758 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
10315 | 10759 | $airport_icao = $closestAirports[0]['icao']; |
10316 | - if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
10760 | + if ($globalDebug) { |
|
10761 | + echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
10762 | + } |
|
10317 | 10763 | } else { |
10318 | - if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
10764 | + if ($globalDebug) { |
|
10765 | + echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
10766 | + } |
|
10319 | 10767 | } |
10320 | 10768 | } else { |
10321 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
10769 | + if ($globalDebug) { |
|
10770 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
10771 | + } |
|
10322 | 10772 | } |
10323 | 10773 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
10324 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
10774 | + if ($globalDebug) { |
|
10775 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
10776 | + } |
|
10325 | 10777 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
10326 | 10778 | $sthu = $this->db->prepare($update_query); |
10327 | 10779 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -135,11 +135,26 @@ discard block |
||
135 | 135 | <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li> |
136 | 136 | <li><?php echo _("NOTAM scope:"); ?> |
137 | 137 | <select class="selectpicker" onchange="notamscope(this);"> |
138 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
139 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
140 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
141 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
142 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
138 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
139 | + print ' selected'; |
|
140 | +} |
|
141 | +?>>All</option> |
|
142 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
143 | + print ' selected'; |
|
144 | +} |
|
145 | +?>>Airport/Enroute warning</option> |
|
146 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
147 | + print ' selected'; |
|
148 | +} |
|
149 | +?>>Airport warning</option> |
|
150 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
151 | + print ' selected'; |
|
152 | +} |
|
153 | +?>>Navigation warning</option> |
|
154 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
155 | + print ' selected'; |
|
156 | +} |
|
157 | +?>>Enroute warning</option> |
|
143 | 158 | </select |
144 | 159 | </li> |
145 | 160 | </ul> |
@@ -167,7 +182,12 @@ discard block |
||
167 | 182 | <div class="form-group"> |
168 | 183 | <label>From (UTC):</label> |
169 | 184 | <div class='input-group date' id='datetimepicker1'> |
170 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> |
|
185 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) { |
|
186 | + print $_POST['start_date']; |
|
187 | +} elseif (isset($_COOKIE['archive_begin'])) { |
|
188 | + print date("m/d/Y h:i a",$_COOKIE['archive_begin']); |
|
189 | +} |
|
190 | +?>" required /> |
|
171 | 191 | <span class="input-group-addon"> |
172 | 192 | <span class="glyphicon glyphicon-calendar"></span> |
173 | 193 | </span> |
@@ -176,7 +196,12 @@ discard block |
||
176 | 196 | <div class="form-group"> |
177 | 197 | <label>To (UTC):</label> |
178 | 198 | <div class='input-group date' id='datetimepicker2'> |
179 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" /> |
|
199 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) { |
|
200 | + print $_POST['end_date']; |
|
201 | +} elseif (isset($_COOKIE['archive_end'])) { |
|
202 | + print date("m/d/Y h:i a",$_COOKIE['archive_end']); |
|
203 | +} |
|
204 | +?>" /> |
|
180 | 205 | <span class="input-group-addon"> |
181 | 206 | <span class="glyphicon glyphicon-calendar"></span> |
182 | 207 | </span> |
@@ -202,8 +227,20 @@ discard block |
||
202 | 227 | |
203 | 228 | <li><?php echo _("Playback speed:"); ?> |
204 | 229 | <div class="range"> |
205 | - <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>"> |
|
206 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
230 | + <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
231 | + print $_POST['archivespeed']; |
|
232 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
233 | + print $_COOKIE['archive_speed']; |
|
234 | +} else { |
|
235 | + print '1'; |
|
236 | +} |
|
237 | +?>"> |
|
238 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
239 | + print $_COOKIE['archive_speed']; |
|
240 | +} else { |
|
241 | + print '1'; |
|
242 | +} |
|
243 | +?></output> |
|
207 | 244 | </div> |
208 | 245 | </li> |
209 | 246 | <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li> |
@@ -225,15 +262,27 @@ discard block |
||
225 | 262 | <li><?php echo _("Type of Map:"); ?> |
226 | 263 | <select class="selectpicker" onchange="mapType(this);"> |
227 | 264 | <?php |
228 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
229 | - else $MapType = $_COOKIE['MapType']; |
|
265 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
266 | + $MapType = $globalMapProvider; |
|
267 | + } else { |
|
268 | + $MapType = $_COOKIE['MapType']; |
|
269 | + } |
|
230 | 270 | ?> |
231 | 271 | <?php |
232 | 272 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
233 | 273 | ?> |
234 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
235 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
236 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
274 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
275 | + print ' selected'; |
|
276 | +} |
|
277 | +?>>Bing-Aerial</option> |
|
278 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
279 | + print ' selected'; |
|
280 | +} |
|
281 | +?>>Bing-Hybrid</option> |
|
282 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
283 | + print ' selected'; |
|
284 | +} |
|
285 | +?>>Bing-Road</option> |
|
237 | 286 | <?php |
238 | 287 | } |
239 | 288 | ?> |
@@ -243,56 +292,131 @@ discard block |
||
243 | 292 | <?php |
244 | 293 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
245 | 294 | ?> |
246 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
247 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
248 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
295 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
296 | + print ' selected'; |
|
297 | +} |
|
298 | +?>>Here-Aerial</option> |
|
299 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
300 | + print ' selected'; |
|
301 | +} |
|
302 | +?>>Here-Hybrid</option> |
|
303 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
304 | + print ' selected'; |
|
305 | +} |
|
306 | +?>>Here-Road</option> |
|
249 | 307 | <?php |
250 | 308 | } |
251 | 309 | ?> |
252 | 310 | <?php |
253 | 311 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
254 | 312 | ?> |
255 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
256 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
257 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
258 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
313 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
314 | + print ' selected'; |
|
315 | +} |
|
316 | +?>>Google Roadmap</option> |
|
317 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
318 | + print ' selected'; |
|
319 | +} |
|
320 | +?>>Google Satellite</option> |
|
321 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
322 | + print ' selected'; |
|
323 | +} |
|
324 | +?>>Google Hybrid</option> |
|
325 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
326 | + print ' selected'; |
|
327 | +} |
|
328 | +?>>Google Terrain</option> |
|
259 | 329 | <?php |
260 | 330 | } |
261 | 331 | ?> |
262 | 332 | <?php |
263 | 333 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
264 | 334 | ?> |
265 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
266 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
267 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
335 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
336 | + print ' selected'; |
|
337 | +} |
|
338 | +?>>MapQuest-OSM</option> |
|
339 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
340 | + print ' selected'; |
|
341 | +} |
|
342 | +?>>MapQuest-Aerial</option> |
|
343 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
344 | + print ' selected'; |
|
345 | +} |
|
346 | +?>>MapQuest-Hybrid</option> |
|
268 | 347 | <?php |
269 | 348 | } |
270 | 349 | ?> |
271 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
350 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
351 | + print ' selected'; |
|
352 | +} |
|
353 | +?>>Yandex</option> |
|
272 | 354 | <?php |
273 | 355 | } |
274 | 356 | ?> |
275 | 357 | <?php |
276 | 358 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
277 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
278 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
359 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
360 | + $MapBoxId = 'default'; |
|
361 | + } else { |
|
362 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
363 | + } |
|
279 | 364 | ?> |
280 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
281 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
282 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
283 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
284 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
285 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
286 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
287 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
288 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
289 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
290 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
291 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
365 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
366 | + print ' selected'; |
|
367 | +} |
|
368 | +?>>Mapbox default</option> |
|
369 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
370 | + print ' selected'; |
|
371 | +} |
|
372 | +?>>Mapbox streets</option> |
|
373 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
374 | + print ' selected'; |
|
375 | +} |
|
376 | +?>>Mapbox light</option> |
|
377 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
378 | + print ' selected'; |
|
379 | +} |
|
380 | +?>>Mapbox dark</option> |
|
381 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
382 | + print ' selected'; |
|
383 | +} |
|
384 | +?>>Mapbox satellite</option> |
|
385 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
386 | + print ' selected'; |
|
387 | +} |
|
388 | +?>>Mapbox streets-satellite</option> |
|
389 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
390 | + print ' selected'; |
|
391 | +} |
|
392 | +?>>Mapbox streets-basic</option> |
|
393 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
394 | + print ' selected'; |
|
395 | +} |
|
396 | +?>>Mapbox comic</option> |
|
397 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
398 | + print ' selected'; |
|
399 | +} |
|
400 | +?>>Mapbox outdoors</option> |
|
401 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
402 | + print ' selected'; |
|
403 | +} |
|
404 | +?>>Mapbox pencil</option> |
|
405 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
406 | + print ' selected'; |
|
407 | +} |
|
408 | +?>>Mapbox pirates</option> |
|
409 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
410 | + print ' selected'; |
|
411 | +} |
|
412 | +?>>Mapbox emerald</option> |
|
292 | 413 | <?php |
293 | 414 | } |
294 | 415 | ?> |
295 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
416 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
417 | + print ' selected'; |
|
418 | +} |
|
419 | +?>>OpenStreetMap</option> |
|
296 | 420 | </select> |
297 | 421 | </li> |
298 | 422 | <?php |
@@ -300,9 +424,18 @@ discard block |
||
300 | 424 | ?> |
301 | 425 | <li><?php echo _("Type of Terrain:"); ?> |
302 | 426 | <select class="selectpicker" onchange="terrainType(this);"> |
303 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
304 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
305 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
427 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
428 | + print ' selected'; |
|
429 | +} |
|
430 | +?>>stk terrain</option> |
|
431 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
432 | + print ' selected'; |
|
433 | +} |
|
434 | +?>>ellipsoid</option> |
|
435 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
436 | + print ' selected'; |
|
437 | +} |
|
438 | +?>>vr terrain</option> |
|
306 | 439 | </select> |
307 | 440 | </li> |
308 | 441 | <?php |
@@ -312,18 +445,36 @@ discard block |
||
312 | 445 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
313 | 446 | ?> |
314 | 447 | |
315 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
|
316 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
317 | - <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
318 | - <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
448 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
449 | + print 'checked'; |
|
450 | +} |
|
451 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
|
452 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) { |
|
453 | + print 'checked'; |
|
454 | +} |
|
455 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
456 | + <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) { |
|
457 | + print 'checked'; |
|
458 | +} |
|
459 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
460 | + <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
461 | + print 'checked'; |
|
462 | +} |
|
463 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
319 | 464 | <?php |
320 | 465 | } |
321 | 466 | ?> |
322 | - <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
467 | + <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') { |
|
468 | + print 'checked'; |
|
469 | +} |
|
470 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
323 | 471 | <?php |
324 | 472 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
325 | 473 | ?> |
326 | - <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
474 | + <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) { |
|
475 | + print 'checked'; |
|
476 | +} |
|
477 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
327 | 478 | <?php |
328 | 479 | } |
329 | 480 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -337,17 +488,25 @@ discard block |
||
337 | 488 | if (function_exists('array_column')) { |
338 | 489 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
339 | 490 | ?> |
340 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
491 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
492 | + print 'checked'; |
|
493 | +} |
|
494 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
341 | 495 | <?php |
342 | 496 | } |
343 | 497 | } elseif (isset($globalSources)) { |
344 | 498 | $dispolar = false; |
345 | 499 | foreach ($globalSources as $testsource) { |
346 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
500 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
501 | + $dispolar = true; |
|
502 | + } |
|
347 | 503 | } |
348 | 504 | if ($dispolar) { |
349 | 505 | ?> |
350 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
506 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
507 | + print 'checked'; |
|
508 | +} |
|
509 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
351 | 510 | <?php |
352 | 511 | } |
353 | 512 | } |
@@ -359,12 +518,22 @@ discard block |
||
359 | 518 | <?php |
360 | 519 | if (extension_loaded('gd') && function_exists('gd_info')) { |
361 | 520 | ?> |
362 | - <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
521 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
522 | + print 'checked'; |
|
523 | +} |
|
524 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
363 | 525 | <?php |
364 | 526 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
365 | 527 | ?> |
366 | 528 | <li><?php echo _("Aircraft icon color:"); ?> |
367 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"> |
|
529 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
530 | + print $_COOKIE['IconColor']; |
|
531 | +} elseif (isset($globalAircraftIconColor)) { |
|
532 | + print $globalAircraftIconColor; |
|
533 | +} else { |
|
534 | + print '1a3151'; |
|
535 | +} |
|
536 | +?>"> |
|
368 | 537 | </li> |
369 | 538 | <?php |
370 | 539 | } |
@@ -372,8 +541,22 @@ discard block |
||
372 | 541 | ?> |
373 | 542 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
374 | 543 | <div class="range"> |
375 | - <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
|
376 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
544 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
545 | + print $_COOKIE['AirportZoom']; |
|
546 | +} elseif (isset($globalAirportZoom)) { |
|
547 | + print $globalAirportZoom; |
|
548 | +} else { |
|
549 | + print '7'; |
|
550 | +} |
|
551 | +?>"> |
|
552 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
553 | + print $_COOKIE['AirportZoom']; |
|
554 | +} elseif (isset($globalAirportZoom)) { |
|
555 | + print $globalAirportZoom; |
|
556 | +} else { |
|
557 | + print '7'; |
|
558 | +} |
|
559 | +?></output> |
|
377 | 560 | </div> |
378 | 561 | </li> |
379 | 562 | <?php |
@@ -381,22 +564,46 @@ discard block |
||
381 | 564 | ?> |
382 | 565 | <li><?php echo _("Distance unit:"); ?> |
383 | 566 | <select class="selectpicker" onchange="unitdistance(this);"> |
384 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
385 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
386 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
567 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
568 | + echo ' selected'; |
|
569 | +} |
|
570 | +?>>km</option> |
|
571 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
572 | + echo ' selected'; |
|
573 | +} |
|
574 | +?>>nm</option> |
|
575 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
576 | + echo ' selected'; |
|
577 | +} |
|
578 | +?>>mi</option> |
|
387 | 579 | </select> |
388 | 580 | </li> |
389 | 581 | <li><?php echo _("Altitude unit:"); ?> |
390 | 582 | <select class="selectpicker" onchange="unitaltitude(this);"> |
391 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
392 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
583 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
584 | + echo ' selected'; |
|
585 | +} |
|
586 | +?>>m</option> |
|
587 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
588 | + echo ' selected'; |
|
589 | +} |
|
590 | +?>>feet</option> |
|
393 | 591 | </select> |
394 | 592 | </li> |
395 | 593 | <li><?php echo _("Speed unit:"); ?> |
396 | 594 | <select class="selectpicker" onchange="unitspeed(this);"> |
397 | - <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option> |
|
398 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
399 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
595 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
596 | + echo ' selected'; |
|
597 | +} |
|
598 | +?>>km/h</option> |
|
599 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
600 | + echo ' selected'; |
|
601 | +} |
|
602 | +?>>mph</option> |
|
603 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
604 | + echo ' selected'; |
|
605 | +} |
|
606 | +?>>knots</option> |
|
400 | 607 | </select> |
401 | 608 | </li> |
402 | 609 | |
@@ -411,9 +618,18 @@ discard block |
||
411 | 618 | <?php |
412 | 619 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
413 | 620 | ?> |
414 | - <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
415 | - <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
416 | - <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
621 | + <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) { |
|
622 | + print 'checked'; |
|
623 | +} |
|
624 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
625 | + <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) { |
|
626 | + print 'checked'; |
|
627 | +} |
|
628 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
629 | + <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) { |
|
630 | + print 'checked'; |
|
631 | +} |
|
632 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
417 | 633 | <?php |
418 | 634 | } |
419 | 635 | ?> |
@@ -421,10 +637,16 @@ discard block |
||
421 | 637 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
422 | 638 | ?> |
423 | 639 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
424 | - <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
640 | + <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) { |
|
641 | + print 'checked'; |
|
642 | +} |
|
643 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
425 | 644 | <?php } ?> |
426 | 645 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
427 | - <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
646 | + <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) { |
|
647 | + print 'checked'; |
|
648 | +} |
|
649 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
428 | 650 | <?php } ?> |
429 | 651 | <?php |
430 | 652 | } |
@@ -441,7 +663,9 @@ discard block |
||
441 | 663 | } |
442 | 664 | foreach($allairlinenames as $airline) { |
443 | 665 | $airline_name = $airline['airline_name']; |
444 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
666 | + if (strlen($airline_name) > 30) { |
|
667 | + $airline_name = substr($airline_name,0,30).'...'; |
|
668 | + } |
|
445 | 669 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
446 | 670 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
447 | 671 | } else { |
@@ -459,7 +683,10 @@ discard block |
||
459 | 683 | <li><?php echo _("Display alliance:"); ?> |
460 | 684 | <br/> |
461 | 685 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
462 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
686 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
687 | + echo ' selected'; |
|
688 | +} |
|
689 | +?>><?php echo _("All"); ?></option> |
|
463 | 690 | <?php |
464 | 691 | foreach($allalliancenames as $alliance) { |
465 | 692 | $alliance_name = $alliance['alliance']; |
@@ -500,10 +727,22 @@ discard block |
||
500 | 727 | ?> |
501 | 728 | <li><?php echo _("Display airlines of type:"); ?><br/> |
502 | 729 | <select class="selectpicker" onchange="airlinestype(this);"> |
503 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
504 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
505 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
506 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
730 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
731 | + echo ' selected'; |
|
732 | +} |
|
733 | +?>><?php echo _("All"); ?></option> |
|
734 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
735 | + echo ' selected'; |
|
736 | +} |
|
737 | +?>><?php echo _("Passenger"); ?></option> |
|
738 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
739 | + echo ' selected'; |
|
740 | +} |
|
741 | +?>><?php echo _("Cargo"); ?></option> |
|
742 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
743 | + echo ' selected'; |
|
744 | +} |
|
745 | +?>><?php echo _("Military"); ?></option> |
|
507 | 746 | </select> |
508 | 747 | </li> |
509 | 748 | <?php |
@@ -511,7 +750,10 @@ discard block |
||
511 | 750 | ?> |
512 | 751 | <li> |
513 | 752 | <?php echo _("Display flight with ident:"); ?> |
514 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
753 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
754 | + print $_COOKIE['filter_ident']; |
|
755 | +} |
|
756 | +?>" /> |
|
515 | 757 | </li> |
516 | 758 | </ul> |
517 | 759 | </form> |
@@ -527,7 +769,10 @@ discard block |
||
527 | 769 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
528 | 770 | <form> |
529 | 771 | <ul> |
530 | - <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
772 | + <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') { |
|
773 | + print 'checked'; |
|
774 | +} |
|
775 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
531 | 776 | <li><?php echo _("Type:"); ?> |
532 | 777 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
533 | 778 | <?php |
@@ -535,25 +780,45 @@ discard block |
||
535 | 780 | $types = $Satellite->get_tle_types(); |
536 | 781 | foreach ($types as $type) { |
537 | 782 | $type_name = $type['tle_type']; |
538 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
539 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
540 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
541 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
542 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
543 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
544 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
545 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
546 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
547 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
548 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
549 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
550 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
551 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
552 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
553 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
554 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
555 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
556 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
783 | + if ($type_name == 'musson') { |
|
784 | + $type_name = 'Russian LEO Navigation'; |
|
785 | + } else if ($type_name == 'nnss') { |
|
786 | + $type_name = 'Navi Navigation Satellite System'; |
|
787 | + } else if ($type_name == 'sbas') { |
|
788 | + $type_name = 'Satellite-Based Augmentation System'; |
|
789 | + } else if ($type_name == 'glo-ops') { |
|
790 | + $type_name = 'Glonass Operational'; |
|
791 | + } else if ($type_name == 'gps-ops') { |
|
792 | + $type_name = 'GPS Operational'; |
|
793 | + } else if ($type_name == 'argos') { |
|
794 | + $type_name = 'ARGOS Data Collection System'; |
|
795 | + } else if ($type_name == 'tdrss') { |
|
796 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
797 | + } else if ($type_name == 'sarsat') { |
|
798 | + $type_name = 'Search & Rescue'; |
|
799 | + } else if ($type_name == 'dmc') { |
|
800 | + $type_name = 'Disaster Monitoring'; |
|
801 | + } else if ($type_name == 'resource') { |
|
802 | + $type_name = 'Earth Resources'; |
|
803 | + } else if ($type_name == 'stations') { |
|
804 | + $type_name = 'Space Stations'; |
|
805 | + } else if ($type_name == 'geo') { |
|
806 | + $type_name = 'Geostationary'; |
|
807 | + } else if ($type_name == 'amateur') { |
|
808 | + $type_name = 'Amateur Radio'; |
|
809 | + } else if ($type_name == 'x-comm') { |
|
810 | + $type_name = 'Experimental'; |
|
811 | + } else if ($type_name == 'other-comm') { |
|
812 | + $type_name = 'Other Comm'; |
|
813 | + } else if ($type_name == 'science') { |
|
814 | + $type_name = 'Space & Earth Science'; |
|
815 | + } else if ($type_name == 'military') { |
|
816 | + $type_name = 'Miscellaneous Military'; |
|
817 | + } else if ($type_name == 'radar') { |
|
818 | + $type_name = 'Radar Calibration'; |
|
819 | + } else if ($type_name == 'tle-new') { |
|
820 | + $type_name = 'Last 30 days launches'; |
|
821 | + } |
|
557 | 822 | |
558 | 823 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
559 | 824 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |