@@ -22,7 +22,9 @@ |
||
22 | 22 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
25 | + if (empty($all_manufacturers)) { |
|
26 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
27 | + } |
|
26 | 28 | foreach($all_manufacturers as $all_manufacturer) |
27 | 29 | { |
28 | 30 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -22,7 +22,9 @@ |
||
22 | 22 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
25 | + if (empty($all_manufacturers)) { |
|
26 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
27 | + } |
|
26 | 28 | foreach($all_manufacturers as $all_manufacturer) |
27 | 29 | { |
28 | 30 | if($GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
15 | 15 | $absolute_difference = 25; |
16 | - } else { |
|
16 | + } else { |
|
17 | 17 | $limit_explode = explode(",", $_GET['limit']); |
18 | 18 | $limit_start = $limit_explode[0]; |
19 | 19 | $limit_end = $limit_explode[1]; |
@@ -47,7 +47,9 @@ discard block |
||
47 | 47 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
48 | 48 | $Stats = new Stats(); |
49 | 49 | $all_manufacturers = $Stats->getAllManufacturers(); |
50 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
50 | + if (empty($all_manufacturers)) { |
|
51 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
52 | + } |
|
51 | 53 | foreach($all_manufacturers as $all_manufacturer) |
52 | 54 | { |
53 | 55 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
24 | 24 | } |
25 | 25 | } |
26 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
26 | + if (is_array($globalFilter)) { |
|
27 | + $filter = array_merge($filter,$globalFilter); |
|
28 | + } |
|
27 | 29 | $filter_query_join = ''; |
28 | 30 | $filter_query_where = ''; |
29 | 31 | foreach($filters as $flt) { |
@@ -69,8 +71,11 @@ discard block |
||
69 | 71 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
70 | 72 | } |
71 | 73 | } |
72 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
73 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
74 | + if ($filter_query_where == '' && $where) { |
|
75 | + $filter_query_where = ' WHERE'; |
|
76 | + } elseif ($filter_query_where != '' && $and) { |
|
77 | + $filter_query_where .= ' AND'; |
|
78 | + } |
|
74 | 79 | $filter_query = $filter_query_join.$filter_query_where; |
75 | 80 | return $filter_query; |
76 | 81 | } |
@@ -81,10 +86,17 @@ discard block |
||
81 | 86 | if ($over_country == '') { |
82 | 87 | $Spotter = new Spotter($this->db); |
83 | 88 | $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
84 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
85 | - else $country = ''; |
|
86 | - } else $country = $over_country; |
|
87 | - if ($airline_type === NULL) $airline_type =''; |
|
89 | + if (!empty($data_country)) { |
|
90 | + $country = $data_country['iso2']; |
|
91 | + } else { |
|
92 | + $country = ''; |
|
93 | + } |
|
94 | + } else { |
|
95 | + $country = $over_country; |
|
96 | + } |
|
97 | + if ($airline_type === NULL) { |
|
98 | + $airline_type =''; |
|
99 | + } |
|
88 | 100 | |
89 | 101 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
90 | 102 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
@@ -587,7 +599,9 @@ discard block |
||
587 | 599 | $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
588 | 600 | $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
589 | 601 | $translate = $Translation->ident2icao($q_item); |
590 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
602 | + if ($translate != $q_item) { |
|
603 | + $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
604 | + } |
|
591 | 605 | $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
592 | 606 | $additional_query .= ")"; |
593 | 607 | } |
@@ -805,7 +819,9 @@ discard block |
||
805 | 819 | date_default_timezone_set($globalTimezone); |
806 | 820 | $datetime = new DateTime(); |
807 | 821 | $offset = $datetime->format('P'); |
808 | - } else $offset = '+00:00'; |
|
822 | + } else { |
|
823 | + $offset = '+00:00'; |
|
824 | + } |
|
809 | 825 | |
810 | 826 | |
811 | 827 | if ($date_array[1] != "") |
@@ -969,9 +985,13 @@ discard block |
||
969 | 985 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
970 | 986 | } |
971 | 987 | } |
972 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
988 | + if ($sincedate != '') { |
|
989 | + $query .= "AND date > '".$sincedate."' "; |
|
990 | + } |
|
973 | 991 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
974 | - if ($limit) $query .= " LIMIT 0,10"; |
|
992 | + if ($limit) { |
|
993 | + $query .= " LIMIT 0,10"; |
|
994 | + } |
|
975 | 995 | |
976 | 996 | |
977 | 997 | $sth = $this->db->prepare($query); |
@@ -20,20 +20,27 @@ discard block |
||
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | foreach($globalStatsFilters[$globalFilterName] as $source) { |
23 | - if (isset($source['source'])) $filter['source'][] = $source['source']; |
|
23 | + if (isset($source['source'])) { |
|
24 | + $filter['source'][] = $source['source']; |
|
25 | + } |
|
24 | 26 | } |
25 | 27 | } else { |
26 | 28 | $filter = $globalStatsFilters[$globalFilterName]; |
27 | 29 | } |
28 | 30 | } |
29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
31 | + if (is_array($globalFilter)) { |
|
32 | + $filter = array_merge($filter,$globalFilter); |
|
33 | + } |
|
30 | 34 | $filter_query_join = ''; |
31 | 35 | $filter_query_where = ''; |
32 | 36 | if (isset($filter['source']) && !empty($filter['source'])) { |
33 | 37 | $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
34 | 38 | } |
35 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
36 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
39 | + if ($filter_query_where == '' && $where) { |
|
40 | + $filter_query_where = ' WHERE'; |
|
41 | + } elseif ($filter_query_where != '' && $and) { |
|
42 | + $filter_query_where .= ' AND'; |
|
43 | + } |
|
37 | 44 | $filter_query = $filter_query_join.$filter_query_where; |
38 | 45 | return $filter_query; |
39 | 46 | } |
@@ -57,7 +64,9 @@ discard block |
||
57 | 64 | $info = str_replace('^','<br />',$info); |
58 | 65 | $info = str_replace('&sect;','',$info); |
59 | 66 | $info = str_replace('"','',$info); |
60 | - if ($type == '') $type = NULL; |
|
67 | + if ($type == '') { |
|
68 | + $type = NULL; |
|
69 | + } |
|
61 | 70 | $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)"; |
62 | 71 | $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name); |
63 | 72 | try { |
@@ -28,7 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | // $output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
30 | 30 | $output .= ',"clock": {"currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"'; |
31 | -if (!isset($_GET['now'])) $output .= ',"interval": "'.date("Y").'-12-24T02:00:00Z/'.date("Y").'-12-25T02:00:00Z"'; |
|
31 | +if (!isset($_GET['now'])) { |
|
32 | + $output .= ',"interval": "'.date("Y").'-12-24T02:00:00Z/'.date("Y").'-12-25T02:00:00Z"'; |
|
33 | +} |
|
32 | 34 | $output .= '}'; |
33 | 35 | //$output .= ',"clock": {"currentTime" : "'.date("c",time()).'","multiplier" : 300,"range" : "UNBOUNDED","step": "TICK_DEPENDENT"}'; |
34 | 36 | //$output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
@@ -37,7 +39,9 @@ discard block |
||
37 | 39 | $output .= '},'; |
38 | 40 | $output .= '{'; |
39 | 41 | $output .= '"id": "santaclaus",'; |
40 | -if (!isset($_GET['now'])) $output .= '"interval": "'.date("Y").'-12-24T02:00:00Z/'.date("Y").'-12-25T02:00:00Z",'; |
|
42 | +if (!isset($_GET['now'])) { |
|
43 | + $output .= '"interval": "'.date("Y").'-12-24T02:00:00Z/'.date("Y").'-12-25T02:00:00Z",'; |
|
44 | +} |
|
41 | 45 | $output .= '"properties": {'; |
42 | 46 | // Not yet supported in CZML with Cesium |
43 | 47 | $output .= '},'; |
@@ -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> |
@@ -36,8 +36,12 @@ |
||
36 | 36 | if (!empty($spotter_array)) { |
37 | 37 | include('table-output.php'); |
38 | 38 | print '<div class="pagination">'; |
39 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
40 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
39 | + if ($limit_previous_1 >= 0) { |
|
40 | + print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
41 | + } |
|
42 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
43 | + print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
44 | + } |
|
41 | 45 | print '</div>'; |
42 | 46 | } |
43 | 47 | print '</div>'; |
@@ -38,8 +38,12 @@ |
||
38 | 38 | if (!empty($spotter_array) && $spotter_array[0]['query_number_rows'] != 0) { |
39 | 39 | include('table-output.php'); |
40 | 40 | print '<div class="pagination">'; |
41 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
42 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
41 | + if ($limit_previous_1 >= 0) { |
|
42 | + print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
43 | + } |
|
44 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
45 | + print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
46 | + } |
|
43 | 47 | print '</div>'; |
44 | 48 | } |
45 | 49 | print '</div>'; |