@@ -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> |
@@ -186,8 +193,9 @@ discard block |
||
| 186 | 193 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
| 187 | 194 | <?php |
| 188 | 195 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name); |
| 189 | - if (count($pilot_array) == 0) print _("No data available"); |
|
| 190 | - else { |
|
| 196 | + if (count($pilot_array) == 0) { |
|
| 197 | + print _("No data available"); |
|
| 198 | + } else { |
|
| 191 | 199 | print '<div id="chart7" class="chart" width="100%"></div> |
| 192 | 200 | <script> |
| 193 | 201 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -232,8 +240,9 @@ discard block |
||
| 232 | 240 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
| 233 | 241 | <?php |
| 234 | 242 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name); |
| 235 | - if (count($owner_array) == 0) print _("No data available"); |
|
| 236 | - else { |
|
| 243 | + if (count($owner_array) == 0) { |
|
| 244 | + print _("No data available"); |
|
| 245 | + } else { |
|
| 237 | 246 | print '<div id="chart7" class="chart" width="100%"></div> |
| 238 | 247 | <script> |
| 239 | 248 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -279,8 +288,9 @@ discard block |
||
| 279 | 288 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
| 280 | 289 | <?php |
| 281 | 290 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
| 282 | - if (count($flightover_array) == 0) print _("No data available"); |
|
| 283 | - else { |
|
| 291 | + if (count($flightover_array) == 0) { |
|
| 292 | + print _("No data available"); |
|
| 293 | + } else { |
|
| 284 | 294 | print '<div id="chart10" class="chart" width="100%"></div> |
| 285 | 295 | <script> |
| 286 | 296 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -424,8 +434,9 @@ discard block |
||
| 424 | 434 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 425 | 435 | <?php |
| 426 | 436 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
| 427 | - if (count($year_array) == 0) print _("No data available"); |
|
| 428 | - else { |
|
| 437 | + if (count($year_array) == 0) { |
|
| 438 | + print _("No data available"); |
|
| 439 | + } else { |
|
| 429 | 440 | print '<div id="chart8" class="chart" width="100%"></div> |
| 430 | 441 | <script> |
| 431 | 442 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -470,8 +481,9 @@ discard block |
||
| 470 | 481 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 471 | 482 | <?php |
| 472 | 483 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
| 473 | - if (count($month_array) == 0) print _("No data available"); |
|
| 474 | - else { |
|
| 484 | + if (count($month_array) == 0) { |
|
| 485 | + print _("No data available"); |
|
| 486 | + } else { |
|
| 475 | 487 | print '<div id="chart9" class="chart" width="100%"></div> |
| 476 | 488 | <script> |
| 477 | 489 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -516,8 +528,9 @@ discard block |
||
| 516 | 528 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 517 | 529 | <?php |
| 518 | 530 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
| 519 | - if (empty($date_array)) print _("No data available"); |
|
| 520 | - else { |
|
| 531 | + if (empty($date_array)) { |
|
| 532 | + print _("No data available"); |
|
| 533 | + } else { |
|
| 521 | 534 | print '<div id="chart5" class="chart" width="100%"></div> |
| 522 | 535 | <script> |
| 523 | 536 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -563,8 +576,9 @@ discard block |
||
| 563 | 576 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 564 | 577 | <?php |
| 565 | 578 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
| 566 | - if (empty($hour_array)) print _("No data available"); |
|
| 567 | - else { |
|
| 579 | + if (empty($hour_array)) { |
|
| 580 | + print _("No data available"); |
|
| 581 | + } else { |
|
| 568 | 582 | |
| 569 | 583 | print '<div id="chart6" class="chart" width="100%"></div> |
| 570 | 584 | <script> |
@@ -632,8 +646,11 @@ discard block |
||
| 632 | 646 | $distance = $distance; |
| 633 | 647 | $unit = 'km'; |
| 634 | 648 | } |
| 635 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 636 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 649 | + if (!isset($polar_data)) { |
|
| 650 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 651 | + } else { |
|
| 652 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 653 | + } |
|
| 637 | 654 | } |
| 638 | 655 | ?> |
| 639 | 656 | <div class="col-md-6"> |
@@ -680,8 +697,11 @@ discard block |
||
| 680 | 697 | foreach ($msg as $eachmsg) { |
| 681 | 698 | //$eachmsg = $msg[0]; |
| 682 | 699 | $data = $eachmsg['source_data']; |
| 683 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
| 684 | - else $max = 500; |
|
| 700 | + if ($data > 500) { |
|
| 701 | + $max = (round(($data+100)/100))*100; |
|
| 702 | + } else { |
|
| 703 | + $max = 500; |
|
| 704 | + } |
|
| 685 | 705 | ?> |
| 686 | 706 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
| 687 | 707 | <script> |