@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | $tracker = false; |
13 | 13 | $marine = false; |
14 | 14 | $usecoord = false; |
15 | -if (isset($_GET['test'])) exit(); |
|
15 | +if (isset($_GET['test'])) { |
|
16 | + exit(); |
|
17 | +} |
|
16 | 18 | if (isset($_GET['tracker'])) { |
17 | 19 | $tracker = true; |
18 | 20 | } |
@@ -57,28 +59,55 @@ discard block |
||
57 | 59 | } |
58 | 60 | header('Content-Type: text/javascript'); |
59 | 61 | |
60 | -if (!isset($globalJsonCompress)) $compress = true; |
|
61 | -else $compress = $globalJsonCompress; |
|
62 | +if (!isset($globalJsonCompress)) { |
|
63 | + $compress = true; |
|
64 | +} else { |
|
65 | + $compress = $globalJsonCompress; |
|
66 | +} |
|
62 | 67 | |
63 | 68 | $from_archive = false; |
64 | 69 | $min = true; |
65 | 70 | $allhistory = false; |
66 | 71 | $filter['source'] = array(); |
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
72 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
72 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
73 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
74 | +} |
|
75 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
76 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
77 | +} |
|
78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
79 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
80 | +} |
|
81 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
82 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
83 | +} |
|
84 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
85 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
86 | +} |
|
87 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
88 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
89 | +} |
|
90 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
91 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
92 | +} |
|
93 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
94 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
95 | +} |
|
96 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
97 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
98 | +} |
|
99 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
100 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
101 | +} |
|
102 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
103 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
104 | +} |
|
78 | 105 | |
79 | 106 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
80 | 107 | $min = true; |
81 | -} else $min = false; |
|
108 | +} else { |
|
109 | + $min = false; |
|
110 | +} |
|
82 | 111 | |
83 | 112 | $spotter_array = array(); |
84 | 113 | |
@@ -189,24 +218,38 @@ discard block |
||
189 | 218 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
190 | 219 | } |
191 | 220 | } |
192 | - if ($flightcnt == '') $flightcnt = 0; |
|
193 | -} else $flightcnt = 0; |
|
221 | + if ($flightcnt == '') { |
|
222 | + $flightcnt = 0; |
|
223 | + } |
|
224 | + } else { |
|
225 | + $flightcnt = 0; |
|
226 | +} |
|
194 | 227 | |
195 | 228 | $sqltime = round(microtime(true)-$begintime,2); |
196 | 229 | |
197 | 230 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
198 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
231 | +if ($currenttime != '') { |
|
232 | + $currenttime = round($currenttime/1000); |
|
233 | +} |
|
199 | 234 | |
200 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
201 | -else $usenextlatlon = true; |
|
202 | -if ($usenextlatlon === false) $currenttime = ''; |
|
235 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
236 | + $usenextlatlon = false; |
|
237 | +} else { |
|
238 | + $usenextlatlon = true; |
|
239 | +} |
|
240 | +if ($usenextlatlon === false) { |
|
241 | + $currenttime = ''; |
|
242 | +} |
|
203 | 243 | $j = 0; |
204 | 244 | $prev_flightaware_id = ''; |
205 | 245 | $aircrafts_shadow = array(); |
206 | 246 | $output = '{'; |
207 | 247 | $output .= '"type": "FeatureCollection",'; |
208 | - if ($min) $output .= '"minimal": "true",'; |
|
209 | - else $output .= '"minimal": "false",'; |
|
248 | + if ($min) { |
|
249 | + $output .= '"minimal": "true",'; |
|
250 | + } else { |
|
251 | + $output .= '"minimal": "false",'; |
|
252 | + } |
|
210 | 253 | //$output .= '"fc": "'.$flightcnt.'",'; |
211 | 254 | $output .= '"sqt": "'.$sqltime.'",'; |
212 | 255 | |
@@ -251,18 +294,29 @@ discard block |
||
251 | 294 | } |
252 | 295 | $output .= '"properties": {'; |
253 | 296 | if (isset($spotter_item['flightaware_id'])) { |
254 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
255 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
297 | + if ($compress) { |
|
298 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
299 | + } else { |
|
300 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
301 | + } |
|
256 | 302 | } elseif (isset($spotter_item['famtrackid'])) { |
257 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
258 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
303 | + if ($compress) { |
|
304 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
305 | + } else { |
|
306 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
307 | + } |
|
259 | 308 | } elseif (isset($spotter_item['fammarine_id'])) { |
260 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
261 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
309 | + if ($compress) { |
|
310 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
311 | + } else { |
|
312 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
313 | + } |
|
262 | 314 | } |
263 | 315 | $output .= '"fc": "'.$flightcnt.'",'; |
264 | 316 | $output .= '"sqt": "'.$sqltime.'",'; |
265 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
317 | + if (isset($begindate)) { |
|
318 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
319 | + } |
|
266 | 320 | |
267 | 321 | /* |
268 | 322 | if ($min) $output .= '"minimal": "true",'; |
@@ -270,14 +324,22 @@ discard block |
||
270 | 324 | */ |
271 | 325 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
272 | 326 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
273 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
274 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
327 | + if ($compress) { |
|
328 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
329 | + } else { |
|
330 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
331 | + } |
|
275 | 332 | //" |
276 | 333 | } else { |
277 | - if ($compress) $output .= '"c": "NA",'; |
|
278 | - else $output .= '"callsign": "NA",'; |
|
334 | + if ($compress) { |
|
335 | + $output .= '"c": "NA",'; |
|
336 | + } else { |
|
337 | + $output .= '"callsign": "NA",'; |
|
338 | + } |
|
339 | + } |
|
340 | + if (isset($spotter_item['registration'])) { |
|
341 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
279 | 342 | } |
280 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
281 | 343 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
282 | 344 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
283 | 345 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -290,16 +352,23 @@ discard block |
||
290 | 352 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
291 | 353 | } |
292 | 354 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
293 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
294 | - else { |
|
355 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
356 | + $spotter_item['aircraft_shadow'] = ''; |
|
357 | + } else { |
|
295 | 358 | $aircraft_icao = $spotter_item['aircraft_icao']; |
296 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
297 | - else { |
|
359 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
360 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
361 | + } else { |
|
298 | 362 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
299 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
300 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
301 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
302 | - else $spotter_item['aircraft_shadow'] = ''; |
|
363 | + if (count($aircraft_info) > 0) { |
|
364 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
365 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
366 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
367 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
368 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
369 | + } else { |
|
370 | + $spotter_item['aircraft_shadow'] = ''; |
|
371 | + } |
|
303 | 372 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
304 | 373 | } |
305 | 374 | } |
@@ -307,73 +376,139 @@ discard block |
||
307 | 376 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
308 | 377 | if ($tracker) { |
309 | 378 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
310 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
311 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
379 | + if ($compress) { |
|
380 | + $output .= '"as": "ambulance.png",'; |
|
381 | + } else { |
|
382 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
383 | + } |
|
312 | 384 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
313 | - if ($compress) $output .= '"as": "police.png",'; |
|
314 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
385 | + if ($compress) { |
|
386 | + $output .= '"as": "police.png",'; |
|
387 | + } else { |
|
388 | + $output .= '"aircraft_shadow": "police.png",'; |
|
389 | + } |
|
315 | 390 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
316 | - if ($compress) $output .= '"as": "ship.png",'; |
|
317 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
391 | + if ($compress) { |
|
392 | + $output .= '"as": "ship.png",'; |
|
393 | + } else { |
|
394 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
395 | + } |
|
318 | 396 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
319 | - if ($compress) $output .= '"as": "ship.png",'; |
|
320 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
397 | + if ($compress) { |
|
398 | + $output .= '"as": "ship.png",'; |
|
399 | + } else { |
|
400 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
401 | + } |
|
321 | 402 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
322 | - if ($compress) $output .= '"as": "ship.png",'; |
|
323 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
403 | + if ($compress) { |
|
404 | + $output .= '"as": "ship.png",'; |
|
405 | + } else { |
|
406 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
407 | + } |
|
324 | 408 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
325 | - if ($compress) $output .= '"as": "truck.png",'; |
|
326 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
409 | + if ($compress) { |
|
410 | + $output .= '"as": "truck.png",'; |
|
411 | + } else { |
|
412 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
413 | + } |
|
327 | 414 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
328 | - if ($compress) $output .= '"as": "truck.png",'; |
|
329 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
415 | + if ($compress) { |
|
416 | + $output .= '"as": "truck.png",'; |
|
417 | + } else { |
|
418 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
419 | + } |
|
330 | 420 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
331 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
332 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
421 | + if ($compress) { |
|
422 | + $output .= '"as": "aircraft.png",'; |
|
423 | + } else { |
|
424 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
425 | + } |
|
333 | 426 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
334 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
335 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
427 | + if ($compress) { |
|
428 | + $output .= '"as": "aircraft.png",'; |
|
429 | + } else { |
|
430 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
431 | + } |
|
336 | 432 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
337 | - if ($compress) $output .= '"as": "helico.png",'; |
|
338 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
433 | + if ($compress) { |
|
434 | + $output .= '"as": "helico.png",'; |
|
435 | + } else { |
|
436 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
437 | + } |
|
339 | 438 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
340 | - if ($compress) $output .= '"as": "rail.png",'; |
|
341 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
439 | + if ($compress) { |
|
440 | + $output .= '"as": "rail.png",'; |
|
441 | + } else { |
|
442 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
443 | + } |
|
342 | 444 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
343 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
344 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
445 | + if ($compress) { |
|
446 | + $output .= '"as": "firetruck.png",'; |
|
447 | + } else { |
|
448 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
449 | + } |
|
345 | 450 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
346 | - if ($compress) $output .= '"as": "bus.png",'; |
|
347 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
451 | + if ($compress) { |
|
452 | + $output .= '"as": "bus.png",'; |
|
453 | + } else { |
|
454 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
455 | + } |
|
348 | 456 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
349 | - if ($compress) $output .= '"as": "phone.png",'; |
|
350 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
457 | + if ($compress) { |
|
458 | + $output .= '"as": "phone.png",'; |
|
459 | + } else { |
|
460 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
461 | + } |
|
351 | 462 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
352 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
353 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
463 | + if ($compress) { |
|
464 | + $output .= '"as": "jogger.png",'; |
|
465 | + } else { |
|
466 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
467 | + } |
|
354 | 468 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
355 | - if ($compress) $output .= '"as": "bike.png",'; |
|
356 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
469 | + if ($compress) { |
|
470 | + $output .= '"as": "bike.png",'; |
|
471 | + } else { |
|
472 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
473 | + } |
|
357 | 474 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
358 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
359 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
475 | + if ($compress) { |
|
476 | + $output .= '"as": "motorcycle.png",'; |
|
477 | + } else { |
|
478 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
479 | + } |
|
360 | 480 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
361 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
362 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
481 | + if ($compress) { |
|
482 | + $output .= '"as": "balloon.png",'; |
|
483 | + } else { |
|
484 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
485 | + } |
|
363 | 486 | } else { |
364 | - if ($compress) $output .= '"as": "car.png",'; |
|
365 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
487 | + if ($compress) { |
|
488 | + $output .= '"as": "car.png",'; |
|
489 | + } else { |
|
490 | + $output .= '"aircraft_shadow": "car.png",'; |
|
491 | + } |
|
366 | 492 | } |
367 | 493 | } elseif ($marine) { |
368 | - if ($compress) $output .= '"as": "ship.png",'; |
|
369 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
494 | + if ($compress) { |
|
495 | + $output .= '"as": "ship.png",'; |
|
496 | + } else { |
|
497 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
498 | + } |
|
370 | 499 | } else { |
371 | - if ($compress) $output .= '"as": "default.png",'; |
|
372 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
500 | + if ($compress) { |
|
501 | + $output .= '"as": "default.png",'; |
|
502 | + } else { |
|
503 | + $output .= '"aircraft_shadow": "default.png",'; |
|
504 | + } |
|
373 | 505 | } |
374 | 506 | } else { |
375 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
376 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
507 | + if ($compress) { |
|
508 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
509 | + } else { |
|
510 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
511 | + } |
|
377 | 512 | } |
378 | 513 | if (isset($spotter_item['airline_name'])) { |
379 | 514 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -381,8 +516,11 @@ discard block |
||
381 | 516 | $output .= '"airline_name": "NA",'; |
382 | 517 | } |
383 | 518 | if (isset($spotter_item['departure_airport'])) { |
384 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
385 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
519 | + if ($compress) { |
|
520 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
521 | + } else { |
|
522 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
523 | + } |
|
386 | 524 | } |
387 | 525 | if (isset($spotter_item['departure_airport_city'])) { |
388 | 526 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -394,8 +532,11 @@ discard block |
||
394 | 532 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
395 | 533 | } |
396 | 534 | if (isset($spotter_item['arrival_airport'])) { |
397 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
398 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
535 | + if ($compress) { |
|
536 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
537 | + } else { |
|
538 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
539 | + } |
|
399 | 540 | } |
400 | 541 | if (isset($spotter_item['arrival_airport_city'])) { |
401 | 542 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -414,8 +555,11 @@ discard block |
||
414 | 555 | } |
415 | 556 | |
416 | 557 | if (isset($spotter_item['altitude'])) { |
417 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
418 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
558 | + if ($compress) { |
|
559 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
560 | + } else { |
|
561 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
562 | + } |
|
419 | 563 | } |
420 | 564 | |
421 | 565 | $heading = $spotter_item['heading']; |
@@ -439,19 +583,24 @@ discard block |
||
439 | 583 | } |
440 | 584 | } |
441 | 585 | |
442 | - if ($compress)$output .= '"h": "'.$heading.'",'; |
|
443 | - else $output .= '"heading": "'.$heading.'",'; |
|
586 | + if ($compress) { |
|
587 | + $output .= '"h": "'.$heading.'",'; |
|
588 | + } else { |
|
589 | + $output .= '"heading": "'.$heading.'",'; |
|
590 | + } |
|
444 | 591 | if ($currenttime != '') { |
445 | 592 | if (strtotime($spotter_item['date']) < $currenttime) { |
446 | 593 | if (isset($archivespeed)) { |
447 | 594 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
448 | 595 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
449 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
450 | - else { |
|
596 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
597 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
598 | + } else { |
|
451 | 599 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
452 | 600 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
453 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
454 | - else { |
|
601 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
602 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
603 | + } else { |
|
455 | 604 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
456 | 605 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
457 | 606 | } |
@@ -459,12 +608,14 @@ discard block |
||
459 | 608 | } elseif ($usenextlatlon) { |
460 | 609 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
461 | 610 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
462 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
463 | - else { |
|
611 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
612 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
613 | + } else { |
|
464 | 614 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
465 | 615 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
466 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
467 | - else { |
|
616 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
617 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
618 | + } else { |
|
468 | 619 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
469 | 620 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
470 | 621 | } |
@@ -503,7 +654,9 @@ discard block |
||
503 | 654 | } |
504 | 655 | } |
505 | 656 | |
506 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
657 | + if (!$min) { |
|
658 | + $output .= '"image": "'.$image.'",'; |
|
659 | + } |
|
507 | 660 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
508 | 661 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
509 | 662 | } |
@@ -511,8 +664,11 @@ discard block |
||
511 | 664 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
512 | 665 | } |
513 | 666 | if (isset($spotter_item['squawk'])) { |
514 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
515 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
667 | + if ($compress) { |
|
668 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
669 | + } else { |
|
670 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
671 | + } |
|
516 | 672 | } |
517 | 673 | if (isset($spotter_item['squawk_usage'])) { |
518 | 674 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -531,14 +687,23 @@ discard block |
||
531 | 687 | } |
532 | 688 | // type when not aircraft ? |
533 | 689 | if (isset($spotter_item['type'])) { |
534 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
535 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
690 | + if ($compress) { |
|
691 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
692 | + } else { |
|
693 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
694 | + } |
|
536 | 695 | } elseif ($marine) { |
537 | - if ($compress) $output .= '"t": "ship"'; |
|
538 | - else $output .= '"type": "ship"'; |
|
696 | + if ($compress) { |
|
697 | + $output .= '"t": "ship"'; |
|
698 | + } else { |
|
699 | + $output .= '"type": "ship"'; |
|
700 | + } |
|
539 | 701 | } else { |
540 | - if ($compress) $output .= '"t": "aircraft"'; |
|
541 | - else $output .= '"type": "aircraft"'; |
|
702 | + if ($compress) { |
|
703 | + $output .= '"t": "aircraft"'; |
|
704 | + } else { |
|
705 | + $output .= '"type": "aircraft"'; |
|
706 | + } |
|
542 | 707 | } |
543 | 708 | $output .= '},'; |
544 | 709 | $output .= '"geometry": {'; |
@@ -546,15 +711,19 @@ discard block |
||
546 | 711 | $output .= '"coordinates": ['; |
547 | 712 | if ($currenttime != '') { |
548 | 713 | if (strtotime($spotter_item['date']) < $currenttime) { |
549 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
714 | + if (!isset($archivespeed)) { |
|
715 | + $archivespeed = 1; |
|
716 | + } |
|
550 | 717 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
551 | 718 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
552 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
553 | - else { |
|
719 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
720 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
721 | + } else { |
|
554 | 722 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
555 | 723 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
556 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
557 | - else { |
|
724 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
725 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
726 | + } else { |
|
558 | 727 | $output .= $spotter_item['longitude'].', '; |
559 | 728 | $output .= $spotter_item['latitude']; |
560 | 729 | } |
@@ -632,7 +801,9 @@ discard block |
||
632 | 801 | } |
633 | 802 | */ |
634 | 803 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
635 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
804 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
805 | + $history = $_COOKIE['history']; |
|
806 | + } |
|
636 | 807 | |
637 | 808 | if ( |
638 | 809 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -702,8 +873,11 @@ discard block |
||
702 | 873 | $output_history .= ']}},'; |
703 | 874 | $output .= $output_history; |
704 | 875 | } |
705 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
706 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
876 | + if ($compress) { |
|
877 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
878 | + } else { |
|
879 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
880 | + } |
|
707 | 881 | } |
708 | 882 | $output_history .= '['; |
709 | 883 | $output_history .= $spotter_history['longitude'].', '; |
@@ -724,10 +898,15 @@ discard block |
||
724 | 898 | if ($d == false) { |
725 | 899 | if ($compress) { |
726 | 900 | $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",'; |
727 | - if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
728 | - elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
901 | + if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') { |
|
902 | + $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
903 | + } elseif (isset($spotter_history_array[0]['mapmatching_engine'])) { |
|
904 | + $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
905 | + } |
|
729 | 906 | $output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
730 | - } else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
907 | + } else { |
|
908 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
909 | + } |
|
731 | 910 | $d = true; |
732 | 911 | } |
733 | 912 | $output_history .= '['; |
@@ -750,7 +929,9 @@ discard block |
||
750 | 929 | $output_historyd = '['; |
751 | 930 | $output_historyd .= $spotter_item['longitude'].', '; |
752 | 931 | $output_historyd .= $spotter_item['latitude']; |
753 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
932 | + if (isset($spotter_history['altitude'])) { |
|
933 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
934 | + } |
|
754 | 935 | $output_historyd .= '],'; |
755 | 936 | //$output_history = $output_historyd.$output_history; |
756 | 937 | $output_history = $output_history.$output_historyd; |
@@ -777,8 +958,11 @@ discard block |
||
777 | 958 | && $spotter_item['arrival_airport'] != 'NA' |
778 | 959 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
779 | 960 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
780 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
781 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
961 | + if ($compress) { |
|
962 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
963 | + } else { |
|
964 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
965 | + } |
|
782 | 966 | if (isset($spotter_item['departure_airport_latitude'])) { |
783 | 967 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
784 | 968 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -811,8 +995,11 @@ discard block |
||
811 | 995 | || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
812 | 996 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
813 | 997 | $havedata = false; |
814 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
815 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
998 | + if ($compress) { |
|
999 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1000 | + } else { |
|
1001 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1002 | + } |
|
816 | 1003 | |
817 | 1004 | //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
818 | 1005 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -837,7 +1024,9 @@ discard block |
||
837 | 1024 | $output_dest = substr($output_dest, 0, -1); |
838 | 1025 | } |
839 | 1026 | $output_dest .= ']}},'; |
840 | - if ($havedata) $output .= $output_dest; |
|
1027 | + if ($havedata) { |
|
1028 | + $output .= $output_dest; |
|
1029 | + } |
|
841 | 1030 | unset($output_dest); |
842 | 1031 | } |
843 | 1032 | } |
@@ -845,7 +1034,9 @@ discard block |
||
845 | 1034 | $output .= ']'; |
846 | 1035 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
847 | 1036 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
848 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
1037 | + if (isset($begindate)) { |
|
1038 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
1039 | + } |
|
849 | 1040 | $output .= '"fc": "'.$j.'"'; |
850 | 1041 | } else { |
851 | 1042 | $output .= '"features": '; |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | } |
11 | 11 | |
12 | 12 | /** |
13 | - * Get SQL query part for filter used |
|
14 | - * @param Array $filter the filter |
|
15 | - * @return Array the SQL part |
|
16 | - */ |
|
13 | + * Get SQL query part for filter used |
|
14 | + * @param Array $filter the filter |
|
15 | + * @return Array the SQL part |
|
16 | + */ |
|
17 | 17 | public function getFilter($filter = array(),$where = false,$and = false) { |
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | |
160 | 160 | |
161 | 161 | /** |
162 | - * Gets all the spotter information based on a particular callsign |
|
163 | - * |
|
164 | - * @return Array the spotter information |
|
165 | - * |
|
166 | - */ |
|
162 | + * Gets all the spotter information based on a particular callsign |
|
163 | + * |
|
164 | + * @return Array the spotter information |
|
165 | + * |
|
166 | + */ |
|
167 | 167 | public function getLastArchiveSpotterDataByIdent($ident) { |
168 | 168 | $Spotter = new Spotter($this->db); |
169 | 169 | date_default_timezone_set('UTC'); |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | |
180 | 180 | |
181 | 181 | /** |
182 | - * Gets last the spotter information based on a particular id |
|
183 | - * |
|
184 | - * @return Array the spotter information |
|
185 | - * |
|
186 | - */ |
|
182 | + * Gets last the spotter information based on a particular id |
|
183 | + * |
|
184 | + * @return Array the spotter information |
|
185 | + * |
|
186 | + */ |
|
187 | 187 | public function getLastArchiveSpotterDataById($id) { |
188 | 188 | $Spotter = new Spotter($this->db); |
189 | 189 | date_default_timezone_set('UTC'); |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
212 | - * Gets all the spotter information based on a particular id |
|
213 | - * |
|
214 | - * @return Array the spotter information |
|
215 | - * |
|
216 | - */ |
|
212 | + * Gets all the spotter information based on a particular id |
|
213 | + * |
|
214 | + * @return Array the spotter information |
|
215 | + * |
|
216 | + */ |
|
217 | 217 | public function getAllArchiveSpotterDataById($id) { |
218 | 218 | date_default_timezone_set('UTC'); |
219 | 219 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
237 | - * Gets coordinate & time spotter information based on a particular id |
|
238 | - * |
|
239 | - * @return Array the spotter information |
|
240 | - * |
|
241 | - */ |
|
237 | + * Gets coordinate & time spotter information based on a particular id |
|
238 | + * |
|
239 | + * @return Array the spotter information |
|
240 | + * |
|
241 | + */ |
|
242 | 242 | public function getCoordArchiveSpotterDataById($id) { |
243 | 243 | date_default_timezone_set('UTC'); |
244 | 244 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | |
257 | 257 | |
258 | 258 | /** |
259 | - * Gets altitude information based on a particular callsign |
|
260 | - * |
|
261 | - * @return Array the spotter information |
|
262 | - * |
|
263 | - */ |
|
259 | + * Gets altitude information based on a particular callsign |
|
260 | + * |
|
261 | + * @return Array the spotter information |
|
262 | + * |
|
263 | + */ |
|
264 | 264 | public function getAltitudeArchiveSpotterDataByIdent($ident) { |
265 | 265 | |
266 | 266 | date_default_timezone_set('UTC'); |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
284 | - * Gets altitude information based on a particular id |
|
285 | - * |
|
286 | - * @return Array the spotter information |
|
287 | - * |
|
288 | - */ |
|
284 | + * Gets altitude information based on a particular id |
|
285 | + * |
|
286 | + * @return Array the spotter information |
|
287 | + * |
|
288 | + */ |
|
289 | 289 | public function getAltitudeArchiveSpotterDataById($id) { |
290 | 290 | |
291 | 291 | date_default_timezone_set('UTC'); |
@@ -306,11 +306,11 @@ discard block |
||
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
309 | - * Gets altitude & speed information based on a particular id |
|
310 | - * |
|
311 | - * @return Array the spotter information |
|
312 | - * |
|
313 | - */ |
|
309 | + * Gets altitude & speed information based on a particular id |
|
310 | + * |
|
311 | + * @return Array the spotter information |
|
312 | + * |
|
313 | + */ |
|
314 | 314 | public function getAltitudeSpeedArchiveSpotterDataById($id) { |
315 | 315 | date_default_timezone_set('UTC'); |
316 | 316 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
330 | - * Gets altitude information based on a particular callsign |
|
331 | - * |
|
332 | - * @return Array the spotter information |
|
333 | - * |
|
334 | - */ |
|
330 | + * Gets altitude information based on a particular callsign |
|
331 | + * |
|
332 | + * @return Array the spotter information |
|
333 | + * |
|
334 | + */ |
|
335 | 335 | public function getLastAltitudeArchiveSpotterDataByIdent($ident) { |
336 | 336 | date_default_timezone_set('UTC'); |
337 | 337 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
@@ -381,11 +381,11 @@ discard block |
||
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |
384 | - * Gets Minimal Live Spotter data |
|
385 | - * |
|
386 | - * @return Array the spotter information |
|
387 | - * |
|
388 | - */ |
|
384 | + * Gets Minimal Live Spotter data |
|
385 | + * |
|
386 | + * @return Array the spotter information |
|
387 | + * |
|
388 | + */ |
|
389 | 389 | public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) { |
390 | 390 | global $globalDBdriver, $globalLiveInterval; |
391 | 391 | date_default_timezone_set('UTC'); |
@@ -433,11 +433,11 @@ discard block |
||
433 | 433 | } |
434 | 434 | |
435 | 435 | /** |
436 | - * Gets Minimal Live Spotter data |
|
437 | - * |
|
438 | - * @return Array the spotter information |
|
439 | - * |
|
440 | - */ |
|
436 | + * Gets Minimal Live Spotter data |
|
437 | + * |
|
438 | + * @return Array the spotter information |
|
439 | + * |
|
440 | + */ |
|
441 | 441 | public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) { |
442 | 442 | global $globalDBdriver, $globalLiveInterval; |
443 | 443 | date_default_timezone_set('UTC'); |
@@ -501,11 +501,11 @@ discard block |
||
501 | 501 | } |
502 | 502 | |
503 | 503 | /** |
504 | - * Gets count Live Spotter data |
|
505 | - * |
|
506 | - * @return Array the spotter information |
|
507 | - * |
|
508 | - */ |
|
504 | + * Gets count Live Spotter data |
|
505 | + * |
|
506 | + * @return Array the spotter information |
|
507 | + * |
|
508 | + */ |
|
509 | 509 | public function getLiveSpotterCount($begindate,$enddate,$filter = array()) { |
510 | 510 | global $globalDBdriver, $globalLiveInterval; |
511 | 511 | date_default_timezone_set('UTC'); |
@@ -551,11 +551,11 @@ discard block |
||
551 | 551 | // Spotter_Archive_output |
552 | 552 | |
553 | 553 | /** |
554 | - * Gets all the spotter information |
|
555 | - * |
|
556 | - * @return Array the spotter information |
|
557 | - * |
|
558 | - */ |
|
554 | + * Gets all the spotter information |
|
555 | + * |
|
556 | + * @return Array the spotter information |
|
557 | + * |
|
558 | + */ |
|
559 | 559 | public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) { |
560 | 560 | global $globalTimezone, $globalDBdriver; |
561 | 561 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -847,11 +847,11 @@ discard block |
||
847 | 847 | } |
848 | 848 | |
849 | 849 | /** |
850 | - * Gets all the spotter information based on the callsign |
|
851 | - * |
|
852 | - * @return Array the spotter information |
|
853 | - * |
|
854 | - */ |
|
850 | + * Gets all the spotter information based on the callsign |
|
851 | + * |
|
852 | + * @return Array the spotter information |
|
853 | + * |
|
854 | + */ |
|
855 | 855 | public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') { |
856 | 856 | $global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output"; |
857 | 857 | |
@@ -899,11 +899,11 @@ discard block |
||
899 | 899 | |
900 | 900 | |
901 | 901 | /** |
902 | - * Gets all the spotter information based on the owner |
|
903 | - * |
|
904 | - * @return Array the spotter information |
|
905 | - * |
|
906 | - */ |
|
902 | + * Gets all the spotter information based on the owner |
|
903 | + * |
|
904 | + * @return Array the spotter information |
|
905 | + * |
|
906 | + */ |
|
907 | 907 | public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array()) { |
908 | 908 | $global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output"; |
909 | 909 | |
@@ -951,11 +951,11 @@ discard block |
||
951 | 951 | } |
952 | 952 | |
953 | 953 | /** |
954 | - * Gets all the spotter information based on the pilot |
|
955 | - * |
|
956 | - * @return Array the spotter information |
|
957 | - * |
|
958 | - */ |
|
954 | + * Gets all the spotter information based on the pilot |
|
955 | + * |
|
956 | + * @return Array the spotter information |
|
957 | + * |
|
958 | + */ |
|
959 | 959 | public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array()) { |
960 | 960 | $global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output"; |
961 | 961 | |
@@ -999,11 +999,11 @@ discard block |
||
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | /** |
1002 | - * Gets all number of flight over countries |
|
1003 | - * |
|
1004 | - * @return Array the airline country list |
|
1005 | - * |
|
1006 | - */ |
|
1002 | + * Gets all number of flight over countries |
|
1003 | + * |
|
1004 | + * @return Array the airline country list |
|
1005 | + * |
|
1006 | + */ |
|
1007 | 1007 | public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') { |
1008 | 1008 | global $globalDBdriver; |
1009 | 1009 | /* |
@@ -1043,11 +1043,11 @@ discard block |
||
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | /** |
1046 | - * Gets all number of flight over countries |
|
1047 | - * |
|
1048 | - * @return Array the airline country list |
|
1049 | - * |
|
1050 | - */ |
|
1046 | + * Gets all number of flight over countries |
|
1047 | + * |
|
1048 | + * @return Array the airline country list |
|
1049 | + * |
|
1050 | + */ |
|
1051 | 1051 | public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') { |
1052 | 1052 | global $globalDBdriver; |
1053 | 1053 | /* |
@@ -1088,11 +1088,11 @@ discard block |
||
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | /** |
1091 | - * Gets last spotter information based on a particular callsign |
|
1092 | - * |
|
1093 | - * @return Array the spotter information |
|
1094 | - * |
|
1095 | - */ |
|
1091 | + * Gets last spotter information based on a particular callsign |
|
1092 | + * |
|
1093 | + * @return Array the spotter information |
|
1094 | + * |
|
1095 | + */ |
|
1096 | 1096 | public function getDateArchiveSpotterDataById($id,$date) { |
1097 | 1097 | $Spotter = new Spotter($this->db); |
1098 | 1098 | date_default_timezone_set('UTC'); |
@@ -1104,11 +1104,11 @@ discard block |
||
1104 | 1104 | } |
1105 | 1105 | |
1106 | 1106 | /** |
1107 | - * Gets all the spotter information based on a particular callsign |
|
1108 | - * |
|
1109 | - * @return Array the spotter information |
|
1110 | - * |
|
1111 | - */ |
|
1107 | + * Gets all the spotter information based on a particular callsign |
|
1108 | + * |
|
1109 | + * @return Array the spotter information |
|
1110 | + * |
|
1111 | + */ |
|
1112 | 1112 | public function getDateArchiveSpotterDataByIdent($ident,$date) { |
1113 | 1113 | $Spotter = new Spotter($this->db); |
1114 | 1114 | date_default_timezone_set('UTC'); |
@@ -1120,11 +1120,11 @@ discard block |
||
1120 | 1120 | } |
1121 | 1121 | |
1122 | 1122 | /** |
1123 | - * Gets all the spotter information based on the airport |
|
1124 | - * |
|
1125 | - * @return Array the spotter information |
|
1126 | - * |
|
1127 | - */ |
|
1123 | + * Gets all the spotter information based on the airport |
|
1124 | + * |
|
1125 | + * @return Array the spotter information |
|
1126 | + * |
|
1127 | + */ |
|
1128 | 1128 | public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) { |
1129 | 1129 | global $global_query; |
1130 | 1130 | $Spotter = new Spotter($this->db); |
@@ -14,75 +14,75 @@ discard block |
||
14 | 14 | * @param Array $filter the filter |
15 | 15 | * @return Array the SQL part |
16 | 16 | */ |
17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
23 | 23 | } else { |
24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | if (isset($filter[0]['source'])) { |
28 | - $filters = array_merge($filters,$filter); |
|
28 | + $filters = array_merge($filters, $filter); |
|
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
31 | 31 | $filter_query_join = ''; |
32 | 32 | $filter_query_where = ''; |
33 | - foreach($filters as $flt) { |
|
33 | + foreach ($filters as $flt) { |
|
34 | 34 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
35 | 35 | if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') { |
36 | 36 | if (isset($flt['source'])) { |
37 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
37 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
38 | 38 | } else { |
39 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
43 | 43 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
44 | 44 | if (isset($flt['source'])) { |
45 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
45 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
46 | 46 | } else { |
47 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
47 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
51 | 51 | if (isset($flt['source'])) { |
52 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
52 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
53 | 53 | } else { |
54 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
54 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
58 | 58 | if (isset($flt['source'])) { |
59 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
59 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
60 | 60 | } else { |
61 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
61 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
65 | 65 | if (isset($flt['source'])) { |
66 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
66 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
70 | 70 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
71 | 71 | if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') { |
72 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
72 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
76 | 76 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
77 | 77 | } |
78 | 78 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
80 | 80 | } |
81 | 81 | if (isset($filter['source']) && !empty($filter['source'])) { |
82 | 82 | if (count($filter['source']) == 1) { |
83 | 83 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
84 | 84 | } else { |
85 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
85 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $filter_query_where .= " AND flightaware_id = '".$filter['id']."'"; |
93 | 93 | } |
94 | 94 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
95 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
95 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
96 | 96 | } |
97 | 97 | if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) { |
98 | 98 | $filter_query_date = ''; |
@@ -117,41 +117,41 @@ discard block |
||
117 | 117 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
118 | 118 | } |
119 | 119 | } |
120 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
120 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
121 | 121 | } |
122 | 122 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
123 | 123 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
124 | 124 | if ($filter_query_where != '') { |
125 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
125 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
126 | 126 | } |
127 | 127 | $filter_query = $filter_query_join.$filter_query_where; |
128 | 128 | return $filter_query; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // Spotter_archive |
132 | - public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
|
132 | + public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '', $arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city = '', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') { |
|
133 | 133 | require_once(dirname(__FILE__).'/class.Spotter.php'); |
134 | 134 | if ($over_country == '') { |
135 | 135 | $Spotter = new Spotter($this->db); |
136 | - $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
136 | + $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
137 | 137 | if (!empty($data_country)) $country = $data_country['iso2']; |
138 | 138 | else $country = ''; |
139 | 139 | } else $country = $over_country; |
140 | - if ($airline_type === NULL) $airline_type =''; |
|
140 | + if ($airline_type === NULL) $airline_type = ''; |
|
141 | 141 | |
142 | 142 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
143 | 143 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
144 | 144 | |
145 | 145 | // Route is not added in spotter_archive |
146 | - $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
146 | + $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
147 | 147 | VALUES (:flightaware_id, :ident, :registration, :airline_name, :airline_icao, :airline_country, :airline_type, :aircraft_icao, :aircraft_shadow, :aircraft_name, :aircraft_manufacturer, :departure_airport_icao, :departure_airport_name, :departure_airport_city, :departure_airport_country, :departure_airport_time,:arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :arrival_airport_time, :route_stop, :date,:latitude, :longitude, :waypoints, :altitude, :heading, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name,:real_altitude)"; |
148 | 148 | |
149 | - $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name,':real_altitude' => $real_altitude); |
|
149 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name, ':real_altitude' => $real_altitude); |
|
150 | 150 | try { |
151 | 151 | $sth = $this->db->prepare($query); |
152 | 152 | $sth->execute($query_values); |
153 | 153 | $sth->closeCursor(); |
154 | - } catch(PDOException $e) { |
|
154 | + } catch (PDOException $e) { |
|
155 | 155 | return "error : ".$e->getMessage(); |
156 | 156 | } |
157 | 157 | return "success"; |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
172 | 172 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
173 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
173 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
174 | 174 | |
175 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
175 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
176 | 176 | |
177 | 177 | return $spotter_array; |
178 | 178 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
191 | 191 | //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
192 | 192 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
193 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
193 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
194 | 194 | |
195 | 195 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
196 | 196 | /* |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
205 | 205 | */ |
206 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
206 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
207 | 207 | |
208 | 208 | return $spotter_array; |
209 | 209 | } |
@@ -217,14 +217,14 @@ discard block |
||
217 | 217 | public function getAllArchiveSpotterDataById($id) { |
218 | 218 | date_default_timezone_set('UTC'); |
219 | 219 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
220 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
220 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
221 | 221 | |
222 | 222 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
223 | 223 | |
224 | 224 | try { |
225 | 225 | $sth = $this->db->prepare($query); |
226 | 226 | $sth->execute(array(':id' => $id)); |
227 | - } catch(PDOException $e) { |
|
227 | + } catch (PDOException $e) { |
|
228 | 228 | echo $e->getMessage(); |
229 | 229 | die; |
230 | 230 | } |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | public function getCoordArchiveSpotterDataById($id) { |
243 | 243 | date_default_timezone_set('UTC'); |
244 | 244 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
245 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC"; |
|
245 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC"; |
|
246 | 246 | try { |
247 | 247 | $sth = $this->db->prepare($query); |
248 | 248 | $sth->execute(array(':id' => $id)); |
249 | - } catch(PDOException $e) { |
|
249 | + } catch (PDOException $e) { |
|
250 | 250 | echo $e->getMessage(); |
251 | 251 | die; |
252 | 252 | } |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | date_default_timezone_set('UTC'); |
267 | 267 | |
268 | 268 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
269 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
269 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
270 | 270 | |
271 | 271 | try { |
272 | 272 | $sth = $this->db->prepare($query); |
273 | 273 | $sth->execute(array(':ident' => $ident)); |
274 | - } catch(PDOException $e) { |
|
274 | + } catch (PDOException $e) { |
|
275 | 275 | echo $e->getMessage(); |
276 | 276 | die; |
277 | 277 | } |
@@ -291,12 +291,12 @@ discard block |
||
291 | 291 | date_default_timezone_set('UTC'); |
292 | 292 | |
293 | 293 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
294 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
294 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
295 | 295 | |
296 | 296 | try { |
297 | 297 | $sth = $this->db->prepare($query); |
298 | 298 | $sth->execute(array(':id' => $id)); |
299 | - } catch(PDOException $e) { |
|
299 | + } catch (PDOException $e) { |
|
300 | 300 | echo $e->getMessage(); |
301 | 301 | die; |
302 | 302 | } |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | public function getAltitudeSpeedArchiveSpotterDataById($id) { |
315 | 315 | date_default_timezone_set('UTC'); |
316 | 316 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
317 | - $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
317 | + $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
318 | 318 | try { |
319 | 319 | $sth = $this->db->prepare($query); |
320 | 320 | $sth->execute(array(':id' => $id)); |
321 | - } catch(PDOException $e) { |
|
321 | + } catch (PDOException $e) { |
|
322 | 322 | echo $e->getMessage(); |
323 | 323 | die; |
324 | 324 | } |
@@ -335,12 +335,12 @@ discard block |
||
335 | 335 | public function getLastAltitudeArchiveSpotterDataByIdent($ident) { |
336 | 336 | date_default_timezone_set('UTC'); |
337 | 337 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
338 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
338 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
339 | 339 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
340 | 340 | try { |
341 | 341 | $sth = $this->db->prepare($query); |
342 | 342 | $sth->execute(array(':ident' => $ident)); |
343 | - } catch(PDOException $e) { |
|
343 | + } catch (PDOException $e) { |
|
344 | 344 | echo $e->getMessage(); |
345 | 345 | die; |
346 | 346 | } |
@@ -356,11 +356,11 @@ discard block |
||
356 | 356 | * @return Array the spotter information |
357 | 357 | * |
358 | 358 | */ |
359 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) { |
|
359 | + public function getSpotterArchiveData($ident, $flightaware_id, $date) { |
|
360 | 360 | $Spotter = new Spotter($this->db); |
361 | 361 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
362 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
363 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
362 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
363 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%')); |
|
364 | 364 | return $spotter_array; |
365 | 365 | } |
366 | 366 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | try { |
375 | 375 | $sth = $this->db->prepare($query); |
376 | 376 | $sth->execute(); |
377 | - } catch(PDOException $e) { |
|
377 | + } catch (PDOException $e) { |
|
378 | 378 | echo $e->getMessage(); |
379 | 379 | die; |
380 | 380 | } |
@@ -386,34 +386,34 @@ discard block |
||
386 | 386 | * @return Array the spotter information |
387 | 387 | * |
388 | 388 | */ |
389 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) { |
|
389 | + public function getMinLiveSpotterData($begindate, $enddate, $filter = array()) { |
|
390 | 390 | global $globalDBdriver, $globalLiveInterval; |
391 | 391 | date_default_timezone_set('UTC'); |
392 | 392 | |
393 | 393 | $filter_query = ''; |
394 | 394 | if (isset($filter['source']) && !empty($filter['source'])) { |
395 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
395 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
396 | 396 | } |
397 | 397 | // Use spotter_output also ? |
398 | 398 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
399 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
399 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
400 | 400 | } |
401 | 401 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
402 | 402 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
403 | 403 | } |
404 | 404 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
405 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
405 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
409 | 409 | if ($globalDBdriver == 'mysql') { |
410 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
410 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
411 | 411 | FROM spotter_archive |
412 | 412 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
413 | 413 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
414 | 414 | '.$filter_query.' ORDER BY flightaware_id'; |
415 | 415 | } else { |
416 | - $query = 'SELECT spotter_archive.flightaware_id, spotter_archive.date, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
416 | + $query = 'SELECT spotter_archive.flightaware_id, spotter_archive.date, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
417 | 417 | FROM spotter_archive |
418 | 418 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
419 | 419 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".' |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | try { |
424 | 424 | $sth = $this->db->prepare($query); |
425 | 425 | $sth->execute(); |
426 | - } catch(PDOException $e) { |
|
426 | + } catch (PDOException $e) { |
|
427 | 427 | echo $e->getMessage(); |
428 | 428 | die; |
429 | 429 | } |
@@ -438,23 +438,23 @@ discard block |
||
438 | 438 | * @return Array the spotter information |
439 | 439 | * |
440 | 440 | */ |
441 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) { |
|
441 | + public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array()) { |
|
442 | 442 | global $globalDBdriver, $globalLiveInterval; |
443 | 443 | date_default_timezone_set('UTC'); |
444 | 444 | |
445 | 445 | $filter_query = ''; |
446 | 446 | if (isset($filter['source']) && !empty($filter['source'])) { |
447 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
447 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
448 | 448 | } |
449 | 449 | // Should use spotter_output also ? |
450 | 450 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
451 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
451 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
452 | 452 | } |
453 | 453 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
454 | 454 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
455 | 455 | } |
456 | 456 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
457 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
457 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | FROM spotter_archive |
465 | 465 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
466 | 466 | */ |
467 | - $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
467 | + $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
468 | 468 | FROM spotter_archive_output |
469 | 469 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao |
470 | 470 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
480 | 480 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
481 | 481 | */ |
482 | - $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
482 | + $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
483 | 483 | FROM spotter_archive_output |
484 | 484 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
485 | 485 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | try { |
492 | 492 | $sth = $this->db->prepare($query); |
493 | 493 | $sth->execute(); |
494 | - } catch(PDOException $e) { |
|
494 | + } catch (PDOException $e) { |
|
495 | 495 | echo $e->getMessage(); |
496 | 496 | die; |
497 | 497 | } |
@@ -506,22 +506,22 @@ discard block |
||
506 | 506 | * @return Array the spotter information |
507 | 507 | * |
508 | 508 | */ |
509 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) { |
|
509 | + public function getLiveSpotterCount($begindate, $enddate, $filter = array()) { |
|
510 | 510 | global $globalDBdriver, $globalLiveInterval; |
511 | 511 | date_default_timezone_set('UTC'); |
512 | 512 | |
513 | 513 | $filter_query = ''; |
514 | 514 | if (isset($filter['source']) && !empty($filter['source'])) { |
515 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
515 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
516 | 516 | } |
517 | 517 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
518 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
518 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
519 | 519 | } |
520 | 520 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
521 | 521 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
522 | 522 | } |
523 | 523 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
524 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
524 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | try { |
537 | 537 | $sth = $this->db->prepare($query); |
538 | 538 | $sth->execute(); |
539 | - } catch(PDOException $e) { |
|
539 | + } catch (PDOException $e) { |
|
540 | 540 | echo $e->getMessage(); |
541 | 541 | die; |
542 | 542 | } |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | * @return Array the spotter information |
557 | 557 | * |
558 | 558 | */ |
559 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) { |
|
559 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) { |
|
560 | 560 | global $globalTimezone, $globalDBdriver; |
561 | 561 | require_once(dirname(__FILE__).'/class.Translation.php'); |
562 | 562 | $Translation = new Translation($this->db); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | } |
607 | 607 | |
608 | 608 | if ($registration != "") { |
609 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
609 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
610 | 610 | if (!is_string($registration)) { |
611 | 611 | return false; |
612 | 612 | } else { |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | } |
616 | 616 | |
617 | 617 | if ($aircraft_icao != "") { |
618 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
618 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
619 | 619 | if (!is_string($aircraft_icao)) { |
620 | 620 | return false; |
621 | 621 | } else { |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | } |
625 | 625 | |
626 | 626 | if ($aircraft_manufacturer != "") { |
627 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
627 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
628 | 628 | if (!is_string($aircraft_manufacturer)) { |
629 | 629 | return false; |
630 | 630 | } else { |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | } |
642 | 642 | |
643 | 643 | if ($airline_icao != "") { |
644 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
644 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
645 | 645 | if (!is_string($airline_icao)) { |
646 | 646 | return false; |
647 | 647 | } else { |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | } |
651 | 651 | |
652 | 652 | if ($airline_country != "") { |
653 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
653 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
654 | 654 | if (!is_string($airline_country)) { |
655 | 655 | return false; |
656 | 656 | } else { |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | } |
660 | 660 | |
661 | 661 | if ($airline_type != "") { |
662 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
662 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
663 | 663 | if (!is_string($airline_type)) { |
664 | 664 | return false; |
665 | 665 | } else { |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | } |
677 | 677 | |
678 | 678 | if ($airport != "") { |
679 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
679 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
680 | 680 | if (!is_string($airport)) { |
681 | 681 | return false; |
682 | 682 | } else { |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | } |
686 | 686 | |
687 | 687 | if ($airport_country != "") { |
688 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
688 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
689 | 689 | if (!is_string($airport_country)) { |
690 | 690 | return false; |
691 | 691 | } else { |
@@ -694,14 +694,14 @@ discard block |
||
694 | 694 | } |
695 | 695 | |
696 | 696 | if ($callsign != "") { |
697 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
697 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
698 | 698 | if (!is_string($callsign)) { |
699 | 699 | return false; |
700 | 700 | } else { |
701 | 701 | $translate = $Translation->ident2icao($callsign); |
702 | 702 | if ($translate != $callsign) { |
703 | 703 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
704 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
704 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
705 | 705 | } else { |
706 | 706 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
707 | 707 | } |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | } |
710 | 710 | |
711 | 711 | if ($owner != "") { |
712 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
712 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
713 | 713 | if (!is_string($owner)) { |
714 | 714 | return false; |
715 | 715 | } else { |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | } |
719 | 719 | |
720 | 720 | if ($pilot_name != "") { |
721 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
721 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
722 | 722 | if (!is_string($pilot_name)) { |
723 | 723 | return false; |
724 | 724 | } else { |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | } |
728 | 728 | |
729 | 729 | if ($pilot_id != "") { |
730 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
730 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
731 | 731 | if (!is_string($pilot_id)) { |
732 | 732 | return false; |
733 | 733 | } else { |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | } |
737 | 737 | |
738 | 738 | if ($departure_airport_route != "") { |
739 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
739 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
740 | 740 | if (!is_string($departure_airport_route)) { |
741 | 741 | return false; |
742 | 742 | } else { |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | } |
746 | 746 | |
747 | 747 | if ($arrival_airport_route != "") { |
748 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
748 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
749 | 749 | if (!is_string($arrival_airport_route)) { |
750 | 750 | return false; |
751 | 751 | } else { |
@@ -756,8 +756,8 @@ discard block |
||
756 | 756 | if ($altitude != "") { |
757 | 757 | $altitude_array = explode(",", $altitude); |
758 | 758 | |
759 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
760 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
759 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
760 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
761 | 761 | |
762 | 762 | |
763 | 763 | if ($altitude_array[1] != "") { |
@@ -772,8 +772,8 @@ discard block |
||
772 | 772 | |
773 | 773 | if ($date_posted != "") { |
774 | 774 | $date_array = explode(",", $date_posted); |
775 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
776 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
775 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
776 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
777 | 777 | if ($globalTimezone != '') { |
778 | 778 | date_default_timezone_set($globalTimezone); |
779 | 779 | $datetime = new DateTime(); |
@@ -798,16 +798,16 @@ discard block |
||
798 | 798 | } |
799 | 799 | if ($limit != "") { |
800 | 800 | $limit_array = explode(",", $limit); |
801 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
802 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
801 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
802 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
803 | 803 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
804 | 804 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
805 | 805 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
806 | 806 | } |
807 | 807 | } |
808 | 808 | if ($origLat != "" && $origLon != "" && $dist != "") { |
809 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
810 | - $query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
809 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
810 | + $query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
811 | 811 | FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
812 | 812 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
813 | 813 | } else { |
@@ -821,12 +821,12 @@ discard block |
||
821 | 821 | $additional_query .= " AND (spotter_archive_output.waypoints <> '')"; |
822 | 822 | } |
823 | 823 | |
824 | - $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
824 | + $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
825 | 825 | WHERE spotter_archive_output.ident <> '' |
826 | 826 | ".$additional_query." |
827 | 827 | ".$filter_query.$orderby_query; |
828 | 828 | } |
829 | - $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
|
829 | + $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
|
830 | 830 | return $spotter_array; |
831 | 831 | } |
832 | 832 | |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | try { |
842 | 842 | $sth = $this->db->prepare($query); |
843 | 843 | $sth->execute(); |
844 | - } catch(PDOException $e) { |
|
844 | + } catch (PDOException $e) { |
|
845 | 845 | return "error"; |
846 | 846 | } |
847 | 847 | } |
@@ -874,8 +874,8 @@ discard block |
||
874 | 874 | if ($limit != "") { |
875 | 875 | $limit_array = explode(",", $limit); |
876 | 876 | |
877 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
878 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
877 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
878 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
879 | 879 | |
880 | 880 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
881 | 881 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | $query_values = array(); |
914 | 914 | $limit_query = ''; |
915 | 915 | $additional_query = ''; |
916 | - $filter_query = $this->getFilter($filter,true,true); |
|
916 | + $filter_query = $this->getFilter($filter, true, true); |
|
917 | 917 | |
918 | 918 | if ($owner != "") { |
919 | 919 | if (!is_string($owner)) { |
@@ -927,8 +927,8 @@ discard block |
||
927 | 927 | if ($limit != "") { |
928 | 928 | $limit_array = explode(",", $limit); |
929 | 929 | |
930 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
931 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
930 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
931 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
932 | 932 | |
933 | 933 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
934 | 934 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | $query_values = array(); |
966 | 966 | $limit_query = ''; |
967 | 967 | $additional_query = ''; |
968 | - $filter_query = $this->getFilter($filter,true,true); |
|
968 | + $filter_query = $this->getFilter($filter, true, true); |
|
969 | 969 | |
970 | 970 | if ($pilot != "") { |
971 | 971 | $additional_query = " AND (spotter_archive_output.pilot_id = :pilot OR spotter_archive_output.pilot_name = :pilot)"; |
@@ -975,8 +975,8 @@ discard block |
||
975 | 975 | if ($limit != "") { |
976 | 976 | $limit_array = explode(",", $limit); |
977 | 977 | |
978 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
979 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
978 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
979 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
980 | 980 | |
981 | 981 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
982 | 982 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | * @return Array the airline country list |
1005 | 1005 | * |
1006 | 1006 | */ |
1007 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') { |
|
1007 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') { |
|
1008 | 1008 | global $globalDBdriver; |
1009 | 1009 | /* |
1010 | 1010 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | $flight_array = array(); |
1033 | 1033 | $temp_array = array(); |
1034 | 1034 | |
1035 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1035 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1036 | 1036 | $temp_array['flight_count'] = $row['nb']; |
1037 | 1037 | $temp_array['flight_country'] = $row['name']; |
1038 | 1038 | $temp_array['flight_country_iso3'] = $row['iso3']; |
@@ -1048,7 +1048,7 @@ discard block |
||
1048 | 1048 | * @return Array the airline country list |
1049 | 1049 | * |
1050 | 1050 | */ |
1051 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') { |
|
1051 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') { |
|
1052 | 1052 | global $globalDBdriver; |
1053 | 1053 | /* |
1054 | 1054 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | $flight_array = array(); |
1077 | 1077 | $temp_array = array(); |
1078 | 1078 | |
1079 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1079 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1080 | 1080 | $temp_array['airline_icao'] = $row['airline_icao']; |
1081 | 1081 | $temp_array['flight_count'] = $row['nb']; |
1082 | 1082 | $temp_array['flight_country'] = $row['name']; |
@@ -1093,13 +1093,13 @@ discard block |
||
1093 | 1093 | * @return Array the spotter information |
1094 | 1094 | * |
1095 | 1095 | */ |
1096 | - public function getDateArchiveSpotterDataById($id,$date) { |
|
1096 | + public function getDateArchiveSpotterDataById($id, $date) { |
|
1097 | 1097 | $Spotter = new Spotter($this->db); |
1098 | 1098 | date_default_timezone_set('UTC'); |
1099 | 1099 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1100 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1101 | - $date = date('c',$date); |
|
1102 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1100 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1101 | + $date = date('c', $date); |
|
1102 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1103 | 1103 | return $spotter_array; |
1104 | 1104 | } |
1105 | 1105 | |
@@ -1109,13 +1109,13 @@ discard block |
||
1109 | 1109 | * @return Array the spotter information |
1110 | 1110 | * |
1111 | 1111 | */ |
1112 | - public function getDateArchiveSpotterDataByIdent($ident,$date) { |
|
1112 | + public function getDateArchiveSpotterDataByIdent($ident, $date) { |
|
1113 | 1113 | $Spotter = new Spotter($this->db); |
1114 | 1114 | date_default_timezone_set('UTC'); |
1115 | 1115 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1116 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1117 | - $date = date('c',$date); |
|
1118 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1116 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1117 | + $date = date('c', $date); |
|
1118 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1119 | 1119 | return $spotter_array; |
1120 | 1120 | } |
1121 | 1121 | |
@@ -1125,14 +1125,14 @@ discard block |
||
1125 | 1125 | * @return Array the spotter information |
1126 | 1126 | * |
1127 | 1127 | */ |
1128 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) { |
|
1128 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) { |
|
1129 | 1129 | global $global_query; |
1130 | 1130 | $Spotter = new Spotter($this->db); |
1131 | 1131 | date_default_timezone_set('UTC'); |
1132 | 1132 | $query_values = array(); |
1133 | 1133 | $limit_query = ''; |
1134 | 1134 | $additional_query = ''; |
1135 | - $filter_query = $this->getFilter($filters,true,true); |
|
1135 | + $filter_query = $this->getFilter($filters, true, true); |
|
1136 | 1136 | |
1137 | 1137 | if ($airport != "") { |
1138 | 1138 | if (!is_string($airport)) { |
@@ -1146,8 +1146,8 @@ discard block |
||
1146 | 1146 | if ($limit != "") { |
1147 | 1147 | $limit_array = explode(",", $limit); |
1148 | 1148 | |
1149 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1150 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1149 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1150 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1151 | 1151 | |
1152 | 1152 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
1153 | 1153 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | public function __construct($dbc = null) { |
7 | 7 | $Connection = new Connection($dbc); |
8 | 8 | $this->db = $Connection->db; |
9 | - if ($this->db === null) die('Error: No DB connection. (SpotterArchive)'); |
|
9 | + if ($this->db === null) { |
|
10 | + die('Error: No DB connection. (SpotterArchive)'); |
|
11 | + } |
|
10 | 12 | } |
11 | 13 | |
12 | 14 | /** |
@@ -27,7 +29,9 @@ discard block |
||
27 | 29 | if (isset($filter[0]['source'])) { |
28 | 30 | $filters = array_merge($filters,$filter); |
29 | 31 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) { |
|
33 | + $filter = array_merge($filter,$globalFilter); |
|
34 | + } |
|
31 | 35 | $filter_query_join = ''; |
32 | 36 | $filter_query_where = ''; |
33 | 37 | foreach($filters as $flt) { |
@@ -119,8 +123,11 @@ discard block |
||
119 | 123 | } |
120 | 124 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
121 | 125 | } |
122 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
123 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
126 | + if ($filter_query_where == '' && $where) { |
|
127 | + $filter_query_where = ' WHERE'; |
|
128 | + } elseif ($filter_query_where != '' && $and) { |
|
129 | + $filter_query_where .= ' AND'; |
|
130 | + } |
|
124 | 131 | if ($filter_query_where != '') { |
125 | 132 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
126 | 133 | } |
@@ -134,10 +141,17 @@ discard block |
||
134 | 141 | if ($over_country == '') { |
135 | 142 | $Spotter = new Spotter($this->db); |
136 | 143 | $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
137 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
138 | - else $country = ''; |
|
139 | - } else $country = $over_country; |
|
140 | - if ($airline_type === NULL) $airline_type =''; |
|
144 | + if (!empty($data_country)) { |
|
145 | + $country = $data_country['iso2']; |
|
146 | + } else { |
|
147 | + $country = ''; |
|
148 | + } |
|
149 | + } else { |
|
150 | + $country = $over_country; |
|
151 | + } |
|
152 | + if ($airline_type === NULL) { |
|
153 | + $airline_type =''; |
|
154 | + } |
|
141 | 155 | |
142 | 156 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
143 | 157 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
@@ -598,7 +612,9 @@ discard block |
||
598 | 612 | $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
599 | 613 | $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
600 | 614 | $translate = $Translation->ident2icao($q_item); |
601 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
615 | + if ($translate != $q_item) { |
|
616 | + $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
617 | + } |
|
602 | 618 | $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
603 | 619 | $additional_query .= ")"; |
604 | 620 | } |
@@ -778,7 +794,9 @@ discard block |
||
778 | 794 | date_default_timezone_set($globalTimezone); |
779 | 795 | $datetime = new DateTime(); |
780 | 796 | $offset = $datetime->format('P'); |
781 | - } else $offset = '+00:00'; |
|
797 | + } else { |
|
798 | + $offset = '+00:00'; |
|
799 | + } |
|
782 | 800 | if ($date_array[1] != "") { |
783 | 801 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
784 | 802 | $date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1])); |
@@ -1021,9 +1039,13 @@ discard block |
||
1021 | 1039 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1022 | 1040 | } |
1023 | 1041 | } |
1024 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1042 | + if ($sincedate != '') { |
|
1043 | + $query .= "AND date > '".$sincedate."' "; |
|
1044 | + } |
|
1025 | 1045 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1026 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1046 | + if ($limit) { |
|
1047 | + $query .= " LIMIT 0,10"; |
|
1048 | + } |
|
1027 | 1049 | |
1028 | 1050 | |
1029 | 1051 | $sth = $this->db->prepare($query); |
@@ -1065,9 +1087,13 @@ discard block |
||
1065 | 1087 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1066 | 1088 | } |
1067 | 1089 | } |
1068 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1090 | + if ($sincedate != '') { |
|
1091 | + $query .= "AND s.date > '".$sincedate."' "; |
|
1092 | + } |
|
1069 | 1093 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1070 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1094 | + if ($limit) { |
|
1095 | + $query .= " LIMIT 0,10"; |
|
1096 | + } |
|
1071 | 1097 | |
1072 | 1098 | |
1073 | 1099 | $sth = $this->db->prepare($query); |
@@ -60,24 +60,24 @@ discard block |
||
60 | 60 | $min = false; |
61 | 61 | $allhistory = false; |
62 | 62 | $filter['source'] = array(); |
63 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
64 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
65 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
66 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
67 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
68 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
69 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
70 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
71 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
72 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
63 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
64 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
65 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
66 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
67 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
68 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
69 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
70 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
71 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
72 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
73 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
74 | 74 | |
75 | 75 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
76 | 76 | $min = true; |
77 | 77 | } else $min = false; |
78 | 78 | |
79 | 79 | if (isset($_GET['ident'])) { |
80 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
80 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
81 | 81 | $from_archive = true; |
82 | 82 | if ($tracker) { |
83 | 83 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $allhistory = true; |
92 | 92 | } |
93 | 93 | elseif (isset($_GET['flightaware_id'])) { |
94 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
94 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
95 | 95 | $from_archive = true; |
96 | 96 | if ($tracker) { |
97 | 97 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
@@ -106,23 +106,23 @@ discard block |
||
106 | 106 | } |
107 | 107 | elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
108 | 108 | $from_archive = true; |
109 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
109 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
110 | 110 | if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
111 | 111 | else $begindate = $begindate - 3000; |
112 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
113 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
112 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
113 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
114 | 114 | if ($begindate != '' && $enddate != '') { |
115 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
116 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
115 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
116 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
117 | 117 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
118 | 118 | if ($tracker) { |
119 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
119 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
120 | 120 | } |
121 | 121 | elseif ($marine) { |
122 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
122 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
123 | 123 | } |
124 | 124 | else { |
125 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
125 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | if ($flightcnt == '') $flightcnt = 0; |
134 | 134 | } else $flightcnt = 0; |
135 | 135 | |
136 | -$sqltime = round(microtime(true)-$begintime,2); |
|
136 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
137 | 137 | |
138 | 138 | $pfi = ''; |
139 | 139 | //var_dump($spotter_array); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | if (!empty($spotter_array) && is_array($spotter_array)) { |
150 | 150 | $output .= '"features": ['; |
151 | - foreach($spotter_array as $spotter_item) { |
|
151 | + foreach ($spotter_array as $spotter_item) { |
|
152 | 152 | $j++; |
153 | 153 | date_default_timezone_set('UTC'); |
154 | 154 | if ($tracker) { |
@@ -310,17 +310,17 @@ discard block |
||
310 | 310 | $k++; |
311 | 311 | $output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].'],'; |
312 | 312 | $output_time .= (strtotime($spotter_history['date'])*1000).','; |
313 | - if ($previousts != 0) $output_timediff .= (strtotime($spotter_history['date'])-$previousts).','; |
|
313 | + if ($previousts != 0) $output_timediff .= (strtotime($spotter_history['date']) - $previousts).','; |
|
314 | 314 | $previousts = strtotime($spotter_history['date']); |
315 | 315 | if ($k > 1 && (strtotime($spotter_history['date'])*1000 > $enddate)) $end = true; |
316 | 316 | } |
317 | 317 | } |
318 | 318 | if (isset($output_time)) { |
319 | - $output_time = substr($output_time, 0, -1); |
|
319 | + $output_time = substr($output_time, 0, -1); |
|
320 | 320 | $output .= '"time": ['.$output_time.'],'; |
321 | 321 | } |
322 | 322 | if (isset($output_timediff)) { |
323 | - $output_timediff = substr($output_timediff, 0, -1); |
|
323 | + $output_timediff = substr($output_timediff, 0, -1); |
|
324 | 324 | $output .= '"timediff": ['.$output_timediff.'],'; |
325 | 325 | } |
326 | 326 | // FIXME : type when not aircraft ? |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $output .= '"coordinates": ['; |
334 | 334 | |
335 | 335 | if (isset($output_history)) { |
336 | - $output_history = substr($output_history, 0, -1); |
|
336 | + $output_history = substr($output_history, 0, -1); |
|
337 | 337 | $output .= $output_history; |
338 | 338 | } |
339 | 339 | $output .= ']'; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $output = substr($output, 0, -1); |
345 | 345 | $output .= ']'; |
346 | 346 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
347 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
347 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
348 | 348 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
349 | 349 | $output .= '"fc": "'.$flightcnt.'"'; |
350 | 350 | } else { |
@@ -22,12 +22,10 @@ discard block |
||
22 | 22 | if ($tracker) { |
23 | 23 | require_once('require/class.Tracker.php'); |
24 | 24 | require_once('require/class.TrackerArchive.php'); |
25 | -} |
|
26 | -elseif ($marine) { |
|
25 | +} elseif ($marine) { |
|
27 | 26 | require_once('require/class.Marine.php'); |
28 | 27 | require_once('require/class.MarineArchive.php'); |
29 | -} |
|
30 | -else { |
|
28 | +} else { |
|
31 | 29 | require_once('require/class.Spotter.php'); |
32 | 30 | require_once('require/class.SpotterArchive.php'); |
33 | 31 | } |
@@ -35,12 +33,10 @@ discard block |
||
35 | 33 | if ($tracker) { |
36 | 34 | $Tracker = new Tracker(); |
37 | 35 | $TrackerArchive = new TrackerArchive(); |
38 | -} |
|
39 | -elseif ($marine) { |
|
36 | +} elseif ($marine) { |
|
40 | 37 | $Marine = new Marine(); |
41 | 38 | $MarineArchive = new MarineArchive(); |
42 | -} |
|
43 | -else { |
|
39 | +} else { |
|
44 | 40 | $Spotter = new Spotter(); |
45 | 41 | $SpotterArchive = new SpotterArchive(); |
46 | 42 | } |
@@ -53,62 +49,86 @@ discard block |
||
53 | 49 | } |
54 | 50 | header('Content-Type: text/javascript'); |
55 | 51 | |
56 | -if (!isset($globalJsonCompress)) $compress = true; |
|
57 | -else $compress = $globalJsonCompress; |
|
52 | +if (!isset($globalJsonCompress)) { |
|
53 | + $compress = true; |
|
54 | +} else { |
|
55 | + $compress = $globalJsonCompress; |
|
56 | +} |
|
58 | 57 | |
59 | 58 | $from_archive = false; |
60 | 59 | $min = false; |
61 | 60 | $allhistory = false; |
62 | 61 | $filter['source'] = array(); |
63 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
64 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
65 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
66 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
67 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
68 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
69 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
70 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
71 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
72 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
62 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
63 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
64 | +} |
|
65 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
66 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
67 | +} |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
69 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
70 | +} |
|
71 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
72 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
73 | +} |
|
74 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
75 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
76 | +} |
|
77 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
78 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
79 | +} |
|
80 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
81 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
82 | +} |
|
83 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
84 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
85 | +} |
|
86 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
87 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
88 | +} |
|
89 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
90 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
91 | +} |
|
92 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
93 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
94 | +} |
|
74 | 95 | |
75 | 96 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
76 | 97 | $min = true; |
77 | -} else $min = false; |
|
98 | +} else { |
|
99 | + $min = false; |
|
100 | +} |
|
78 | 101 | |
79 | 102 | if (isset($_GET['ident'])) { |
80 | 103 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
81 | 104 | $from_archive = true; |
82 | 105 | if ($tracker) { |
83 | 106 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
84 | - } |
|
85 | - elseif ($marine) { |
|
107 | + } elseif ($marine) { |
|
86 | 108 | $spotter_array = $MarineArchive->getLastArchiveMarineDataByIdent($ident); |
87 | - } |
|
88 | - else { |
|
109 | + } else { |
|
89 | 110 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident); |
90 | 111 | } |
91 | 112 | $allhistory = true; |
92 | -} |
|
93 | -elseif (isset($_GET['flightaware_id'])) { |
|
113 | +} elseif (isset($_GET['flightaware_id'])) { |
|
94 | 114 | $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
95 | 115 | $from_archive = true; |
96 | 116 | if ($tracker) { |
97 | 117 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
98 | - } |
|
99 | - elseif ($marine) { |
|
118 | + } elseif ($marine) { |
|
100 | 119 | $spotter_array = $MarineArchive->getLastArchiveMarineDataById($flightaware_id); |
101 | - } |
|
102 | - else { |
|
120 | + } else { |
|
103 | 121 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
104 | 122 | } |
105 | 123 | $allhistory = true; |
106 | -} |
|
107 | -elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
124 | +} elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
108 | 125 | $from_archive = true; |
109 | 126 | $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
110 | - if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
|
111 | - else $begindate = $begindate - 3000; |
|
127 | + if (isset($globalAircraftMaxUpdate)) { |
|
128 | + $begindate = $begindate - $globalAircraftMaxUpdate; |
|
129 | + } else { |
|
130 | + $begindate = $begindate - 3000; |
|
131 | + } |
|
112 | 132 | $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
113 | 133 | $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
114 | 134 | if ($begindate != '' && $enddate != '') { |
@@ -117,11 +137,9 @@ discard block |
||
117 | 137 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
118 | 138 | if ($tracker) { |
119 | 139 | $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
120 | - } |
|
121 | - elseif ($marine) { |
|
140 | + } elseif ($marine) { |
|
122 | 141 | $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
123 | - } |
|
124 | - else { |
|
142 | + } else { |
|
125 | 143 | $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
126 | 144 | } |
127 | 145 | } |
@@ -130,8 +148,12 @@ discard block |
||
130 | 148 | if (!empty($spotter_array)) { |
131 | 149 | //$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
132 | 150 | $flightcnt = 0; |
133 | - if ($flightcnt == '') $flightcnt = 0; |
|
134 | -} else $flightcnt = 0; |
|
151 | + if ($flightcnt == '') { |
|
152 | + $flightcnt = 0; |
|
153 | + } |
|
154 | + } else { |
|
155 | + $flightcnt = 0; |
|
156 | +} |
|
135 | 157 | |
136 | 158 | $sqltime = round(microtime(true)-$begintime,2); |
137 | 159 | |
@@ -141,8 +163,11 @@ discard block |
||
141 | 163 | |
142 | 164 | $output = '{'; |
143 | 165 | $output .= '"type": "FeatureCollection",'; |
144 | -if ($min) $output .= '"minimal": "true",'; |
|
145 | -else $output .= '"minimal": "false",'; |
|
166 | +if ($min) { |
|
167 | + $output .= '"minimal": "true",'; |
|
168 | +} else { |
|
169 | + $output .= '"minimal": "false",'; |
|
170 | +} |
|
146 | 171 | $output .= '"fc": "'.$flightcnt.'",'; |
147 | 172 | $output .= '"sqt": "'.$sqltime.'",'; |
148 | 173 | |
@@ -155,19 +180,23 @@ discard block |
||
155 | 180 | if ($pfi != $spotter_item['famtrackid']) { |
156 | 181 | $spotter_history_array = $TrackerArchive->getCoordArchiveTrackerDataById($spotter_item['famtrackid']); |
157 | 182 | $pfi = $spotter_item['famtrackid']; |
158 | - } else $spotter_history_array = 0; |
|
159 | - } |
|
160 | - elseif ($marine) { |
|
183 | + } else { |
|
184 | + $spotter_history_array = 0; |
|
185 | + } |
|
186 | + } elseif ($marine) { |
|
161 | 187 | if ($pfi != $spotter_item['fammarine_d']) { |
162 | 188 | $spotter_history_array = $MarineArchive->getCoordArchiveMarineDataById($spotter_item['fammarine_id']); |
163 | 189 | $pfi = $spotter_item['fammarine_id']; |
164 | - } else $spotter_history_array = 0; |
|
165 | - } |
|
166 | - else { |
|
190 | + } else { |
|
191 | + $spotter_history_array = 0; |
|
192 | + } |
|
193 | + } else { |
|
167 | 194 | if ($pfi != $spotter_item['flightaware_id']) { |
168 | 195 | $spotter_history_array = $SpotterArchive->getCoordArchiveSpotterDataById($spotter_item['flightaware_id']); |
169 | 196 | $pfi = $spotter_item['flightaware_id']; |
170 | - } else $spotter_history_array = 0; |
|
197 | + } else { |
|
198 | + $spotter_history_array = 0; |
|
199 | + } |
|
171 | 200 | } |
172 | 201 | if (count($spotter_history_array) > 1) { |
173 | 202 | //location of aircraft |
@@ -175,20 +204,28 @@ discard block |
||
175 | 204 | $output .= '"type": "Feature",'; |
176 | 205 | $output .= '"properties": {'; |
177 | 206 | $output .= '"fi": "'.$pfi.'",'; |
178 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
207 | + if (isset($begindate)) { |
|
208 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
209 | + } |
|
179 | 210 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
180 | 211 | $output .= '"c": "'.$spotter_item['ident'].'",'; |
181 | 212 | } else { |
182 | 213 | $output .= '"c": "NA",'; |
183 | 214 | } |
184 | 215 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
185 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
186 | - else { |
|
216 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
217 | + $spotter_item['aircraft_shadow'] = ''; |
|
218 | + } else { |
|
187 | 219 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
188 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
189 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
190 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
191 | - else $spotter_item['aircraft_shadow'] = ''; |
|
220 | + if (count($aircraft_info) > 0) { |
|
221 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
222 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
223 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
224 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
225 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
226 | + } else { |
|
227 | + $spotter_item['aircraft_shadow'] = ''; |
|
228 | + } |
|
192 | 229 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
193 | 230 | } |
194 | 231 | } |
@@ -196,93 +233,139 @@ discard block |
||
196 | 233 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
197 | 234 | if ($tracker) { |
198 | 235 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
199 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
200 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
201 | - } |
|
202 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
203 | - if ($compress) $output .= '"as": "police.png",'; |
|
204 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
205 | - } |
|
206 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
207 | - if ($compress) $output .= '"as": "ship.png",'; |
|
208 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
209 | - } |
|
210 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
211 | - if ($compress) $output .= '"as": "ship.png",'; |
|
212 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
213 | - } |
|
214 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
215 | - if ($compress) $output .= '"as": "ship.png",'; |
|
216 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
217 | - } |
|
218 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
219 | - if ($compress) $output .= '"as": "truck.png",'; |
|
220 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
221 | - } |
|
222 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
223 | - if ($compress) $output .= '"as": "truck.png",'; |
|
224 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
225 | - } |
|
226 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
227 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
228 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
236 | + if ($compress) { |
|
237 | + $output .= '"as": "ambulance.png",'; |
|
238 | + } else { |
|
239 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
240 | + } |
|
241 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
242 | + if ($compress) { |
|
243 | + $output .= '"as": "police.png",'; |
|
244 | + } else { |
|
245 | + $output .= '"aircraft_shadow": "police.png",'; |
|
246 | + } |
|
247 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
248 | + if ($compress) { |
|
249 | + $output .= '"as": "ship.png",'; |
|
250 | + } else { |
|
251 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
252 | + } |
|
253 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
254 | + if ($compress) { |
|
255 | + $output .= '"as": "ship.png",'; |
|
256 | + } else { |
|
257 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
258 | + } |
|
259 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
260 | + if ($compress) { |
|
261 | + $output .= '"as": "ship.png",'; |
|
262 | + } else { |
|
263 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
264 | + } |
|
265 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
266 | + if ($compress) { |
|
267 | + $output .= '"as": "truck.png",'; |
|
268 | + } else { |
|
269 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
270 | + } |
|
271 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
272 | + if ($compress) { |
|
273 | + $output .= '"as": "truck.png",'; |
|
274 | + } else { |
|
275 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
276 | + } |
|
277 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
278 | + if ($compress) { |
|
279 | + $output .= '"as": "aircraft.png",'; |
|
280 | + } else { |
|
281 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
282 | + } |
|
283 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
284 | + if ($compress) { |
|
285 | + $output .= '"as": "aircraft.png",'; |
|
286 | + } else { |
|
287 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
288 | + } |
|
289 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
290 | + if ($compress) { |
|
291 | + $output .= '"as": "helico.png",'; |
|
292 | + } else { |
|
293 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
294 | + } |
|
295 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
296 | + if ($compress) { |
|
297 | + $output .= '"as": "rail.png",'; |
|
298 | + } else { |
|
299 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
300 | + } |
|
301 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
302 | + if ($compress) { |
|
303 | + $output .= '"as": "firetruck.png",'; |
|
304 | + } else { |
|
305 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
306 | + } |
|
307 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
308 | + if ($compress) { |
|
309 | + $output .= '"as": "bus.png",'; |
|
310 | + } else { |
|
311 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
312 | + } |
|
313 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
314 | + if ($compress) { |
|
315 | + $output .= '"as": "phone.png",'; |
|
316 | + } else { |
|
317 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
318 | + } |
|
319 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
320 | + if ($compress) { |
|
321 | + $output .= '"as": "jogger.png",'; |
|
322 | + } else { |
|
323 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
324 | + } |
|
325 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
326 | + if ($compress) { |
|
327 | + $output .= '"as": "bike.png",'; |
|
328 | + } else { |
|
329 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
330 | + } |
|
331 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
332 | + if ($compress) { |
|
333 | + $output .= '"as": "motorcycle.png",'; |
|
334 | + } else { |
|
335 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
336 | + } |
|
337 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
338 | + if ($compress) { |
|
339 | + $output .= '"as": "balloon.png",'; |
|
340 | + } else { |
|
341 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
342 | + } |
|
343 | + } else { |
|
344 | + if ($compress) { |
|
345 | + $output .= '"as": "car.png",'; |
|
346 | + } else { |
|
347 | + $output .= '"aircraft_shadow": "car.png",'; |
|
348 | + } |
|
229 | 349 | } |
230 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
231 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
232 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
350 | + } elseif ($marine) { |
|
351 | + if ($compress) { |
|
352 | + $output .= '"as": "ship.png",'; |
|
353 | + } else { |
|
354 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
233 | 355 | } |
234 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
235 | - if ($compress) $output .= '"as": "helico.png",'; |
|
236 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
237 | - } |
|
238 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
239 | - if ($compress) $output .= '"as": "rail.png",'; |
|
240 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
241 | - } |
|
242 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
243 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
244 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
245 | - } |
|
246 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
247 | - if ($compress) $output .= '"as": "bus.png",'; |
|
248 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
249 | - } |
|
250 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
251 | - if ($compress) $output .= '"as": "phone.png",'; |
|
252 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
253 | - } |
|
254 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
255 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
256 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
257 | - } |
|
258 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
259 | - if ($compress) $output .= '"as": "bike.png",'; |
|
260 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
261 | - } |
|
262 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
263 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
264 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
265 | - } |
|
266 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
267 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
268 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
269 | - } |
|
270 | - else { |
|
271 | - if ($compress) $output .= '"as": "car.png",'; |
|
272 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
356 | + } else { |
|
357 | + if ($compress) { |
|
358 | + $output .= '"as": "default.png",'; |
|
359 | + } else { |
|
360 | + $output .= '"aircraft_shadow": "default.png",'; |
|
273 | 361 | } |
274 | 362 | } |
275 | - elseif ($marine) { |
|
276 | - if ($compress) $output .= '"as": "ship.png",'; |
|
277 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
278 | - } |
|
279 | - else { |
|
280 | - if ($compress) $output .= '"as": "default.png",'; |
|
281 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
282 | - } |
|
283 | 363 | } else { |
284 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
285 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
364 | + if ($compress) { |
|
365 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
366 | + } else { |
|
367 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
368 | + } |
|
286 | 369 | } |
287 | 370 | |
288 | 371 | if (isset($spotter_item['date_iso_8601'])) { |
@@ -310,9 +393,13 @@ discard block |
||
310 | 393 | $k++; |
311 | 394 | $output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].'],'; |
312 | 395 | $output_time .= (strtotime($spotter_history['date'])*1000).','; |
313 | - if ($previousts != 0) $output_timediff .= (strtotime($spotter_history['date'])-$previousts).','; |
|
396 | + if ($previousts != 0) { |
|
397 | + $output_timediff .= (strtotime($spotter_history['date'])-$previousts).','; |
|
398 | + } |
|
314 | 399 | $previousts = strtotime($spotter_history['date']); |
315 | - if ($k > 1 && (strtotime($spotter_history['date'])*1000 > $enddate)) $end = true; |
|
400 | + if ($k > 1 && (strtotime($spotter_history['date'])*1000 > $enddate)) { |
|
401 | + $end = true; |
|
402 | + } |
|
316 | 403 | } |
317 | 404 | } |
318 | 405 | if (isset($output_time)) { |
@@ -324,8 +411,11 @@ discard block |
||
324 | 411 | $output .= '"timediff": ['.$output_timediff.'],'; |
325 | 412 | } |
326 | 413 | // FIXME : type when not aircraft ? |
327 | - if ($compress) $output .= '"t": "aircraft"'; |
|
328 | - else $output .= '"type": "aircraft"'; |
|
414 | + if ($compress) { |
|
415 | + $output .= '"t": "aircraft"'; |
|
416 | + } else { |
|
417 | + $output .= '"type": "aircraft"'; |
|
418 | + } |
|
329 | 419 | $output .= '},'; |
330 | 420 | $output .= '"geometry": {'; |
331 | 421 | //$output .= '"type": "MultiPoint",'; |
@@ -345,7 +435,9 @@ discard block |
||
345 | 435 | $output .= ']'; |
346 | 436 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
347 | 437 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
348 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
438 | + if (isset($begindate)) { |
|
439 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
440 | + } |
|
349 | 441 | $output .= '"fc": "'.$flightcnt.'"'; |
350 | 442 | } else { |
351 | 443 | $output .= '"features": '; |