@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $limit_start = 0; |
30 | 30 | $limit_end = 25; |
31 | 31 | $absolute_difference = 25; |
32 | - } else { |
|
32 | + } else { |
|
33 | 33 | $limit_explode = explode(",", $_GET['limit']); |
34 | 34 | $limit_start = $limit_explode[0]; |
35 | 35 | $limit_end = $limit_explode[1]; |
@@ -46,21 +46,33 @@ discard block |
||
46 | 46 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
47 | 47 | if ($sort != '') |
48 | 48 | { |
49 | - if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
50 | - elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
51 | - else $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
49 | + if ($type == 'marine') { |
|
50 | + $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
51 | + } elseif ($type == 'tracker') { |
|
52 | + $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
53 | + } else { |
|
54 | + $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
55 | + } |
|
52 | 56 | } else { |
53 | - if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference); |
|
54 | - elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference); |
|
55 | - else $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference); |
|
57 | + if ($type == 'marine') { |
|
58 | + $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference); |
|
59 | + } elseif ($type == 'tracker') { |
|
60 | + $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference); |
|
61 | + } else { |
|
62 | + $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference); |
|
63 | + } |
|
56 | 64 | } |
57 | 65 | |
58 | 66 | if (!empty($spotter_array)) |
59 | 67 | { |
60 | 68 | date_default_timezone_set($globalTimezone); |
61 | - if ($type == 'marine') $title = sprintf(_("Detailed View for vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
62 | - elseif ($type == 'tracker') $title = sprintf(_("Detailed View for trackers from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
63 | - else $title = sprintf(_("Detailed View for flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
69 | + if ($type == 'marine') { |
|
70 | + $title = sprintf(_("Detailed View for vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
71 | + } elseif ($type == 'tracker') { |
|
72 | + $title = sprintf(_("Detailed View for trackers from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
73 | + } else { |
|
74 | + $title = sprintf(_("Detailed View for flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
75 | + } |
|
64 | 76 | |
65 | 77 | require_once('header.php'); |
66 | 78 | print '<div class="select-item">'; |
@@ -78,15 +90,24 @@ discard block |
||
78 | 90 | print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>'; |
79 | 91 | print '<br />'; |
80 | 92 | print '<div class="info column">'; |
81 | - if ($type == 'marine') print '<h1>'.sprintf(_("Vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
82 | - else print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
93 | + if ($type == 'marine') { |
|
94 | + print '<h1>'.sprintf(_("Vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
95 | + } else { |
|
96 | + print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
97 | + } |
|
83 | 98 | print '</div>'; |
84 | 99 | |
85 | - if ($type == 'aircraft') include('date-sub-menu.php'); |
|
100 | + if ($type == 'aircraft') { |
|
101 | + include('date-sub-menu.php'); |
|
102 | + } |
|
86 | 103 | print '<div class="table column">'; |
87 | - if ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
88 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
89 | - else print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
104 | + if ($type == 'marine') { |
|
105 | + print '<p>'.sprintf(_("The table below shows the detailed information of all vessels on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
106 | + } elseif ($type == 'tracker') { |
|
107 | + print '<p>'.sprintf(_("The table below shows the detailed information of all trackers on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
108 | + } else { |
|
109 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
110 | + } |
|
90 | 111 | |
91 | 112 | include('table-output.php'); |
92 | 113 | print '<div class="pagination">'; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $limit_start = 0; |
29 | 29 | $limit_end = 25; |
30 | 30 | $absolute_difference = 25; |
31 | -} else { |
|
31 | +} else { |
|
32 | 32 | $limit_explode = explode(",", $_GET['limit']); |
33 | 33 | $limit_start = $limit_explode[0]; |
34 | 34 | $limit_end = $limit_explode[1]; |
@@ -47,9 +47,13 @@ discard block |
||
47 | 47 | print '<h1>'._("Latest Activity").'</h1>'; |
48 | 48 | print '</div>'; |
49 | 49 | print '<div class="table column">'; |
50 | -if ($type == 'marine') print '<p>'._("The table below shows the detailed information of all recent vessels.").'</p>'; |
|
51 | -elseif ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>'; |
|
52 | -else print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>'; |
|
50 | +if ($type == 'marine') { |
|
51 | + print '<p>'._("The table below shows the detailed information of all recent vessels.").'</p>'; |
|
52 | +} elseif ($type == 'tracker') { |
|
53 | + print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>'; |
|
54 | +} else { |
|
55 | + print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>'; |
|
56 | +} |
|
53 | 57 | |
54 | 58 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
55 | 59 | $sql_begin = microtime(true); |
@@ -7,7 +7,9 @@ discard block |
||
7 | 7 | $showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop'); |
8 | 8 | $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
9 | 9 | |
10 | -if (!isset($type)) $type = 'aircraft'; |
|
10 | +if (!isset($type)) { |
|
11 | + $type = 'aircraft'; |
|
12 | +} |
|
11 | 13 | |
12 | 14 | if (!isset($_GET['sort'])) |
13 | 15 | { |
@@ -440,7 +442,9 @@ discard block |
||
440 | 442 | if (isset($globalTimezone)) |
441 | 443 | { |
442 | 444 | date_default_timezone_set($globalTimezone); |
443 | - } else date_default_timezone_set('UTC'); |
|
445 | + } else { |
|
446 | + date_default_timezone_set('UTC'); |
|
447 | + } |
|
444 | 448 | if ($showSpecial === true) |
445 | 449 | { |
446 | 450 | print '<tr class="special">'."\n"; |
@@ -455,7 +459,9 @@ discard block |
||
455 | 459 | print '<tr class="active">'; |
456 | 460 | } elseif (isset($spotter_item['spotted_registration'])) { |
457 | 461 | print '<tr class="info">'; |
458 | - } else print '<tr>'; |
|
462 | + } else { |
|
463 | + print '<tr>'; |
|
464 | + } |
|
459 | 465 | } |
460 | 466 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive" || strtolower($current_page) == "currently" || strtolower($current_page) == "accident-latest" || strtolower($current_page) == "incident-latest" || strtolower($current_page) == "accident-detailed" || strtolower($current_page) == "incident-detailed") { |
461 | 467 | if ($type == 'aircraft') { |
@@ -463,8 +469,9 @@ discard block |
||
463 | 469 | { |
464 | 470 | print '<td class="aircraft_thumbnail">'."\n"; |
465 | 471 | if ($spotter_item['image_source'] == 'planespotters') { |
466 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
467 | - else { |
|
472 | + if ($spotter_item['image_source_website'] != '') { |
|
473 | + $image_src = $spotter_item['image_source_website']; |
|
474 | + } else { |
|
468 | 475 | $planespotter_url_array = explode("_", $spotter_item['image']); |
469 | 476 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
470 | 477 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -477,7 +484,9 @@ discard block |
||
477 | 484 | } else { |
478 | 485 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
479 | 486 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
480 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
487 | + } else { |
|
488 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
489 | + } |
|
481 | 490 | if (isset($spotter_item['airline_name'])) { |
482 | 491 | 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>'; |
483 | 492 | } else { |
@@ -496,7 +505,9 @@ discard block |
||
496 | 505 | print '<td class="aircraft_thumbnail">'."\n"; |
497 | 506 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
498 | 507 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
499 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
508 | + } else { |
|
509 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
510 | + } |
|
500 | 511 | if (isset($spotter_item['airline_name'])) { |
501 | 512 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
502 | 513 | } else { |
@@ -514,7 +525,9 @@ discard block |
||
514 | 525 | print '<td class="aircraft_thumbnail">'."\n"; |
515 | 526 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
516 | 527 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
517 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
528 | + } else { |
|
529 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
530 | + } |
|
518 | 531 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
519 | 532 | print '</td>'."\n"; |
520 | 533 | } else { |
@@ -565,8 +578,9 @@ discard block |
||
565 | 578 | print '<td class="aircraft_thumbnail">'."\n"; |
566 | 579 | //print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
567 | 580 | if ($spotter_item['image_source'] == 'planespotters') { |
568 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
569 | - else { |
|
581 | + if ($spotter_item['image_source_website'] != '') { |
|
582 | + $image_src = $spotter_item['image_source_website']; |
|
583 | + } else { |
|
570 | 584 | $planespotter_url_array = explode("_", $spotter_array[0]['image']); |
571 | 585 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
572 | 586 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -583,7 +597,9 @@ discard block |
||
583 | 597 | } else { |
584 | 598 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
585 | 599 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
586 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
600 | + } else { |
|
601 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
602 | + } |
|
587 | 603 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
588 | 604 | 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>'; |
589 | 605 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
@@ -616,7 +632,9 @@ discard block |
||
616 | 632 | print '<td class="aircraft_thumbnail">'."\n"; |
617 | 633 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
618 | 634 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
619 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
635 | + } else { |
|
636 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
637 | + } |
|
620 | 638 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
621 | 639 | print '</td>'."\n"; |
622 | 640 | } else { |
@@ -630,7 +648,9 @@ discard block |
||
630 | 648 | print '<td class="aircraft_thumbnail">'."\n"; |
631 | 649 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
632 | 650 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
633 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
651 | + } else { |
|
652 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
653 | + } |
|
634 | 654 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
635 | 655 | print '</td>'."\n"; |
636 | 656 | } else { |
@@ -783,15 +803,21 @@ discard block |
||
783 | 803 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
784 | 804 | if ($spotter_item['departure_airport_time'] > 2460) { |
785 | 805 | $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
786 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
806 | + } else { |
|
807 | + $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
808 | + } |
|
787 | 809 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
788 | 810 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
789 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
811 | + } else { |
|
812 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
813 | + } |
|
790 | 814 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
791 | 815 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
792 | 816 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
793 | 817 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
794 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
818 | + } else { |
|
819 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
820 | + } |
|
795 | 821 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
796 | 822 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
797 | 823 | if ($spotter_item['departure_airport_time'] > 2460) { |
@@ -813,7 +839,9 @@ discard block |
||
813 | 839 | $longitude = $spotter_item['longitude']; |
814 | 840 | } |
815 | 841 | $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
816 | - } else $distance = ''; |
|
842 | + } else { |
|
843 | + $distance = ''; |
|
844 | + } |
|
817 | 845 | if ($distance != '') { |
818 | 846 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
819 | 847 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -840,7 +868,9 @@ discard block |
||
840 | 868 | } else { |
841 | 869 | if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) { |
842 | 870 | print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n"; |
843 | - if (!isset($Spotter)) $Spotter = new Spotter(); |
|
871 | + if (!isset($Spotter)) { |
|
872 | + $Spotter = new Spotter(); |
|
873 | + } |
|
844 | 874 | $arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']); |
845 | 875 | print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n"; |
846 | 876 | print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n"; |
@@ -856,20 +886,28 @@ discard block |
||
856 | 886 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
857 | 887 | if ($spotter_item['arrival_airport_time'] > 2460) { |
858 | 888 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
859 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
889 | + } else { |
|
890 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
891 | + } |
|
860 | 892 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
861 | 893 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
862 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
894 | + } else { |
|
895 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
896 | + } |
|
863 | 897 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
864 | 898 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
865 | 899 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
866 | 900 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
867 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
901 | + } else { |
|
902 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
903 | + } |
|
868 | 904 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
869 | 905 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
870 | 906 | if ($spotter_item['arrival_airport_time'] > 2460) { |
871 | 907 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
872 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
908 | + } else { |
|
909 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
910 | + } |
|
873 | 911 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
874 | 912 | } |
875 | 913 | if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
@@ -882,7 +920,9 @@ discard block |
||
882 | 920 | $longitude = $spotter_item['longitude']; |
883 | 921 | } |
884 | 922 | $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
885 | - } else $distance = ''; |
|
923 | + } else { |
|
924 | + $distance = ''; |
|
925 | + } |
|
886 | 926 | if ($distance != '') { |
887 | 927 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
888 | 928 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -7,9 +7,13 @@ discard block |
||
7 | 7 | //echo $buffer."\n"; |
8 | 8 | $data = array(); |
9 | 9 | $typehex = substr($buffer,0,1); |
10 | - if ($typehex == '*' || $typehex == ':') $hex = substr($buffer,1,-1); |
|
11 | - elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer,13,-13); |
|
12 | - else $hex = substr($buffer,1,-1); |
|
10 | + if ($typehex == '*' || $typehex == ':') { |
|
11 | + $hex = substr($buffer,1,-1); |
|
12 | + } elseif ($typehex == '@' || $typehex == '%') { |
|
13 | + $hex = substr($buffer,13,-13); |
|
14 | + } else { |
|
15 | + $hex = substr($buffer,1,-1); |
|
16 | + } |
|
13 | 17 | $bin = gmp_strval( gmp_init($hex,16), 2); |
14 | 18 | //if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) { |
15 | 19 | if (strlen($hex) == 28) { |
@@ -52,8 +56,9 @@ discard block |
||
52 | 56 | // 131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits. |
53 | 57 | $cprlat = intval(substr($bin,54,17),2)/131072.0; |
54 | 58 | $cprlon = intval(substr($bin,71,17),2)/131072.0; |
55 | - if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time()); |
|
56 | - elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) { |
|
59 | + if ($oe == 0) { |
|
60 | + $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time()); |
|
61 | + } elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) { |
|
57 | 62 | $cprlat_odd = $cprlat; |
58 | 63 | $cprlon_odd = $cprlon; |
59 | 64 | $cprlat_even = $this::$latlon[$icao]['latitude']; |
@@ -62,8 +67,12 @@ discard block |
||
62 | 67 | $j = 59*$cprlat_even-60*$cprlat_odd+0.5; |
63 | 68 | $lat_even = (360.0/60)*($j%60+$cprlat_even); |
64 | 69 | $lat_odd = (360.0/59)*($j%59+$cprlat_odd); |
65 | - if ($lat_even >= 270) $lat_even = $lat_even - 360; |
|
66 | - if ($lat_odd >= 270) $lat_odd = $lat_odd - 360; |
|
70 | + if ($lat_even >= 270) { |
|
71 | + $lat_even = $lat_even - 360; |
|
72 | + } |
|
73 | + if ($lat_odd >= 270) { |
|
74 | + $lat_odd = $lat_odd - 360; |
|
75 | + } |
|
67 | 76 | // check latitude zone |
68 | 77 | if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) { |
69 | 78 | if ($this::$latlon[$icao]['created'] > time()) { |
@@ -71,7 +80,9 @@ discard block |
||
71 | 80 | $m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5); |
72 | 81 | $lon = (360.0/$ni)*($m%$ni+$cprlon_even); |
73 | 82 | $lat = $lat_even; |
74 | - if ($lon > 180) $lon = $lon -360; |
|
83 | + if ($lon > 180) { |
|
84 | + $lon = $lon -360; |
|
85 | + } |
|
75 | 86 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
76 | 87 | //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon; |
77 | 88 | $data['latitude'] = $lat; |
@@ -82,14 +93,18 @@ discard block |
||
82 | 93 | $m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5); |
83 | 94 | $lon = (360.0/$ni)*($m%$ni+$cprlon_odd); |
84 | 95 | $lat = $lat_odd; |
85 | - if ($lon > 180) $lon = $lon -360; |
|
96 | + if ($lon > 180) { |
|
97 | + $lon = $lon -360; |
|
98 | + } |
|
86 | 99 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
87 | 100 | //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n"; |
88 | 101 | $data['latitude'] = $lat; |
89 | 102 | $data['longitude'] = $lon; |
90 | 103 | } |
91 | 104 | } |
92 | - } else echo "Not cprNL"; |
|
105 | + } else { |
|
106 | + echo "Not cprNL"; |
|
107 | + } |
|
93 | 108 | unset($this::$latlon[$icao]); |
94 | 109 | } |
95 | 110 | } elseif ($tc == 19) { |
@@ -98,11 +113,17 @@ discard block |
||
98 | 113 | $v_ew = intval(substr($bin,46,10),2); |
99 | 114 | $v_ns_dir = intval(substr($bin,56,1)); |
100 | 115 | $v_ns = intval(substr($bin,57,10),2); |
101 | - if ($v_ew_dir) $v_ew = -1*$v_ew; |
|
102 | - if ($v_ns_dir) $v_ns = -1*$v_ns; |
|
116 | + if ($v_ew_dir) { |
|
117 | + $v_ew = -1*$v_ew; |
|
118 | + } |
|
119 | + if ($v_ns_dir) { |
|
120 | + $v_ns = -1*$v_ns; |
|
121 | + } |
|
103 | 122 | $speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew); |
104 | 123 | $heading = atan2($v_ew,$v_ns)*360.0/(2*pi()); |
105 | - if ($heading <0) $heading = $heading+360; |
|
124 | + if ($heading <0) { |
|
125 | + $heading = $heading+360; |
|
126 | + } |
|
106 | 127 | $data['speed'] = $speed; |
107 | 128 | $data['heading'] = $heading; |
108 | 129 | } |
@@ -117,72 +138,194 @@ discard block |
||
117 | 138 | |
118 | 139 | public function cprNL($lat) { |
119 | 140 | //Lookup table to convert the latitude to index. |
120 | - if ($lat < 0) $lat = -$lat; // Table is simmetric about the equator. |
|
121 | - if ($lat < 10.47047130) return 59; |
|
122 | - if ($lat < 14.82817437) return 58; |
|
123 | - if ($lat < 18.18626357) return 57; |
|
124 | - if ($lat < 21.02939493) return 56; |
|
125 | - if ($lat < 23.54504487) return 55; |
|
126 | - if ($lat < 25.82924707) return 54; |
|
127 | - if ($lat < 27.93898710) return 53; |
|
128 | - if ($lat < 29.91135686) return 52; |
|
129 | - if ($lat < 31.77209708) return 51; |
|
130 | - if ($lat < 33.53993436) return 50; |
|
131 | - if ($lat < 35.22899598) return 49; |
|
132 | - if ($lat < 36.85025108) return 48; |
|
133 | - if ($lat < 38.41241892) return 47; |
|
134 | - if ($lat < 39.92256684) return 46; |
|
135 | - if ($lat < 41.38651832) return 45; |
|
136 | - if ($lat < 42.80914012) return 44; |
|
137 | - if ($lat < 44.19454951) return 43; |
|
138 | - if ($lat < 45.54626723) return 42; |
|
139 | - if ($lat < 46.86733252) return 41; |
|
140 | - if ($lat < 48.16039128) return 40; |
|
141 | - if ($lat < 49.42776439) return 39; |
|
142 | - if ($lat < 50.67150166) return 38; |
|
143 | - if ($lat < 51.89342469) return 37; |
|
144 | - if ($lat < 53.09516153) return 36; |
|
145 | - if ($lat < 54.27817472) return 35; |
|
146 | - if ($lat < 55.44378444) return 34; |
|
147 | - if ($lat < 56.59318756) return 33; |
|
148 | - if ($lat < 57.72747354) return 32; |
|
149 | - if ($lat < 58.84763776) return 31; |
|
150 | - if ($lat < 59.95459277) return 30; |
|
151 | - if ($lat < 61.04917774) return 29; |
|
152 | - if ($lat < 62.13216659) return 28; |
|
153 | - if ($lat < 63.20427479) return 27; |
|
154 | - if ($lat < 64.26616523) return 26; |
|
155 | - if ($lat < 65.31845310) return 25; |
|
156 | - if ($lat < 66.36171008) return 24; |
|
157 | - if ($lat < 67.39646774) return 23; |
|
158 | - if ($lat < 68.42322022) return 22; |
|
159 | - if ($lat < 69.44242631) return 21; |
|
160 | - if ($lat < 70.45451075) return 20; |
|
161 | - if ($lat < 71.45986473) return 19; |
|
162 | - if ($lat < 72.45884545) return 18; |
|
163 | - if ($lat < 73.45177442) return 17; |
|
164 | - if ($lat < 74.43893416) return 16; |
|
165 | - if ($lat < 75.42056257) return 15; |
|
166 | - if ($lat < 76.39684391) return 14; |
|
167 | - if ($lat < 77.36789461) return 13; |
|
168 | - if ($lat < 78.33374083) return 12; |
|
169 | - if ($lat < 79.29428225) return 11; |
|
170 | - if ($lat < 80.24923213) return 10; |
|
171 | - if ($lat < 81.19801349) return 9; |
|
172 | - if ($lat < 82.13956981) return 8; |
|
173 | - if ($lat < 83.07199445) return 7; |
|
174 | - if ($lat < 83.99173563) return 6; |
|
175 | - if ($lat < 84.89166191) return 5; |
|
176 | - if ($lat < 85.75541621) return 4; |
|
177 | - if ($lat < 86.53536998) return 3; |
|
178 | - if ($lat < 87.00000000) return 2; |
|
141 | + if ($lat < 0) { |
|
142 | + $lat = -$lat; |
|
143 | + } |
|
144 | + // Table is simmetric about the equator. |
|
145 | + if ($lat < 10.47047130) { |
|
146 | + return 59; |
|
147 | + } |
|
148 | + if ($lat < 14.82817437) { |
|
149 | + return 58; |
|
150 | + } |
|
151 | + if ($lat < 18.18626357) { |
|
152 | + return 57; |
|
153 | + } |
|
154 | + if ($lat < 21.02939493) { |
|
155 | + return 56; |
|
156 | + } |
|
157 | + if ($lat < 23.54504487) { |
|
158 | + return 55; |
|
159 | + } |
|
160 | + if ($lat < 25.82924707) { |
|
161 | + return 54; |
|
162 | + } |
|
163 | + if ($lat < 27.93898710) { |
|
164 | + return 53; |
|
165 | + } |
|
166 | + if ($lat < 29.91135686) { |
|
167 | + return 52; |
|
168 | + } |
|
169 | + if ($lat < 31.77209708) { |
|
170 | + return 51; |
|
171 | + } |
|
172 | + if ($lat < 33.53993436) { |
|
173 | + return 50; |
|
174 | + } |
|
175 | + if ($lat < 35.22899598) { |
|
176 | + return 49; |
|
177 | + } |
|
178 | + if ($lat < 36.85025108) { |
|
179 | + return 48; |
|
180 | + } |
|
181 | + if ($lat < 38.41241892) { |
|
182 | + return 47; |
|
183 | + } |
|
184 | + if ($lat < 39.92256684) { |
|
185 | + return 46; |
|
186 | + } |
|
187 | + if ($lat < 41.38651832) { |
|
188 | + return 45; |
|
189 | + } |
|
190 | + if ($lat < 42.80914012) { |
|
191 | + return 44; |
|
192 | + } |
|
193 | + if ($lat < 44.19454951) { |
|
194 | + return 43; |
|
195 | + } |
|
196 | + if ($lat < 45.54626723) { |
|
197 | + return 42; |
|
198 | + } |
|
199 | + if ($lat < 46.86733252) { |
|
200 | + return 41; |
|
201 | + } |
|
202 | + if ($lat < 48.16039128) { |
|
203 | + return 40; |
|
204 | + } |
|
205 | + if ($lat < 49.42776439) { |
|
206 | + return 39; |
|
207 | + } |
|
208 | + if ($lat < 50.67150166) { |
|
209 | + return 38; |
|
210 | + } |
|
211 | + if ($lat < 51.89342469) { |
|
212 | + return 37; |
|
213 | + } |
|
214 | + if ($lat < 53.09516153) { |
|
215 | + return 36; |
|
216 | + } |
|
217 | + if ($lat < 54.27817472) { |
|
218 | + return 35; |
|
219 | + } |
|
220 | + if ($lat < 55.44378444) { |
|
221 | + return 34; |
|
222 | + } |
|
223 | + if ($lat < 56.59318756) { |
|
224 | + return 33; |
|
225 | + } |
|
226 | + if ($lat < 57.72747354) { |
|
227 | + return 32; |
|
228 | + } |
|
229 | + if ($lat < 58.84763776) { |
|
230 | + return 31; |
|
231 | + } |
|
232 | + if ($lat < 59.95459277) { |
|
233 | + return 30; |
|
234 | + } |
|
235 | + if ($lat < 61.04917774) { |
|
236 | + return 29; |
|
237 | + } |
|
238 | + if ($lat < 62.13216659) { |
|
239 | + return 28; |
|
240 | + } |
|
241 | + if ($lat < 63.20427479) { |
|
242 | + return 27; |
|
243 | + } |
|
244 | + if ($lat < 64.26616523) { |
|
245 | + return 26; |
|
246 | + } |
|
247 | + if ($lat < 65.31845310) { |
|
248 | + return 25; |
|
249 | + } |
|
250 | + if ($lat < 66.36171008) { |
|
251 | + return 24; |
|
252 | + } |
|
253 | + if ($lat < 67.39646774) { |
|
254 | + return 23; |
|
255 | + } |
|
256 | + if ($lat < 68.42322022) { |
|
257 | + return 22; |
|
258 | + } |
|
259 | + if ($lat < 69.44242631) { |
|
260 | + return 21; |
|
261 | + } |
|
262 | + if ($lat < 70.45451075) { |
|
263 | + return 20; |
|
264 | + } |
|
265 | + if ($lat < 71.45986473) { |
|
266 | + return 19; |
|
267 | + } |
|
268 | + if ($lat < 72.45884545) { |
|
269 | + return 18; |
|
270 | + } |
|
271 | + if ($lat < 73.45177442) { |
|
272 | + return 17; |
|
273 | + } |
|
274 | + if ($lat < 74.43893416) { |
|
275 | + return 16; |
|
276 | + } |
|
277 | + if ($lat < 75.42056257) { |
|
278 | + return 15; |
|
279 | + } |
|
280 | + if ($lat < 76.39684391) { |
|
281 | + return 14; |
|
282 | + } |
|
283 | + if ($lat < 77.36789461) { |
|
284 | + return 13; |
|
285 | + } |
|
286 | + if ($lat < 78.33374083) { |
|
287 | + return 12; |
|
288 | + } |
|
289 | + if ($lat < 79.29428225) { |
|
290 | + return 11; |
|
291 | + } |
|
292 | + if ($lat < 80.24923213) { |
|
293 | + return 10; |
|
294 | + } |
|
295 | + if ($lat < 81.19801349) { |
|
296 | + return 9; |
|
297 | + } |
|
298 | + if ($lat < 82.13956981) { |
|
299 | + return 8; |
|
300 | + } |
|
301 | + if ($lat < 83.07199445) { |
|
302 | + return 7; |
|
303 | + } |
|
304 | + if ($lat < 83.99173563) { |
|
305 | + return 6; |
|
306 | + } |
|
307 | + if ($lat < 84.89166191) { |
|
308 | + return 5; |
|
309 | + } |
|
310 | + if ($lat < 85.75541621) { |
|
311 | + return 4; |
|
312 | + } |
|
313 | + if ($lat < 86.53536998) { |
|
314 | + return 3; |
|
315 | + } |
|
316 | + if ($lat < 87.00000000) { |
|
317 | + return 2; |
|
318 | + } |
|
179 | 319 | return 1; |
180 | 320 | } |
181 | 321 | |
182 | 322 | public function cprN($lat,$isodd) { |
183 | 323 | $nl = $this->cprNL($lat) - $isodd; |
184 | - if ($nl > 1) return $nl; |
|
185 | - else return 1; |
|
324 | + if ($nl > 1) { |
|
325 | + return $nl; |
|
326 | + } else { |
|
327 | + return 1; |
|
328 | + } |
|
186 | 329 | } |
187 | 330 | |
188 | 331 | |
@@ -208,10 +351,13 @@ discard block |
||
208 | 351 | $checksum = intval(substr($msg,22,6),16); |
209 | 352 | |
210 | 353 | for ($j = 0; $j < strlen($bin); $j++) { |
211 | - if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0); |
|
354 | + if ($bin[$j]) { |
|
355 | + $crc = $crc^intval($modes_checksum_table[$j],0); |
|
356 | + } |
|
212 | 357 | } |
213 | - if ($crc == $checksum) return true; |
|
214 | - else { |
|
358 | + if ($crc == $checksum) { |
|
359 | + return true; |
|
360 | + } else { |
|
215 | 361 | //echo "**** CRC ERROR ****\n"; |
216 | 362 | return false; |
217 | 363 | } |
@@ -258,22 +404,37 @@ discard block |
||
258 | 404 | $msg['date_log'] = date('Y/m/d',$data['timestamp']); |
259 | 405 | $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180'; |
260 | 406 | $msg['callsign'] = ''; |
261 | - if (isset($data['altitude'])) $msg['altitude'] = $data['altitude']; |
|
262 | - else $msg['altitude'] = ''; |
|
407 | + if (isset($data['altitude'])) { |
|
408 | + $msg['altitude'] = $data['altitude']; |
|
409 | + } else { |
|
410 | + $msg['altitude'] = ''; |
|
411 | + } |
|
263 | 412 | $msg['speed'] = $data['speed']; |
264 | - if (isset($data['heading'])) $msg['track'] = $data['heading']; |
|
265 | - else $msg['track'] = ''; |
|
413 | + if (isset($data['heading'])) { |
|
414 | + $msg['track'] = $data['heading']; |
|
415 | + } else { |
|
416 | + $msg['track'] = ''; |
|
417 | + } |
|
266 | 418 | $msg['latitude'] = $data['latitude']; |
267 | 419 | $msg['longitude'] = $data['longitude']; |
268 | - if (isset($data['verticalrate'])) $msg['verticalrate'] = $data['verticalrate']; |
|
269 | - else $msg['verticalrate'] = ''; |
|
270 | - if (isset($data['squawk'])) $msg['squawk'] = $data['squawk']; |
|
271 | - else $msg['squawk'] = 0; |
|
420 | + if (isset($data['verticalrate'])) { |
|
421 | + $msg['verticalrate'] = $data['verticalrate']; |
|
422 | + } else { |
|
423 | + $msg['verticalrate'] = ''; |
|
424 | + } |
|
425 | + if (isset($data['squawk'])) { |
|
426 | + $msg['squawk'] = $data['squawk']; |
|
427 | + } else { |
|
428 | + $msg['squawk'] = 0; |
|
429 | + } |
|
272 | 430 | $msg['alert'] = 0; |
273 | 431 | $msg['emergency'] = 0; |
274 | 432 | $msg['SPI'] = 0; |
275 | - if (isset($data['ground'])) $msg['ground'] = 1; |
|
276 | - else $msg['ground'] = 0; |
|
433 | + if (isset($data['ground'])) { |
|
434 | + $msg['ground'] = 1; |
|
435 | + } else { |
|
436 | + $msg['ground'] = 0; |
|
437 | + } |
|
277 | 438 | $result[] = implode(',',$msg); |
278 | 439 | } |
279 | 440 | return $result; |
@@ -16,11 +16,15 @@ discard block |
||
16 | 16 | $Tracker = new Tracker(); |
17 | 17 | } |
18 | 18 | |
19 | -if (!isset($filter_name)) $filter_name = ''; |
|
19 | +if (!isset($filter_name)) { |
|
20 | + $filter_name = ''; |
|
21 | +} |
|
20 | 22 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
21 | 23 | if ($airline_icao == '' && isset($globalFilter)) { |
22 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
23 | -} |
|
24 | + if (isset($globalFilter['airline'])) { |
|
25 | + $airline_icao = $globalFilter['airline'][0]; |
|
26 | + } |
|
27 | + } |
|
24 | 28 | |
25 | 29 | require_once('header.php'); |
26 | 30 | include('statistics-sub-menu.php'); |
@@ -33,9 +37,13 @@ discard block |
||
33 | 37 | </div> |
34 | 38 | <p>'._("Below is a chart that plots the busiest day during the <strong>last 7 days</strong>.").'</p>'; |
35 | 39 | |
36 | -if ($type == 'aircraft') $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
37 | -elseif ($type == 'marine') $date_array = $Marine->countAllDatesLast7Days(); |
|
38 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllDatesLast7Days(); |
|
40 | +if ($type == 'aircraft') { |
|
41 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
42 | +} elseif ($type == 'marine') { |
|
43 | + $date_array = $Marine->countAllDatesLast7Days(); |
|
44 | +} elseif ($type == 'tracker') { |
|
45 | + $date_array = $Tracker->countAllDatesLast7Days(); |
|
46 | +} |
|
39 | 47 | if (count($date_array) == 0) { |
40 | 48 | print _("No data available"); |
41 | 49 | } else { |
@@ -61,9 +69,13 @@ discard block |
||
61 | 69 | } else { |
62 | 70 | print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>'; |
63 | 71 | } |
64 | -if ($type == 'aircraft') $date_array = $Stats->countAllDates($airline_icao,$filter_name); |
|
65 | -elseif ($type == 'marine') $date_array = $Marine->countAllDates(); |
|
66 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllDates(); |
|
72 | +if ($type == 'aircraft') { |
|
73 | + $date_array = $Stats->countAllDates($airline_icao,$filter_name); |
|
74 | +} elseif ($type == 'marine') { |
|
75 | + $date_array = $Marine->countAllDates(); |
|
76 | +} elseif ($type == 'tracker') { |
|
77 | + $date_array = $Tracker->countAllDates(); |
|
78 | +} |
|
67 | 79 | if (!empty($date_array)) |
68 | 80 | { |
69 | 81 | print '<div class="table-responsive">'; |
@@ -15,11 +15,15 @@ discard block |
||
15 | 15 | require_once('require/class.Tracker.php'); |
16 | 16 | $Tracker = new Tracker(); |
17 | 17 | } |
18 | -if (!isset($filter_name)) $filter_name = ''; |
|
18 | +if (!isset($filter_name)) { |
|
19 | + $filter_name = ''; |
|
20 | +} |
|
19 | 21 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
20 | 22 | if ($airline_icao == '' && isset($globalFilter)) { |
21 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
22 | -} |
|
23 | + if (isset($globalFilter['airline'])) { |
|
24 | + $airline_icao = $globalFilter['airline'][0]; |
|
25 | + } |
|
26 | + } |
|
23 | 27 | |
24 | 28 | require_once('header.php'); |
25 | 29 | include('statistics-sub-menu.php'); |
@@ -32,9 +36,13 @@ discard block |
||
32 | 36 | </div> |
33 | 37 | <p>'._("Below is a chart that plots the busiest day during the <strong>last month</strong>.").'</p>'; |
34 | 38 | |
35 | -if ($type == 'aircraft') $date_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
36 | -elseif ($type == 'marine') $date_array = $Marine->countAllDatesLastMonth(); |
|
37 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllDatesLastMonth(); |
|
39 | +if ($type == 'aircraft') { |
|
40 | + $date_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
41 | +} elseif ($type == 'marine') { |
|
42 | + $date_array = $Marine->countAllDatesLastMonth(); |
|
43 | +} elseif ($type == 'tracker') { |
|
44 | + $date_array = $Tracker->countAllDatesLastMonth(); |
|
45 | +} |
|
38 | 46 | |
39 | 47 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
40 | 48 | $month_data = ''; |
@@ -75,8 +83,11 @@ discard block |
||
75 | 83 | print '<tr>'; |
76 | 84 | print '<td><strong>'.$i.'</strong></td>'; |
77 | 85 | print '<td>'; |
78 | - if ($type == 'aircraft') print '<a href="'.$globalURL.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>'; |
|
79 | - else print '<a href="'.$globalURL.'/'.$type.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>'; |
|
86 | + if ($type == 'aircraft') { |
|
87 | + print '<a href="'.$globalURL.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>'; |
|
88 | + } else { |
|
89 | + print '<a href="'.$globalURL.'/'.$type.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>'; |
|
90 | + } |
|
80 | 91 | print '</td>'; |
81 | 92 | print '<td>'; |
82 | 93 | print $date_item['date_count']; |
@@ -17,11 +17,15 @@ discard block |
||
17 | 17 | $title = _("Statistics").' - '._("Busiest Month of Last Year"); |
18 | 18 | |
19 | 19 | |
20 | -if (!isset($filter_name)) $filter_name = ''; |
|
20 | +if (!isset($filter_name)) { |
|
21 | + $filter_name = ''; |
|
22 | +} |
|
21 | 23 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
22 | 24 | if ($airline_icao == '' && isset($globalFilter)) { |
23 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
24 | -} |
|
25 | + if (isset($globalFilter['airline'])) { |
|
26 | + $airline_icao = $globalFilter['airline'][0]; |
|
27 | + } |
|
28 | + } |
|
25 | 29 | |
26 | 30 | require_once('header.php'); |
27 | 31 | include('statistics-sub-menu.php'); |
@@ -33,9 +37,13 @@ discard block |
||
33 | 37 | </div> |
34 | 38 | <p>'._("Below is a chart that plots the busiest month during the <strong>last year</strong>.").'</p>'; |
35 | 39 | |
36 | -if ($type == 'aircraft') $date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
37 | -elseif ($type == 'marine') $date_array = $Marine->countAllMonthsLastYear(true); |
|
38 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllMonthsLastYear(true); |
|
40 | +if ($type == 'aircraft') { |
|
41 | + $date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
42 | +} elseif ($type == 'marine') { |
|
43 | + $date_array = $Marine->countAllMonthsLastYear(true); |
|
44 | +} elseif ($type == 'tracker') { |
|
45 | + $date_array = $Tracker->countAllMonthsLastYear(true); |
|
46 | +} |
|
39 | 47 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
40 | 48 | $year_data = ''; |
41 | 49 | $year_cnt = ''; |
@@ -53,9 +61,13 @@ discard block |
||
53 | 61 | axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m"}}, y: { label: "#"}},legend: { show: false }});'; |
54 | 62 | print '</script>'; |
55 | 63 | |
56 | -if ($type == 'aircraft') $date_array = $Stats->countAllMonths($airline_icao); |
|
57 | -elseif ($type == 'marine') $date_array = $Marine->countAllMonths(); |
|
58 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllMonths(); |
|
64 | +if ($type == 'aircraft') { |
|
65 | + $date_array = $Stats->countAllMonths($airline_icao); |
|
66 | +} elseif ($type == 'marine') { |
|
67 | + $date_array = $Marine->countAllMonths(); |
|
68 | +} elseif ($type == 'tracker') { |
|
69 | + $date_array = $Tracker->countAllMonths(); |
|
70 | +} |
|
59 | 71 | |
60 | 72 | if (!empty($date_array)) |
61 | 73 | { |
@@ -16,11 +16,15 @@ discard block |
||
16 | 16 | $Tracker = new Tracker(); |
17 | 17 | } |
18 | 18 | |
19 | -if (!isset($filter_name)) $filter_name = ''; |
|
19 | +if (!isset($filter_name)) { |
|
20 | + $filter_name = ''; |
|
21 | +} |
|
20 | 22 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
21 | 23 | if ($airline_icao == '' && isset($globalFilter)) { |
22 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
23 | -} |
|
24 | + if (isset($globalFilter['airline'])) { |
|
25 | + $airline_icao = $globalFilter['airline'][0]; |
|
26 | + } |
|
27 | + } |
|
24 | 28 | |
25 | 29 | require_once('header.php'); |
26 | 30 | include('statistics-sub-menu.php'); |
@@ -33,9 +37,13 @@ discard block |
||
33 | 37 | </div> |
34 | 38 | <p>'._("Below is a list of the most common <strong>time of day</strong>.").'</p>'; |
35 | 39 | |
36 | -if ($type == 'aircraft') $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
37 | -elseif ($type == 'marine') $hour_array = $Marine->countAllHours('hour',true); |
|
38 | -elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('hour',true); |
|
40 | +if ($type == 'aircraft') { |
|
41 | + $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
42 | +} elseif ($type == 'marine') { |
|
43 | + $hour_array = $Marine->countAllHours('hour',true); |
|
44 | +} elseif ($type == 'tracker') { |
|
45 | + $hour_array = $Tracker->countAllHours('hour',true); |
|
46 | +} |
|
39 | 47 | print '<div id="chartHour" class="chart" width="100%"></div><script>'; |
40 | 48 | $hour_data = ''; |
41 | 49 | $hour_cnt = ''; |
@@ -53,9 +61,13 @@ discard block |
||
53 | 61 | axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Flights"}},legend: { show: false }});'; |
54 | 62 | print '</script>'; |
55 | 63 | |
56 | -if ($type == 'aircraft') $hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name); |
|
57 | -elseif ($type == 'marine') $hour_array = $Marine->countAllHours('count',true); |
|
58 | -elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('count',true); |
|
64 | +if ($type == 'aircraft') { |
|
65 | + $hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name); |
|
66 | +} elseif ($type == 'marine') { |
|
67 | + $hour_array = $Marine->countAllHours('count',true); |
|
68 | +} elseif ($type == 'tracker') { |
|
69 | + $hour_array = $Tracker->countAllHours('count',true); |
|
70 | +} |
|
59 | 71 | if (!empty($hour_array)) |
60 | 72 | { |
61 | 73 | print '<div class="table-responsive">'; |
@@ -5,11 +5,15 @@ discard block |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft"); |
7 | 7 | |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | -} |
|
13 | + if (isset($globalFilter['airline'])) { |
|
14 | + $airline_icao = $globalFilter['airline'][0]; |
|
15 | + } |
|
16 | + } |
|
13 | 17 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
14 | 18 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
15 | 19 | |
@@ -28,9 +32,12 @@ discard block |
||
28 | 32 | $aircraft_data = ''; |
29 | 33 | foreach($aircraft_array as $aircraft_item) |
30 | 34 | { |
31 | - if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
32 | - else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
33 | -} |
|
35 | + if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') { |
|
36 | + $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
37 | + } else { |
|
38 | + $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
39 | + } |
|
40 | + } |
|
34 | 41 | $aircraft_data = substr($aircraft_data, 0, -1); |
35 | 42 | print 'var series = ['.$aircraft_data.'];'; |
36 | 43 | print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |