@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | $beginpage = microtime(true); |
7 | 7 | $Stats = new Stats(); |
8 | 8 | |
9 | -if (!isset($filter_name)) $filter_name = ''; |
|
9 | +if (!isset($filter_name)) { |
|
10 | + $filter_name = ''; |
|
11 | +} |
|
10 | 12 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
11 | 13 | if ($airline_icao == 'all') { |
12 | 14 | unset($_COOKIE['stats_airline_icao']); |
@@ -15,8 +17,10 @@ discard block |
||
15 | 17 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
16 | 18 | $airline_icao = $_COOKIE['stats_airline_icao']; |
17 | 19 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
18 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
19 | -} |
|
20 | + if (isset($globalFilter['airline'])) { |
|
21 | + $airline_icao = $globalFilter['airline'][0]; |
|
22 | + } |
|
23 | + } |
|
20 | 24 | if ($airline_icao != '' && $airline_icao != 'all') { |
21 | 25 | $Spotter = new Spotter(); |
22 | 26 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
@@ -43,14 +47,21 @@ discard block |
||
43 | 47 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/justgage.js"></script> |
44 | 48 | <div class="column"> |
45 | 49 | <div class="info"> |
46 | - <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1> |
|
50 | + <h1><?php if (isset($airline_name)) { |
|
51 | + echo _("Statistics for ").$airline_name; |
|
52 | +} else { |
|
53 | + echo _("Statistics"); |
|
54 | +} |
|
55 | +?></h1> |
|
47 | 56 | <?php |
48 | 57 | $last_update = $Stats->getLastStatsUpdate(); |
49 | 58 | //if (isset($last_update[0]['value'])) print '<!-- Last update : '.$last_update[0]['value'].' -->'; |
50 | 59 | if (isset($last_update[0]['value'])) { |
51 | 60 | date_default_timezone_set('UTC'); |
52 | 61 | $lastupdate = strtotime($last_update[0]['value']); |
53 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
62 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
63 | + date_default_timezone_set($globalTimezone); |
|
64 | + } |
|
54 | 65 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
55 | 66 | } |
56 | 67 | ?> |
@@ -102,8 +113,9 @@ discard block |
||
102 | 113 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
103 | 114 | <?php |
104 | 115 | $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
105 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
106 | - else { |
|
116 | + if (count($aircraft_array) == 0) { |
|
117 | + print _("No data available"); |
|
118 | + } else { |
|
107 | 119 | |
108 | 120 | print '<div id="chart1" class="chart" width="100%"></div> |
109 | 121 | <script> |
@@ -213,8 +225,9 @@ discard block |
||
213 | 225 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
214 | 226 | <?php |
215 | 227 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
216 | - if (count($pilot_array) == 0) print _("No data available"); |
|
217 | - else { |
|
228 | + if (count($pilot_array) == 0) { |
|
229 | + print _("No data available"); |
|
230 | + } else { |
|
218 | 231 | print '<div id="chart7" class="chart" width="100%"></div> |
219 | 232 | <script> |
220 | 233 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -259,8 +272,9 @@ discard block |
||
259 | 272 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
260 | 273 | <?php |
261 | 274 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
262 | - if (count($owner_array) == 0) print _("No data available"); |
|
263 | - else { |
|
275 | + if (count($owner_array) == 0) { |
|
276 | + print _("No data available"); |
|
277 | + } else { |
|
264 | 278 | print '<div id="chart7" class="chart" width="100%"></div> |
265 | 279 | <script> |
266 | 280 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -306,8 +320,9 @@ discard block |
||
306 | 320 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
307 | 321 | <?php |
308 | 322 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
309 | - if (count($flightover_array) == 0) print _("No data available"); |
|
310 | - else { |
|
323 | + if (count($flightover_array) == 0) { |
|
324 | + print _("No data available"); |
|
325 | + } else { |
|
311 | 326 | print '<div id="chart10" class="chart" width="100%"></div> |
312 | 327 | <script> |
313 | 328 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -453,8 +468,9 @@ discard block |
||
453 | 468 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
454 | 469 | <?php |
455 | 470 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
456 | - if (count($year_array) == 0) print _("No data available"); |
|
457 | - else { |
|
471 | + if (count($year_array) == 0) { |
|
472 | + print _("No data available"); |
|
473 | + } else { |
|
458 | 474 | print '<div id="chart8" class="chart" width="100%"></div> |
459 | 475 | <script> |
460 | 476 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -498,8 +514,9 @@ discard block |
||
498 | 514 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
499 | 515 | <?php |
500 | 516 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
501 | - if (count($month_array) == 0) print _("No data available"); |
|
502 | - else { |
|
517 | + if (count($month_array) == 0) { |
|
518 | + print _("No data available"); |
|
519 | + } else { |
|
503 | 520 | print '<div id="chart9" class="chart" width="100%"></div> |
504 | 521 | <script> |
505 | 522 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -544,8 +561,9 @@ discard block |
||
544 | 561 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
545 | 562 | <?php |
546 | 563 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
547 | - if (empty($date_array)) print _("No data available"); |
|
548 | - else { |
|
564 | + if (empty($date_array)) { |
|
565 | + print _("No data available"); |
|
566 | + } else { |
|
549 | 567 | print '<div id="chart5" class="chart" width="100%"></div> |
550 | 568 | <script> |
551 | 569 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -590,8 +608,9 @@ discard block |
||
590 | 608 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
591 | 609 | <?php |
592 | 610 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
593 | - if (empty($hour_array)) print _("No data available"); |
|
594 | - else { |
|
611 | + if (empty($hour_array)) { |
|
612 | + print _("No data available"); |
|
613 | + } else { |
|
595 | 614 | |
596 | 615 | print '<div id="chart6" class="chart" width="100%"></div> |
597 | 616 | <script> |
@@ -647,8 +666,9 @@ discard block |
||
647 | 666 | require_once('require/class.Accident.php'); |
648 | 667 | $Accident = new Accident(); |
649 | 668 | $year_array = $Accident->countFatalitiesByYear($filter_name); |
650 | - if (count($year_array) == 0) print _("No data available"); |
|
651 | - else { |
|
669 | + if (count($year_array) == 0) { |
|
670 | + print _("No data available"); |
|
671 | + } else { |
|
652 | 672 | print '<div id="chart32" class="chart" width="100%"></div> |
653 | 673 | <script> |
654 | 674 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -696,8 +716,9 @@ discard block |
||
696 | 716 | require_once('require/class.Accident.php'); |
697 | 717 | $Accident = new Accident(); |
698 | 718 | $year_array = $Accident->countFatalitiesLast12Months($filter_name); |
699 | - if (count($year_array) == 0) print _("No data available"); |
|
700 | - else { |
|
719 | + if (count($year_array) == 0) { |
|
720 | + print _("No data available"); |
|
721 | + } else { |
|
701 | 722 | print '<div id="chart33" class="chart" width="100%"></div> |
702 | 723 | <script> |
703 | 724 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -773,8 +794,11 @@ discard block |
||
773 | 794 | $distance = $distance; |
774 | 795 | $unit = 'km'; |
775 | 796 | } |
776 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
777 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
797 | + if (!isset($polar_data)) { |
|
798 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
799 | + } else { |
|
800 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
801 | + } |
|
778 | 802 | } |
779 | 803 | ?> |
780 | 804 | <div class="col-md-6"> |
@@ -826,8 +850,11 @@ discard block |
||
826 | 850 | foreach ($msg as $eachmsg) { |
827 | 851 | //$eachmsg = $msg[0]; |
828 | 852 | $data = $eachmsg['source_data']; |
829 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
830 | - else $max = 500; |
|
853 | + if ($data > 500) { |
|
854 | + $max = (round(($data+100)/100))*100; |
|
855 | + } else { |
|
856 | + $max = 500; |
|
857 | + } |
|
831 | 858 | ?> |
832 | 859 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
833 | 860 | <script> |