@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | $Stats = new Stats(); |
7 | 7 | $title = _("Statistics"); |
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 | setcookie('stats_airline_icao',$airline_icao); |
21 | 25 | require_once('header.php'); |
22 | 26 | |
@@ -36,7 +40,9 @@ discard block |
||
36 | 40 | if (isset($last_update[0]['value'])) { |
37 | 41 | date_default_timezone_set('UTC'); |
38 | 42 | $lastupdate = strtotime($last_update[0]['value']); |
39 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
43 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
44 | + date_default_timezone_set($globalTimezone); |
|
45 | + } |
|
40 | 46 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
41 | 47 | } |
42 | 48 | ?> |
@@ -89,8 +95,9 @@ discard block |
||
89 | 95 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
90 | 96 | <?php |
91 | 97 | $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name); |
92 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
93 | - else { |
|
98 | + if (count($aircraft_array) == 0) { |
|
99 | + print _("No data available"); |
|
100 | + } else { |
|
94 | 101 | |
95 | 102 | print '<div id="chart1" class="chart" width="100%"></div> |
96 | 103 | <script> |
@@ -132,8 +139,9 @@ discard block |
||
132 | 139 | // echo $airline_icao; |
133 | 140 | if ($airline_icao == '' || $airline_icao == 'all') { |
134 | 141 | $airline_array = $Stats->countAllAirlines(true,$filter_name); |
135 | - if (count($airline_array) == 0) print _("No data available"); |
|
136 | - else { |
|
142 | + if (count($airline_array) == 0) { |
|
143 | + print _("No data available"); |
|
144 | + } else { |
|
137 | 145 | print '<div class="col-md-6">'; |
138 | 146 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
139 | 147 | print '<div id="chart2" class="chart" width="100%"></div> |
@@ -192,8 +200,9 @@ discard block |
||
192 | 200 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
193 | 201 | <?php |
194 | 202 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name); |
195 | - if (count($pilot_array) == 0) print _("No data available"); |
|
196 | - else { |
|
203 | + if (count($pilot_array) == 0) { |
|
204 | + print _("No data available"); |
|
205 | + } else { |
|
197 | 206 | |
198 | 207 | print '<div id="chart7" class="chart" width="100%"></div> |
199 | 208 | <script> |
@@ -239,8 +248,9 @@ discard block |
||
239 | 248 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
240 | 249 | <?php |
241 | 250 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name); |
242 | - if (count($owner_array) == 0) print _("No data available"); |
|
243 | - else { |
|
251 | + if (count($owner_array) == 0) { |
|
252 | + print _("No data available"); |
|
253 | + } else { |
|
244 | 254 | |
245 | 255 | print '<div id="chart7" class="chart" width="100%"></div> |
246 | 256 | <script> |
@@ -288,8 +298,9 @@ discard block |
||
288 | 298 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
289 | 299 | <?php |
290 | 300 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
291 | - if (count($flightover_array) == 0) print _("No data available"); |
|
292 | - else { |
|
301 | + if (count($flightover_array) == 0) { |
|
302 | + print _("No data available"); |
|
303 | + } else { |
|
293 | 304 | |
294 | 305 | print '<div id="chart10" class="chart" width="100%"></div> |
295 | 306 | <script> |
@@ -341,8 +352,9 @@ discard block |
||
341 | 352 | <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2> |
342 | 353 | <?php |
343 | 354 | $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name); |
344 | - if (count($airport_airport_array) == 0) print _("No data available"); |
|
345 | - else { |
|
355 | + if (count($airport_airport_array) == 0) { |
|
356 | + print _("No data available"); |
|
357 | + } else { |
|
346 | 358 | |
347 | 359 | print '<div id="chart3" class="chart" width="100%"></div> |
348 | 360 | <script> |
@@ -391,8 +403,9 @@ discard block |
||
391 | 403 | <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2> |
392 | 404 | <?php |
393 | 405 | $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name); |
394 | - if (count($airport_airport_array2) == 0) print _("No data available"); |
|
395 | - else { |
|
406 | + if (count($airport_airport_array2) == 0) { |
|
407 | + print _("No data available"); |
|
408 | + } else { |
|
396 | 409 | |
397 | 410 | print '<div id="chart4" class="chart" width="100%"></div> |
398 | 411 | <script> |
@@ -443,8 +456,9 @@ discard block |
||
443 | 456 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
444 | 457 | <?php |
445 | 458 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
446 | - if (count($year_array) == 0) print _("No data available"); |
|
447 | - else { |
|
459 | + if (count($year_array) == 0) { |
|
460 | + print _("No data available"); |
|
461 | + } else { |
|
448 | 462 | print '<div id="chart8" class="chart" width="100%"></div> |
449 | 463 | <script> |
450 | 464 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -489,8 +503,9 @@ discard block |
||
489 | 503 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
490 | 504 | <?php |
491 | 505 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
492 | - if (count($month_array) == 0) print _("No data available"); |
|
493 | - else { |
|
506 | + if (count($month_array) == 0) { |
|
507 | + print _("No data available"); |
|
508 | + } else { |
|
494 | 509 | print '<div id="chart9" class="chart" width="100%"></div> |
495 | 510 | <script> |
496 | 511 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -535,8 +550,9 @@ discard block |
||
535 | 550 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
536 | 551 | <?php |
537 | 552 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
538 | - if (empty($date_array)) print _("No data available"); |
|
539 | - else { |
|
553 | + if (empty($date_array)) { |
|
554 | + print _("No data available"); |
|
555 | + } else { |
|
540 | 556 | print '<div id="chart5" class="chart" width="100%"></div> |
541 | 557 | <script> |
542 | 558 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -582,8 +598,9 @@ discard block |
||
582 | 598 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
583 | 599 | <?php |
584 | 600 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
585 | - if (empty($hour_array)) print _("No data available"); |
|
586 | - else { |
|
601 | + if (empty($hour_array)) { |
|
602 | + print _("No data available"); |
|
603 | + } else { |
|
587 | 604 | |
588 | 605 | print '<div id="chart6" class="chart" width="100%"></div> |
589 | 606 | <script> |
@@ -651,8 +668,11 @@ discard block |
||
651 | 668 | $distance = $distance; |
652 | 669 | $unit = 'km'; |
653 | 670 | } |
654 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
655 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
671 | + if (!isset($polar_data)) { |
|
672 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
673 | + } else { |
|
674 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
675 | + } |
|
656 | 676 | } |
657 | 677 | ?> |
658 | 678 | <div class="col-md-6"> |
@@ -699,8 +719,11 @@ discard block |
||
699 | 719 | foreach ($msg as $eachmsg) { |
700 | 720 | //$eachmsg = $msg[0]; |
701 | 721 | $data = $eachmsg['source_data']; |
702 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
703 | - else $max = 500; |
|
722 | + if ($data > 500) { |
|
723 | + $max = (round(($data+100)/100))*100; |
|
724 | + } else { |
|
725 | + $max = 500; |
|
726 | + } |
|
704 | 727 | ?> |
705 | 728 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
706 | 729 | <script> |