@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | require_once(dirname(__FILE__).'/require/class.Common.php'); |
6 | 6 | $Common = new Common(); |
7 | -$showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop'); |
|
8 | -$showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
|
7 | +$showRouteStop = $Common->multiKeyExists($spotter_array, 'route_stop'); |
|
8 | +$showDuration = $Common->multiKeyExists($spotter_array, 'duration'); |
|
9 | 9 | |
10 | 10 | if (!isset($_GET['sort'])) |
11 | 11 | { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | print '<th class="more"></th>'; |
101 | 101 | print '</thead>'; |
102 | -} else if (strtolower($current_page) == "upcoming"){ |
|
102 | +} else if (strtolower($current_page) == "upcoming") { |
|
103 | 103 | print '<thead>'; |
104 | 104 | if ($_GET['sort'] == "airline_name_asc") |
105 | 105 | { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | */ |
151 | 151 | print '</thead>'; |
152 | -} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){ |
|
152 | +} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
|
153 | 153 | print '<thead>'; |
154 | 154 | print '<th class="aircraft_thumbnail"></th>'; |
155 | 155 | print '<th class="logo">'._("Airline").'</th>'; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | print '</thead>'; |
187 | 187 | } else { |
188 | 188 | |
189 | - if ($hide_th_links === true){ |
|
189 | + if ($hide_th_links === true) { |
|
190 | 190 | print '<thead>'; |
191 | 191 | print '<th class="aircraft_thumbnail"></th>'; |
192 | 192 | if ($_GET['sort'] == "airline_name_asc") |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | } |
378 | 378 | |
379 | 379 | print '<tbody>'."\n"; |
380 | -foreach($spotter_array as $spotter_item) |
|
380 | +foreach ($spotter_array as $spotter_item) |
|
381 | 381 | { |
382 | 382 | if (isset($globalTimezone)) |
383 | 383 | { |
@@ -412,13 +412,13 @@ discard block |
||
412 | 412 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
413 | 413 | } |
414 | 414 | if (isset($spotter_item['airline_name'])) { |
415 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
415 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
416 | 416 | } else { |
417 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
417 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
418 | 418 | } |
419 | 419 | } else { |
420 | 420 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
421 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
421 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
422 | 422 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
423 | 423 | if (isset($spotter_item['airline_name'])) { |
424 | 424 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | print '<img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" />'."\n"; |
433 | 433 | print '</td>'."\n"; |
434 | 434 | } |
435 | - } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){ |
|
435 | + } elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") { |
|
436 | 436 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
437 | 437 | $spotter_item['squawk'] = '-'; |
438 | 438 | } |
@@ -448,17 +448,17 @@ discard block |
||
448 | 448 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
449 | 449 | } |
450 | 450 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
451 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
451 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
452 | 452 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
453 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
453 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
454 | 454 | } elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) { |
455 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
455 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
456 | 456 | } else { |
457 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
457 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
458 | 458 | } |
459 | 459 | } else { |
460 | 460 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
461 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
461 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
462 | 462 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
463 | 463 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
464 | 464 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | } |
522 | 522 | print '</td>'."\n"; |
523 | 523 | // Aircraft type |
524 | - if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){ |
|
524 | + if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") { |
|
525 | 525 | print '<td class="type">'."\n"; |
526 | 526 | if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) { |
527 | 527 | print '<span class="nomobile">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</span>'."\n"; |
@@ -545,22 +545,22 @@ discard block |
||
545 | 545 | } |
546 | 546 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
547 | 547 | if ($spotter_item['departure_airport_time'] > 2460) { |
548 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
549 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
548 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
549 | + } else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
550 | 550 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
551 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
551 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
552 | 552 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
553 | 553 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
554 | 554 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
555 | 555 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
556 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
556 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
557 | 557 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
558 | 558 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
559 | 559 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
560 | 560 | if ($spotter_item['departure_airport_time'] > 2460) { |
561 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
561 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
562 | 562 | } else { |
563 | - $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
563 | + $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
564 | 564 | } |
565 | 565 | print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n"; |
566 | 566 | } |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $latitude = $spotter_item['latitude']; |
576 | 576 | $longitude = $spotter_item['longitude']; |
577 | 577 | } |
578 | - $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
|
578 | + $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude); |
|
579 | 579 | } else $distance = ''; |
580 | 580 | if ($distance != '') { |
581 | 581 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -616,20 +616,20 @@ discard block |
||
616 | 616 | } |
617 | 617 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
618 | 618 | if ($spotter_item['arrival_airport_time'] > 2460) { |
619 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
619 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
620 | 620 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
621 | 621 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
622 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
622 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
623 | 623 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
624 | 624 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
625 | 625 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
626 | 626 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
627 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
627 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
628 | 628 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
629 | 629 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
630 | 630 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
631 | 631 | if ($spotter_item['arrival_airport_time'] > 2460) { |
632 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
632 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
633 | 633 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
634 | 634 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
635 | 635 | } |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | $latitude = $spotter_item['latitude']; |
643 | 643 | $longitude = $spotter_item['longitude']; |
644 | 644 | } |
645 | - $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
|
645 | + $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude); |
|
646 | 646 | } else $distance = ''; |
647 | 647 | if ($distance != '') { |
648 | 648 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -663,21 +663,21 @@ discard block |
||
663 | 663 | } else { |
664 | 664 | //if (!isset($globalUnitDistance) || $globalUnitDistance == 'km') { |
665 | 665 | if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
666 | - print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n"; |
|
667 | - print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n"; |
|
666 | + print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n"; |
|
667 | + print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n"; |
|
668 | 668 | //} elseif ($globalUnitDistance == 'mi') { |
669 | 669 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
670 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n"; |
|
671 | - print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n"; |
|
670 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n"; |
|
671 | + print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n"; |
|
672 | 672 | //} elseif ($globalUnitDistance == 'nm') { |
673 | 673 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
674 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n"; |
|
675 | - print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n"; |
|
674 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n"; |
|
675 | + print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n"; |
|
676 | 676 | } |
677 | 677 | } |
678 | 678 | print '</td>'."\n"; |
679 | 679 | } |
680 | - if(strtolower($current_page) != "upcoming"){ |
|
680 | + if (strtolower($current_page) != "upcoming") { |
|
681 | 681 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
682 | 682 | print '<td class="pilot">'."\n"; |
683 | 683 | if ((!isset($spotter_item['pilot_id']) || $spotter_item['pilot_id'] == '') && (!isset($spotter_item['pilot_name']) || $spotter_item['pilot_name'] == '')) { |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | //if ((isset($globalIvAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalVAM) && $globalVAM) || (isset($globalphpVMS) && $globalphpVMS)) { |
713 | 713 | if ($showRouteStop) { |
714 | 714 | // Route stop |
715 | - if(strtolower($current_page) != "upcoming"){ |
|
715 | + if (strtolower($current_page) != "upcoming") { |
|
716 | 716 | print '<td class="route_stop">'."\n"; |
717 | 717 | if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') { |
718 | 718 | print '<span class="nomobile">-</span>'."\n"; |
@@ -731,11 +731,11 @@ discard block |
||
731 | 731 | } |
732 | 732 | if ($showDuration) { |
733 | 733 | // Duration |
734 | - if(strtolower($current_page) != "upcoming"){ |
|
734 | + if (strtolower($current_page) != "upcoming") { |
|
735 | 735 | print '<td class="duration">'."\n"; |
736 | 736 | if (isset($spotter_item['duration'])) { |
737 | - print '<span class="nomobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n"; |
|
738 | - print '<span class="mobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n"; |
|
737 | + print '<span class="nomobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n"; |
|
738 | + print '<span class="mobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n"; |
|
739 | 739 | } else { |
740 | 740 | print '<span class="nomobile">-</span>'."\n"; |
741 | 741 | print '<span class="mobile">-</span>'."\n"; |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
749 | 749 | if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') { |
750 | 750 | print '<td class="message"><p>'."\n"; |
751 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
751 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
752 | 752 | print '</p><p class="decode">'; |
753 | 753 | $decode_array = json_decode($spotter_item['decode']); |
754 | 754 | foreach ($decode_array as $key => $value) { |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | print '</td>'."\n"; |
759 | 759 | } else { |
760 | 760 | print '<td class="message">'."\n"; |
761 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
761 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
762 | 762 | print '</td>'."\n"; |
763 | 763 | } |
764 | 764 | } |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | } |
784 | 784 | print '</td>'."\n"; |
785 | 785 | print '<td class="message">'."\n"; |
786 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
786 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
787 | 787 | print '</td>'."\n"; |
788 | 788 | } |
789 | 789 | if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") { |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | print '</td>'."\n"; |
810 | 810 | */ |
811 | 811 | print '<td class="message">'."\n"; |
812 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
812 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
813 | 813 | print '</td>'."\n"; |
814 | 814 | } |
815 | 815 |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | $currentdate = date('Y-m-d'); |
34 | 34 | $sourcestat = $Stats->getStatsSource($currentdate); |
35 | 35 | if (!empty($sourcestat)) { |
36 | - foreach($sourcestat as $srcst) { |
|
36 | + foreach ($sourcestat as $srcst) { |
|
37 | 37 | $type = $srcst['stats_type']; |
38 | 38 | if ($type == 'polar' || $type == 'hist') { |
39 | 39 | $source = $srcst['source_name']; |
40 | 40 | $data = $srcst['source_data']; |
41 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
41 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | } |
52 | 52 | |
53 | - public function get_Schedule($id,$ident) { |
|
53 | + public function get_Schedule($id, $ident) { |
|
54 | 54 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
55 | 55 | // Get schedule here, so it's done only one time |
56 | 56 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | $schedule = $Schedule->fetchSchedule($operator); |
76 | 76 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
77 | 77 | if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
78 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
79 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
78 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime'])); |
|
79 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
80 | 80 | // Should also check if route schedule = route from DB |
81 | 81 | if ($schedule['DepartureAirportIATA'] != '') { |
82 | 82 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
99 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
99 | + $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']); |
|
100 | 100 | } |
101 | 101 | } else $scheduleexist = true; |
102 | 102 | } else $scheduleexist = true; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if ($scheduleexist) { |
105 | 105 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
106 | 106 | $sch = $Schedule->getSchedule($operator); |
107 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
107 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport' => $sch['arrival_airport_icao'], 'departure_airport' => $sch['departure_airport_icao'], 'departure_airport_time' => $sch['departure_airport_time'], 'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
108 | 108 | } |
109 | 109 | $Spotter->db = null; |
110 | 110 | $Schedule->db = null; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
132 | 132 | $Spotter = new Spotter($this->db); |
133 | 133 | $real_arrival = $this->arrival($key); |
134 | - if (isset($this->all_flights[$key]['altitude'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
134 | + if (isset($this->all_flights[$key]['altitude'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $airport_time = ''; |
146 | 146 | if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
147 | 147 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
148 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
148 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
149 | 149 | if (isset($closestAirports[0])) { |
150 | 150 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
151 | 151 | $airport_icao = $closestAirports[0]['icao']; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | break; |
161 | 161 | } |
162 | 162 | } |
163 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
163 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) { |
|
164 | 164 | $airport_icao = $closestAirports[0]['icao']; |
165 | 165 | $airport_time = $this->all_flights[$key]['datetime']; |
166 | 166 | } else { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } else { |
174 | 174 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
175 | 175 | } |
176 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
176 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
185 | 185 | foreach ($this->all_flights as $key => $flight) { |
186 | 186 | if (isset($flight['lastupdate'])) { |
187 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
187 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
188 | 188 | if (isset($this->all_flights[$key]['id'])) { |
189 | 189 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
190 | 190 | /* |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $real_arrival = $this->arrival($key); |
197 | 197 | $Spotter = new Spotter($this->db); |
198 | 198 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
199 | - $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
199 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
200 | 200 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
201 | 201 | } |
202 | 202 | // Put in archive |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $send = false; |
234 | 234 | |
235 | 235 | // SBS format is CSV format |
236 | - if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
236 | + if (is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
237 | 237 | //print_r($line); |
238 | 238 | if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
239 | 239 | |
@@ -266,25 +266,25 @@ discard block |
||
266 | 266 | |
267 | 267 | if (!isset($this->all_flights[$id])) { |
268 | 268 | $this->all_flights[$id] = array(); |
269 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
270 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
271 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
269 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
270 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true, 'source_type' => '')); |
|
271 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
272 | 272 | if (!isset($line['id'])) { |
273 | 273 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
274 | 274 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
275 | 275 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
276 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
276 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
277 | 277 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
278 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
278 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
279 | 279 | if ($globalAllFlights !== FALSE) $dataFound = true; |
280 | 280 | } |
281 | 281 | if (isset($line['source_type']) && $line['source_type'] != '') { |
282 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
282 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_type' => $line['source_type'])); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | //print_r($this->all_flights); |
286 | 286 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
287 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
287 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => trim($line['hex']))); |
|
288 | 288 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
289 | 289 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
290 | 290 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -293,13 +293,13 @@ discard block |
||
293 | 293 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
294 | 294 | $Spotter = new Spotter($this->db); |
295 | 295 | if (isset($this->all_flights[$id]['source_type'])) { |
296 | - $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
|
296 | + $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']), $this->all_flights[$id]['source_type']); |
|
297 | 297 | } else { |
298 | 298 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
299 | 299 | } |
300 | 300 | $Spotter->db = null; |
301 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
302 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
301 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
302 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | if ($globalAllFlights !== FALSE) $dataFound = true; |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $Spotter = new Spotter($this->db); |
311 | 311 | if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
312 | 312 | $Spotter->db = null; |
313 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
|
313 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $icao)); |
|
314 | 314 | } |
315 | 315 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_name'])) { |
316 | 316 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $Spotter = new Spotter($this->db); |
319 | 319 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
320 | 320 | $Spotter->db = null; |
321 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
321 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
327 | 327 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
328 | 328 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
329 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
329 | + if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
330 | 330 | } |
331 | 331 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
332 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
332 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
333 | 333 | } |
334 | 334 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
335 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
335 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
336 | 336 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
337 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
337 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
338 | 338 | } else { |
339 | 339 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
340 | 340 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
@@ -345,35 +345,35 @@ discard block |
||
345 | 345 | */ |
346 | 346 | return ''; |
347 | 347 | } |
348 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
348 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
349 | 349 | if ($globalDebug) echo "!!! Date is too old ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
350 | 350 | return ''; |
351 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
351 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
352 | 352 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
353 | 353 | return ''; |
354 | 354 | } elseif (!isset($line['datetime'])) { |
355 | 355 | date_default_timezone_set('UTC'); |
356 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
356 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
357 | 357 | } else { |
358 | 358 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
359 | 359 | return ''; |
360 | 360 | } |
361 | 361 | |
362 | 362 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
363 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
363 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
364 | 364 | } |
365 | 365 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
366 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
366 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
367 | 367 | } |
368 | 368 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
369 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
369 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => $line['pilot_id'])); |
|
370 | 370 | } |
371 | 371 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
372 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
372 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => $line['pilot_name'])); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
376 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
376 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
377 | 377 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
378 | 378 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
379 | 379 | $timeelapsed = microtime(true); |
@@ -384,10 +384,10 @@ discard block |
||
384 | 384 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
385 | 385 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
386 | 386 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
387 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
387 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
388 | 388 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
389 | 389 | $Spotter->db = null; |
390 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
390 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
@@ -399,25 +399,25 @@ discard block |
||
399 | 399 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
400 | 400 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
401 | 401 | */ |
402 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
402 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
403 | 403 | |
404 | 404 | //$putinarchive = true; |
405 | 405 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
406 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
406 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
407 | 407 | } |
408 | 408 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
409 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
409 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
410 | 410 | } |
411 | 411 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
412 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
412 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
413 | 413 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
414 | 414 | $timeelapsed = microtime(true); |
415 | 415 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
416 | 416 | $Spotter = new Spotter($this->db); |
417 | 417 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
418 | 418 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
419 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
420 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
419 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
420 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
421 | 421 | } |
422 | 422 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
423 | 423 | $timeelapsed = microtime(true); |
@@ -431,34 +431,34 @@ discard block |
||
431 | 431 | $Translation->db = null; |
432 | 432 | } |
433 | 433 | $Spotter->db = null; |
434 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
434 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
435 | 435 | } |
436 | 436 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
437 | 437 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
438 | 438 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
439 | 439 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
440 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
440 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop'])); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | if (!isset($globalFork)) $globalFork = TRUE; |
444 | 444 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
445 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
445 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | } |
449 | 449 | |
450 | 450 | if (isset($line['speed']) && $line['speed'] != '') { |
451 | 451 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
452 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
453 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
452 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
453 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
454 | 454 | //$dataFound = true; |
455 | 455 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
456 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
456 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
457 | 457 | if ($distance > 1000 && $distance < 10000) { |
458 | 458 | // use datetime |
459 | 459 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
460 | 460 | $speed = $speed*3.6; |
461 | - if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
461 | + if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
462 | 462 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
463 | 463 | } |
464 | 464 | } |
@@ -466,11 +466,11 @@ discard block |
||
466 | 466 | |
467 | 467 | |
468 | 468 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
469 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
469 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
470 | 470 | else unset($timediff); |
471 | - if ($this->tmd > 5 || (isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
471 | + if ($this->tmd > 5 || (isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')))) { |
|
472 | 472 | if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) { |
473 | - if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
473 | + if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
474 | 474 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
475 | 475 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
476 | 476 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -480,10 +480,10 @@ discard block |
||
480 | 480 | $timeelapsed = microtime(true); |
481 | 481 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
482 | 482 | $Spotter = new Spotter($this->db); |
483 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
483 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
484 | 484 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
485 | 485 | $Spotter->db = null; |
486 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
486 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
487 | 487 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
488 | 488 | } |
489 | 489 | } |
@@ -493,13 +493,13 @@ discard block |
||
493 | 493 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
494 | 494 | //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
495 | 495 | if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
496 | - if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
496 | + if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
497 | 497 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
498 | 498 | $dataFound = true; |
499 | 499 | $this->all_flights[$id]['time_last_coord'] = time(); |
500 | 500 | } |
501 | 501 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
502 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
502 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
503 | 503 | /* |
504 | 504 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
505 | 505 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -517,13 +517,13 @@ discard block |
||
517 | 517 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
518 | 518 | //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
519 | 519 | if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
520 | - if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
520 | + if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
521 | 521 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
522 | 522 | $dataFound = true; |
523 | 523 | $this->all_flights[$id]['time_last_coord'] = time(); |
524 | 524 | } |
525 | 525 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
526 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
526 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
527 | 527 | /* |
528 | 528 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
529 | 529 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -541,46 +541,46 @@ discard block |
||
541 | 541 | } else if ($globalDebug && $timediff > 30) { |
542 | 542 | $this->tmd = $this->tmd + 1; |
543 | 543 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
544 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
545 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
544 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
545 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
546 | 546 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
547 | 547 | } |
548 | 548 | } |
549 | 549 | if (isset($line['last_update']) && $line['last_update'] != '') { |
550 | 550 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
551 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
551 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
552 | 552 | } |
553 | 553 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
554 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
554 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
555 | 555 | //$dataFound = true; |
556 | 556 | } |
557 | 557 | if (isset($line['format_source']) && $line['format_source'] != '') { |
558 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
558 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
559 | 559 | } |
560 | 560 | if (isset($line['source_name']) && $line['source_name'] != '') { |
561 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
561 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
562 | 562 | } |
563 | 563 | if (isset($line['emergency']) && $line['emergency'] != '') { |
564 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
564 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
565 | 565 | //$dataFound = true; |
566 | 566 | } |
567 | 567 | if (isset($line['ground']) && $line['ground'] != '') { |
568 | 568 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
569 | 569 | // Here we force archive of flight because after ground it's a new one (or should be) |
570 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
571 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
572 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
573 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
574 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
570 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
571 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
572 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
573 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
574 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
575 | 575 | } |
576 | 576 | if ($line['ground'] != 1) $line['ground'] = 0; |
577 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
577 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
578 | 578 | //$dataFound = true; |
579 | 579 | } |
580 | 580 | if (isset($line['squawk']) && $line['squawk'] != '') { |
581 | 581 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
582 | 582 | if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
583 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
583 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
584 | 584 | $highlight = ''; |
585 | 585 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
586 | 586 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -589,47 +589,47 @@ discard block |
||
589 | 589 | $timeelapsed = microtime(true); |
590 | 590 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
591 | 591 | $Spotter = new Spotter($this->db); |
592 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
592 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
593 | 593 | $Spotter->db = null; |
594 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
594 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
595 | 595 | } |
596 | 596 | //$putinarchive = true; |
597 | 597 | //$highlight = ''; |
598 | 598 | } |
599 | 599 | |
600 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
600 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
601 | 601 | //$dataFound = true; |
602 | 602 | } |
603 | 603 | |
604 | 604 | if (isset($line['altitude']) && $line['altitude'] != '') { |
605 | 605 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
606 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
607 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
608 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
606 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
607 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
608 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
609 | 609 | //$dataFound = true; |
610 | 610 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
611 | 611 | } |
612 | 612 | |
613 | 613 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
614 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
614 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | if (isset($line['heading']) && $line['heading'] != '') { |
618 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
619 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
620 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
618 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
619 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
620 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
621 | 621 | //$dataFound = true; |
622 | 622 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
623 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
624 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
625 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
623 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
624 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
625 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
626 | 626 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
627 | 627 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
628 | 628 | // If not enough messages and ACARS set heading to 0 |
629 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
629 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
630 | 630 | } |
631 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
632 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
631 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
632 | + elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
633 | 633 | |
634 | 634 | // print_r($this->all_flights[$id]); |
635 | 635 | //gets the callsign from the last hour |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
640 | 640 | $this->all_flights[$id]['lastupdate'] = time(); |
641 | 641 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
642 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
642 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
643 | 643 | //print_r($this->all_flights); |
644 | 644 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
645 | 645 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -650,61 +650,61 @@ discard block |
||
650 | 650 | $SpotterLive = new SpotterLive($this->db); |
651 | 651 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
652 | 652 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
653 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
653 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
654 | 654 | } elseif (isset($line['id'])) { |
655 | 655 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
656 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
656 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
657 | 657 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
658 | 658 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
659 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
659 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
660 | 660 | } else $recent_ident = ''; |
661 | - $SpotterLive->db=null; |
|
661 | + $SpotterLive->db = null; |
|
662 | 662 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
663 | 663 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
664 | 664 | } else $recent_ident = ''; |
665 | 665 | } else { |
666 | 666 | $recent_ident = ''; |
667 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
667 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
668 | 668 | } |
669 | 669 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
670 | - if($recent_ident == "") |
|
670 | + if ($recent_ident == "") |
|
671 | 671 | { |
672 | 672 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
673 | 673 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
674 | 674 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
675 | 675 | //adds the spotter data for the archive |
676 | 676 | $ignoreImport = false; |
677 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
677 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
678 | 678 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
679 | 679 | $ignoreImport = true; |
680 | 680 | } |
681 | 681 | } |
682 | 682 | if (count($globalAirportAccept) > 0) { |
683 | 683 | $ignoreImport = true; |
684 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
684 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
685 | 685 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
686 | 686 | $ignoreImport = false; |
687 | 687 | } |
688 | 688 | } |
689 | 689 | } |
690 | 690 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
691 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
692 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
691 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
692 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
693 | 693 | $ignoreImport = true; |
694 | 694 | } |
695 | 695 | } |
696 | 696 | } |
697 | 697 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
698 | 698 | $ignoreImport = true; |
699 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
700 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
699 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
700 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
701 | 701 | $ignoreImport = false; |
702 | 702 | } |
703 | 703 | } |
704 | 704 | } |
705 | 705 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
706 | 706 | $ignoreImport = true; |
707 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
707 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
708 | 708 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
709 | 709 | $ignoreImport = false; |
710 | 710 | } |
@@ -716,32 +716,32 @@ discard block |
||
716 | 716 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
717 | 717 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
718 | 718 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
719 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
719 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
720 | 720 | $timeelapsed = microtime(true); |
721 | 721 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
722 | 722 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
723 | 723 | $Spotter = new Spotter($this->db); |
724 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
724 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['source_type']); |
|
725 | 725 | $Spotter->db = null; |
726 | 726 | if ($globalDebug && isset($result)) echo $result."\n"; |
727 | 727 | } |
728 | 728 | } |
729 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
729 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
730 | 730 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
731 | 731 | |
732 | 732 | // Add source stat in DB |
733 | 733 | $Stats = new Stats($this->db); |
734 | 734 | if (!empty($this->stats)) { |
735 | 735 | if ($globalDebug) echo 'Add source stats : '; |
736 | - foreach($this->stats as $date => $data) { |
|
737 | - foreach($data as $source => $sourced) { |
|
736 | + foreach ($this->stats as $date => $data) { |
|
737 | + foreach ($data as $source => $sourced) { |
|
738 | 738 | //print_r($sourced); |
739 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
740 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
739 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
740 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
741 | 741 | if (isset($sourced['msg'])) { |
742 | 742 | if (time() - $sourced['msg']['date'] > 10) { |
743 | 743 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
744 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
744 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
745 | 745 | unset($this->stats[$date][$source]['msg']); |
746 | 746 | } |
747 | 747 | } |
@@ -779,14 +779,14 @@ discard block |
||
779 | 779 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
780 | 780 | $SpotterLive = new SpotterLive($this->db); |
781 | 781 | $SpotterLive->deleteLiveSpotterData(); |
782 | - $SpotterLive->db=null; |
|
782 | + $SpotterLive->db = null; |
|
783 | 783 | } |
784 | 784 | } |
785 | 785 | if ($globalDebug) echo " Done\n"; |
786 | 786 | $this->last_delete = time(); |
787 | 787 | } |
788 | 788 | } else { |
789 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
|
789 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
|
790 | 790 | $this->all_flights[$id]['id'] = $recent_ident; |
791 | 791 | $this->all_flights[$id]['addedSpotter'] = 1; |
792 | 792 | } |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
795 | 795 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
796 | 796 | $Spotter = new Spotter($this->db); |
797 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
797 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']); |
|
798 | 798 | $Spotter->db = null; |
799 | 799 | } |
800 | 800 | } |
@@ -820,37 +820,37 @@ discard block |
||
820 | 820 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
821 | 821 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
822 | 822 | |
823 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
823 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
824 | 824 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
825 | 825 | $ignoreImport = true; |
826 | 826 | } |
827 | 827 | } |
828 | 828 | if (count($globalAirportAccept) > 0) { |
829 | 829 | $ignoreImport = true; |
830 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
830 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
831 | 831 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
832 | 832 | $ignoreImport = false; |
833 | 833 | } |
834 | 834 | } |
835 | 835 | } |
836 | 836 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
837 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
838 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
837 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
838 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
839 | 839 | $ignoreImport = true; |
840 | 840 | } |
841 | 841 | } |
842 | 842 | } |
843 | 843 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
844 | 844 | $ignoreImport = true; |
845 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
846 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
845 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
846 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
847 | 847 | $ignoreImport = false; |
848 | 848 | } |
849 | 849 | } |
850 | 850 | } |
851 | 851 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
852 | 852 | $ignoreImport = true; |
853 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
853 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
854 | 854 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
855 | 855 | $ignoreImport = false; |
856 | 856 | } |
@@ -858,23 +858,23 @@ discard block |
||
858 | 858 | } |
859 | 859 | |
860 | 860 | if (!$ignoreImport) { |
861 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
862 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
861 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
862 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
863 | 863 | $timeelapsed = microtime(true); |
864 | 864 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
865 | 865 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
866 | 866 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
867 | 867 | $SpotterLive = new SpotterLive($this->db); |
868 | - $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
868 | + $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
869 | 869 | $SpotterLive->db = null; |
870 | 870 | if ($globalDebug) echo $result."\n"; |
871 | 871 | } |
872 | 872 | } |
873 | 873 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
874 | - $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
874 | + $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
875 | 875 | } |
876 | 876 | $this->all_flights[$id]['putinarchive'] = false; |
877 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
877 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
878 | 878 | |
879 | 879 | // Put statistics in $this->stats variable |
880 | 880 | //if ($line['format_source'] != 'aprs') { |
@@ -893,19 +893,19 @@ discard block |
||
893 | 893 | $latitude = $globalCenterLatitude; |
894 | 894 | $longitude = $globalCenterLongitude; |
895 | 895 | } |
896 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
896 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
897 | 897 | } else { |
898 | 898 | $latitude = $this->source_location[$source]['latitude']; |
899 | 899 | $longitude = $this->source_location[$source]['longitude']; |
900 | 900 | } |
901 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
901 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
902 | 902 | //$stats_heading = $stats_heading%22.5; |
903 | 903 | $stats_heading = round($stats_heading/22.5); |
904 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
904 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
905 | 905 | $current_date = date('Y-m-d'); |
906 | 906 | if ($stats_heading == 16) $stats_heading = 0; |
907 | 907 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
908 | - for ($i=0;$i<=15;$i++) { |
|
908 | + for ($i = 0; $i <= 15; $i++) { |
|
909 | 909 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
910 | 910 | } |
911 | 911 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -920,9 +920,9 @@ discard block |
||
920 | 920 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
921 | 921 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
922 | 922 | end($this->stats[$current_date][$source]['hist']); |
923 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
923 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
924 | 924 | } else $mini = 0; |
925 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
925 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
926 | 926 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
927 | 927 | } |
928 | 928 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | $this->all_flights[$id]['lastupdate'] = time(); |
936 | 936 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
937 | 937 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
938 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
938 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
939 | 939 | //$this->del(); |
940 | 940 | |
941 | 941 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
@@ -9,14 +9,14 @@ discard block |
||
9 | 9 | |
10 | 10 | $from_archive = false; |
11 | 11 | if (isset($_GET['ident'])) { |
12 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
12 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
13 | 13 | if (isset($_GET['currenttime'])) { |
14 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
14 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
15 | 15 | $currenttime = round($currenttime/1000); |
16 | - $spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime); |
|
16 | + $spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime); |
|
17 | 17 | if (empty($spotter_array)) { |
18 | 18 | $from_archive = true; |
19 | - $spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime); |
|
19 | + $spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime); |
|
20 | 20 | } |
21 | 21 | } else { |
22 | 22 | $spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident); |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | } |
28 | 28 | } |
29 | 29 | if (isset($_GET['flightaware_id'])) { |
30 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
30 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
31 | 31 | if (isset($_GET['currenttime'])) { |
32 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
32 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
33 | 33 | $currenttime = round($currenttime/1000); |
34 | - $spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime); |
|
34 | + $spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime); |
|
35 | 35 | if (empty($spotter_array)) { |
36 | 36 | $from_archive = true; |
37 | 37 | // $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
38 | - $spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime); |
|
38 | + $spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime); |
|
39 | 39 | } |
40 | 40 | } else { |
41 | 41 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
55 | 55 | { |
56 | 56 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
57 | - $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
57 | + $image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
58 | 58 | } else $image = $spotter_item['image_thumbnail']; |
59 | 59 | |
60 | 60 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
73 | 73 | if (isset($spotter_item['departure_airport_time'])) { |
74 | 74 | if ($spotter_item['departure_airport_time'] > 2460) { |
75 | - print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>'; |
|
75 | + print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>'; |
|
76 | 76 | } else { |
77 | 77 | print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>'; |
78 | 78 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country']; |
82 | 82 | if (isset($spotter_item['arrival_airport_time'])) { |
83 | 83 | if ($spotter_item['arrival_airport_time'] > 2460) { |
84 | - print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>'; |
|
84 | + print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>'; |
|
85 | 85 | } else { |
86 | 86 | print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>'; |
87 | 87 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
153 | 153 | if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
154 | -if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
154 | +if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>'; |
|
155 | 155 | if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
156 | 156 | print '</div>'; |
157 | 157 | ?> |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $Stats = new Stats(); |
8 | 8 | |
9 | 9 | if (!isset($filter_name)) $filter_name = ''; |
10 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
10 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
11 | 11 | if ($airline_icao == '' && isset($globalFilter)) { |
12 | 12 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
13 | 13 | } |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | $title = _("Statistics"); |
23 | 23 | } |
24 | 24 | |
25 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
26 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
25 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
26 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
27 | 27 | |
28 | 28 | require_once('header.php'); |
29 | 29 | |
@@ -49,36 +49,36 @@ discard block |
||
49 | 49 | date_default_timezone_set('UTC'); |
50 | 50 | $lastupdate = strtotime($last_update[0]['value']); |
51 | 51 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
52 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
52 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
53 | 53 | } |
54 | 54 | ?> |
55 | 55 | </div> |
56 | 56 | <?php include('statistics-sub-menu.php'); ?> |
57 | 57 | <p class="global-stats"> |
58 | - <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span> |
|
59 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
60 | - <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
61 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
58 | + <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span> |
|
59 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
60 | + <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
61 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
62 | 62 | <?php |
63 | - if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
63 | + if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
64 | 64 | ?> |
65 | - <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
66 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
65 | + <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
66 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
67 | 67 | <?php |
68 | 68 | } else { |
69 | 69 | ?> |
70 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
|
71 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
70 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span> |
|
71 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
72 | 72 | <?php |
73 | 73 | } |
74 | 74 | ?> |
75 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
76 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
75 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
76 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
77 | 77 | <?php |
78 | 78 | if ($airline_icao == '') { |
79 | 79 | ?> |
80 | - <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
81 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
80 | + <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
81 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
82 | 82 | <?php |
83 | 83 | } |
84 | 84 | ?> |
@@ -86,25 +86,25 @@ discard block |
||
86 | 86 | if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) { |
87 | 87 | if ($airline_icao == '' || $airline_icao == 'all') { |
88 | 88 | ?> |
89 | - <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span> |
|
90 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
89 | + <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span> |
|
90 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
91 | 91 | <?php |
92 | 92 | } |
93 | 93 | } |
94 | 94 | ?> |
95 | 95 | </p> |
96 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
96 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
97 | 97 | <div class="specific-stats"> |
98 | 98 | <div class="row column"> |
99 | 99 | <div class="col-md-6"> |
100 | 100 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
101 | 101 | <?php |
102 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
102 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
103 | 103 | if (count($aircraft_array) == 0) print _("No data available"); |
104 | 104 | else { |
105 | 105 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
106 | 106 | $aircraft_data = ''; |
107 | - foreach($aircraft_array as $aircraft_item) |
|
107 | + foreach ($aircraft_array as $aircraft_item) |
|
108 | 108 | { |
109 | 109 | $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
110 | 110 | } |
@@ -133,17 +133,17 @@ discard block |
||
133 | 133 | ?> |
134 | 134 | </div> |
135 | 135 | </div> |
136 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
136 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
137 | 137 | <?php |
138 | 138 | // echo $airline_icao; |
139 | 139 | if ($airline_icao == '' || $airline_icao == 'all') { |
140 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
140 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
141 | 141 | if (count($airline_array) > 0) { |
142 | 142 | print '<div class="col-md-6">'; |
143 | 143 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
144 | 144 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
145 | 145 | $airline_data = ''; |
146 | - foreach($airline_array as $airline_item) |
|
146 | + foreach ($airline_array as $airline_item) |
|
147 | 147 | { |
148 | 148 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
149 | 149 | } |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | } |
170 | 170 | ?> |
171 | 171 | </div> |
172 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
172 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
173 | 173 | <?php |
174 | 174 | } |
175 | 175 | ?> |
176 | 176 | <div class="row column"> |
177 | 177 | <?php |
178 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
179 | - if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
178 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
179 | + if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
180 | 180 | if (empty($flightover_array)) { |
181 | 181 | print '<div class="col-md-12">'; |
182 | 182 | } else { |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | ?> |
186 | 186 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
187 | 187 | <?php |
188 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
188 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
189 | 189 | if (count($pilot_array) == 0) print _("No data available"); |
190 | 190 | else { |
191 | 191 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
192 | 192 | $pilot_data = ''; |
193 | - foreach($pilot_array as $pilot_item) |
|
193 | + foreach ($pilot_array as $pilot_item) |
|
194 | 194 | { |
195 | 195 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
196 | 196 | } |
@@ -212,19 +212,19 @@ discard block |
||
212 | 212 | ?> |
213 | 213 | </div> |
214 | 214 | |
215 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
215 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
216 | 216 | <?php |
217 | 217 | } else { |
218 | 218 | ?> |
219 | 219 | <div class="col-md-6"> |
220 | 220 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
221 | 221 | <?php |
222 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
222 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
223 | 223 | if (count($owner_array) == 0) print _("No data available"); |
224 | 224 | else { |
225 | 225 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
226 | 226 | $owner_data = ''; |
227 | - foreach($owner_array as $owner_item) |
|
227 | + foreach ($owner_array as $owner_item) |
|
228 | 228 | { |
229 | 229 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
230 | 230 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | </div> |
245 | 245 | </div> |
246 | 246 | |
247 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
247 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
248 | 248 | <?php |
249 | 249 | } |
250 | 250 | if (!empty($flightover_array)) { |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
259 | 259 | print 'var series = ['; |
260 | 260 | $flightover_data = ''; |
261 | - foreach($flightover_array as $flightover_item) |
|
261 | + foreach ($flightover_array as $flightover_item) |
|
262 | 262 | { |
263 | 263 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
264 | 264 | } |
@@ -304,21 +304,21 @@ discard block |
||
304 | 304 | } |
305 | 305 | ?> |
306 | 306 | </div> |
307 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
307 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
308 | 308 | |
309 | 309 | |
310 | 310 | </div> |
311 | 311 | <div class="row column"> |
312 | 312 | <div class="col-md-6"> |
313 | 313 | <?php |
314 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
314 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
315 | 315 | if (count($airport_airport_array) > 0) { |
316 | 316 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
317 | 317 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
318 | 318 | print "\n"; |
319 | 319 | print 'var series = ['; |
320 | 320 | $airport_data = ''; |
321 | - foreach($airport_airport_array as $airport_item) |
|
321 | + foreach ($airport_airport_array as $airport_item) |
|
322 | 322 | { |
323 | 323 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
324 | 324 | } |
@@ -369,18 +369,18 @@ discard block |
||
369 | 369 | } |
370 | 370 | ?> |
371 | 371 | </div> |
372 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
372 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
373 | 373 | |
374 | 374 | <div class="col-md-6"> |
375 | 375 | <?php |
376 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
376 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
377 | 377 | if (count($airport_airport_array2) > 0) { |
378 | 378 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
379 | 379 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
380 | 380 | print "\n"; |
381 | 381 | print 'var series = ['; |
382 | 382 | $airport_data = ''; |
383 | - foreach($airport_airport_array2 as $airport_item) |
|
383 | + foreach ($airport_airport_array2 as $airport_item) |
|
384 | 384 | { |
385 | 385 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
386 | 386 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | ?> |
434 | 434 | </div> |
435 | 435 | </div> |
436 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
436 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
437 | 437 | <?php |
438 | 438 | if ($year == '' && $month == '') { |
439 | 439 | ?> |
@@ -441,19 +441,19 @@ discard block |
||
441 | 441 | <div class="col-md-6"> |
442 | 442 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
443 | 443 | <?php |
444 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
444 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
445 | 445 | if (count($year_array) == 0) print _("No data available"); |
446 | 446 | else { |
447 | 447 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
448 | 448 | $year_data = ''; |
449 | 449 | $year_cnt = ''; |
450 | - foreach($year_array as $year_item) |
|
450 | + foreach ($year_array as $year_item) |
|
451 | 451 | { |
452 | 452 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
453 | 453 | $year_cnt .= $year_item['date_count'].','; |
454 | 454 | } |
455 | 455 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
456 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
456 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
457 | 457 | print 'c3.generate({ |
458 | 458 | bindto: "#chart8", |
459 | 459 | data: { x: "x", |
@@ -466,23 +466,23 @@ discard block |
||
466 | 466 | <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
467 | 467 | </div> |
468 | 468 | </div> |
469 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
469 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
470 | 470 | <div class="col-md-6"> |
471 | 471 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
472 | 472 | <?php |
473 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
473 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
474 | 474 | if (count($month_array) == 0) print _("No data available"); |
475 | 475 | else { |
476 | 476 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
477 | 477 | $month_data = ''; |
478 | 478 | $month_cnt = ''; |
479 | - foreach($month_array as $month_item) |
|
479 | + foreach ($month_array as $month_item) |
|
480 | 480 | { |
481 | 481 | $month_data .= '"'.$month_item['date_name'].'",'; |
482 | 482 | $month_cnt .= $month_item['date_count'].','; |
483 | 483 | } |
484 | 484 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
485 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
485 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
486 | 486 | print 'c3.generate({ |
487 | 487 | bindto: "#chart9", |
488 | 488 | data: { x: "x", |
@@ -496,24 +496,24 @@ discard block |
||
496 | 496 | <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
497 | 497 | </div> |
498 | 498 | </div> |
499 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
499 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
500 | 500 | |
501 | 501 | <div class="col-md-6"> |
502 | 502 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
503 | 503 | <?php |
504 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
504 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
505 | 505 | if (empty($date_array)) print _("No data available"); |
506 | 506 | else { |
507 | 507 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
508 | 508 | $date_data = ''; |
509 | 509 | $date_cnt = ''; |
510 | - foreach($date_array as $date_item) |
|
510 | + foreach ($date_array as $date_item) |
|
511 | 511 | { |
512 | 512 | $date_data .= '"'.$date_item['date_name'].'",'; |
513 | 513 | $date_cnt .= $date_item['date_count'].','; |
514 | 514 | } |
515 | 515 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
516 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
516 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
517 | 517 | print 'c3.generate({ |
518 | 518 | bindto: "#chart5", |
519 | 519 | data: { x: "x", |
@@ -527,23 +527,23 @@ discard block |
||
527 | 527 | <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
528 | 528 | </div> |
529 | 529 | </div> |
530 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
530 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
531 | 531 | <div class="col-md-6"> |
532 | 532 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
533 | 533 | <?php |
534 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
534 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
535 | 535 | if (empty($hour_array)) print _("No data available"); |
536 | 536 | else { |
537 | 537 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
538 | 538 | $hour_data = ''; |
539 | 539 | $hour_cnt = ''; |
540 | - foreach($hour_array as $hour_item) |
|
540 | + foreach ($hour_array as $hour_item) |
|
541 | 541 | { |
542 | 542 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
543 | 543 | $hour_cnt .= $hour_item['hour_count'].','; |
544 | 544 | } |
545 | 545 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
546 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
546 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
547 | 547 | print 'c3.generate({ |
548 | 548 | bindto: "#chart6", |
549 | 549 | data: { |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
558 | 558 | </div> |
559 | 559 | </div> |
560 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
560 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
561 | 561 | </div> |
562 | 562 | <?php |
563 | 563 | } |
@@ -576,13 +576,13 @@ discard block |
||
576 | 576 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
577 | 577 | $year_data = ''; |
578 | 578 | $year_cnt = ''; |
579 | - foreach($year_array as $year_item) |
|
579 | + foreach ($year_array as $year_item) |
|
580 | 580 | { |
581 | 581 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
582 | 582 | $year_cnt .= $year_item['count'].','; |
583 | 583 | } |
584 | 584 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
585 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
585 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
586 | 586 | print 'c3.generate({ |
587 | 587 | bindto: "#chart32", |
588 | 588 | data: { x: "x", |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
597 | 597 | </div> |
598 | 598 | </div> |
599 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
599 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
600 | 600 | |
601 | 601 | <div class="row column"> |
602 | 602 | <div class="col-md-6"> |
@@ -608,13 +608,13 @@ discard block |
||
608 | 608 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
609 | 609 | $year_data = ''; |
610 | 610 | $year_cnt = ''; |
611 | - foreach($year_array as $year_item) |
|
611 | + foreach ($year_array as $year_item) |
|
612 | 612 | { |
613 | 613 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
614 | 614 | $year_cnt .= $year_item['count'].','; |
615 | 615 | } |
616 | 616 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
617 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
617 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
618 | 618 | print 'c3.generate({ |
619 | 619 | bindto: "#chart33", |
620 | 620 | data: { x: "x", |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
628 | 628 | </div> |
629 | 629 | </div> |
630 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
630 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
631 | 631 | <br/> |
632 | 632 | <?php |
633 | 633 | } |
@@ -640,9 +640,9 @@ discard block |
||
640 | 640 | <?php |
641 | 641 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
642 | 642 | if ($year == '' && $month == '') { |
643 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
643 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
644 | 644 | } else { |
645 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
645 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
646 | 646 | } |
647 | 647 | if (!empty($polar)) { |
648 | 648 | print '<h2>'._("Coverage pattern").'</h2>'; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | unset($polar_data); |
651 | 651 | $Spotter = new Spotter(); |
652 | 652 | $data = json_decode($eachpolar['source_data']); |
653 | - foreach($data as $value => $key) { |
|
653 | + foreach ($data as $value => $key) { |
|
654 | 654 | $direction = $Spotter->parseDirection(($value*22.5)); |
655 | 655 | $distance = $key; |
656 | 656 | $unit = 'km'; |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | ?> |
671 | 671 | <div class="col-md-6"> |
672 | 672 | <h4><?php print $eachpolar['source_name']; ?></h4> |
673 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
673 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
674 | 674 | <script> |
675 | 675 | (function() { |
676 | 676 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | color: color, |
695 | 695 | unit: '<?php echo $unit; ?>' |
696 | 696 | }; |
697 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
697 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
698 | 698 | })(); |
699 | 699 | </script> |
700 | 700 | </div> |
@@ -708,22 +708,22 @@ discard block |
||
708 | 708 | <?php |
709 | 709 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
710 | 710 | if ($year == '' && $month == '') { |
711 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
711 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
712 | 712 | } else { |
713 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
713 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
714 | 714 | } |
715 | 715 | if (!empty($msg)) { |
716 | 716 | print '<h2>'._("Messages received").'</h2>'; |
717 | 717 | foreach ($msg as $eachmsg) { |
718 | 718 | //$eachmsg = $msg[0]; |
719 | 719 | $data = $eachmsg['source_data']; |
720 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
720 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
721 | 721 | else $max = 500; |
722 | 722 | ?> |
723 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
723 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
724 | 724 | <script> |
725 | 725 | var g = new JustGage({ |
726 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
726 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
727 | 727 | value: <?php echo $data; ?>, |
728 | 728 | min: 0, |
729 | 729 | max: <?php print $max; ?>, |
@@ -745,9 +745,9 @@ discard block |
||
745 | 745 | <?php |
746 | 746 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
747 | 747 | if ($year == '' && $month == '') { |
748 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
748 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
749 | 749 | } else { |
750 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
750 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
751 | 751 | } |
752 | 752 | foreach ($hist as $hists) { |
753 | 753 | //$hist_data = ''; |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | $source = $hists['source_name']; |
757 | 757 | $hist_array = json_decode($hists['source_data']); |
758 | 758 | $unit = 'km'; |
759 | - foreach($hist_array as $distance => $nb) |
|
759 | + foreach ($hist_array as $distance => $nb) |
|
760 | 760 | { |
761 | 761 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
762 | 762 | $distance = round($distance*0.539957); |
@@ -777,18 +777,18 @@ discard block |
||
777 | 777 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
778 | 778 | ?> |
779 | 779 | <div class="col-md-6"> |
780 | - <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2> |
|
780 | + <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2> |
|
781 | 781 | <?php |
782 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
782 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
783 | 783 | print 'c3.generate({ |
784 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
784 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
785 | 785 | data: { x: "x", |
786 | 786 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
787 | 787 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
788 | 788 | print '</script>'; |
789 | 789 | ?> |
790 | 790 | </div> |
791 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
791 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
792 | 792 | <?php |
793 | 793 | } |
794 | 794 | ?> |