@@ -14,7 +14,7 @@ |
||
| 14 | 14 | /** |
| 15 | 15 | * Get SQL query part for filter used |
| 16 | 16 | * @param Array $filter the filter |
| 17 | - * @return Array the SQL part |
|
| 17 | + * @return string the SQL part |
|
| 18 | 18 | */ |
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -26,7 +26,9 @@ discard block |
||
| 26 | 26 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 29 | + if (is_array($globalFilter)) { |
|
| 30 | + $filter = array_merge($filter,$globalFilter); |
|
| 31 | + } |
|
| 30 | 32 | $filter_query_join = ''; |
| 31 | 33 | $filter_query_where = ''; |
| 32 | 34 | foreach($filters as $flt) { |
@@ -101,8 +103,11 @@ discard block |
||
| 101 | 103 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 102 | 104 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 103 | 105 | } |
| 104 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 105 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 106 | + if ($filter_query_where == '' && $where) { |
|
| 107 | + $filter_query_where = ' WHERE'; |
|
| 108 | + } elseif ($filter_query_where != '' && $and) { |
|
| 109 | + $filter_query_where .= ' AND'; |
|
| 110 | + } |
|
| 106 | 111 | if ($filter_query_where != '') { |
| 107 | 112 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 108 | 113 | } |
@@ -144,7 +149,9 @@ discard block |
||
| 144 | 149 | } |
| 145 | 150 | } |
| 146 | 151 | |
| 147 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 152 | + if (!isset($globalLiveInterval)) { |
|
| 153 | + $globalLiveInterval = '200'; |
|
| 154 | + } |
|
| 148 | 155 | if ($globalDBdriver == 'mysql') { |
| 149 | 156 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
| 150 | 157 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -169,7 +176,9 @@ discard block |
||
| 169 | 176 | |
| 170 | 177 | $filter_query = $this->getFilter($filter,true,true); |
| 171 | 178 | |
| 172 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 179 | + if (!isset($globalLiveInterval)) { |
|
| 180 | + $globalLiveInterval = '200'; |
|
| 181 | + } |
|
| 173 | 182 | if ($globalDBdriver == 'mysql') { |
| 174 | 183 | // $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query"; |
| 175 | 184 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao'; |
@@ -226,7 +235,9 @@ discard block |
||
| 226 | 235 | |
| 227 | 236 | $filter_query = $this->getFilter($filter,true,true); |
| 228 | 237 | |
| 229 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 238 | + if (!isset($globalLiveInterval)) { |
|
| 239 | + $globalLiveInterval = '200'; |
|
| 240 | + } |
|
| 230 | 241 | if ($globalDBdriver == 'mysql') { |
| 231 | 242 | /* |
| 232 | 243 | $query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -270,7 +281,9 @@ discard block |
||
| 270 | 281 | global $globalDBdriver, $globalLiveInterval; |
| 271 | 282 | $filter_query = $this->getFilter($filter,true,true); |
| 272 | 283 | |
| 273 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 284 | + if (!isset($globalLiveInterval)) { |
|
| 285 | + $globalLiveInterval = '200'; |
|
| 286 | + } |
|
| 274 | 287 | if ($globalDBdriver == 'mysql') { |
| 275 | 288 | //$query = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
| 276 | 289 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -300,7 +313,9 @@ discard block |
||
| 300 | 313 | { |
| 301 | 314 | global $globalDBdriver, $globalLiveInterval; |
| 302 | 315 | $Spotter = new Spotter($this->db); |
| 303 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 316 | + if (!isset($globalLiveInterval)) { |
|
| 317 | + $globalLiveInterval = '200'; |
|
| 318 | + } |
|
| 304 | 319 | $filter_query = $this->getFilter($filter); |
| 305 | 320 | |
| 306 | 321 | if (is_array($coord)) { |
@@ -308,7 +323,9 @@ discard block |
||
| 308 | 323 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 309 | 324 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 310 | 325 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 311 | - } else return array(); |
|
| 326 | + } else { |
|
| 327 | + return array(); |
|
| 328 | + } |
|
| 312 | 329 | if ($globalDBdriver == 'mysql') { |
| 313 | 330 | //$query = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
| 314 | 331 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -499,11 +516,15 @@ discard block |
||
| 499 | 516 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
| 500 | 517 | if ($globalDBdriver == 'mysql') { |
| 501 | 518 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 502 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 519 | + if ($liveinterval) { |
|
| 520 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 521 | + } |
|
| 503 | 522 | $query .= ' ORDER BY date'; |
| 504 | 523 | } else { |
| 505 | 524 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 506 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 525 | + if ($liveinterval) { |
|
| 526 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 527 | + } |
|
| 507 | 528 | $query .= ' ORDER BY date'; |
| 508 | 529 | } |
| 509 | 530 | |
@@ -598,7 +619,9 @@ discard block |
||
| 598 | 619 | $i++; |
| 599 | 620 | $j++; |
| 600 | 621 | if ($j == 30) { |
| 601 | - if ($globalDebug) echo "."; |
|
| 622 | + if ($globalDebug) { |
|
| 623 | + echo "."; |
|
| 624 | + } |
|
| 602 | 625 | try { |
| 603 | 626 | |
| 604 | 627 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -905,7 +928,9 @@ discard block |
||
| 905 | 928 | { |
| 906 | 929 | return false; |
| 907 | 930 | } |
| 908 | - } else return ''; |
|
| 931 | + } else { |
|
| 932 | + return ''; |
|
| 933 | + } |
|
| 909 | 934 | |
| 910 | 935 | if ($longitude != '') |
| 911 | 936 | { |
@@ -913,7 +938,9 @@ discard block |
||
| 913 | 938 | { |
| 914 | 939 | return false; |
| 915 | 940 | } |
| 916 | - } else return ''; |
|
| 941 | + } else { |
|
| 942 | + return ''; |
|
| 943 | + } |
|
| 917 | 944 | |
| 918 | 945 | if ($waypoints != '') |
| 919 | 946 | { |
@@ -929,7 +956,9 @@ discard block |
||
| 929 | 956 | { |
| 930 | 957 | return false; |
| 931 | 958 | } |
| 932 | - } else $altitude = 0; |
|
| 959 | + } else { |
|
| 960 | + $altitude = 0; |
|
| 961 | + } |
|
| 933 | 962 | |
| 934 | 963 | if ($heading != '') |
| 935 | 964 | { |
@@ -937,7 +966,9 @@ discard block |
||
| 937 | 966 | { |
| 938 | 967 | return false; |
| 939 | 968 | } |
| 940 | - } else $heading = 0; |
|
| 969 | + } else { |
|
| 970 | + $heading = 0; |
|
| 971 | + } |
|
| 941 | 972 | |
| 942 | 973 | if ($groundspeed != '') |
| 943 | 974 | { |
@@ -945,9 +976,13 @@ discard block |
||
| 945 | 976 | { |
| 946 | 977 | return false; |
| 947 | 978 | } |
| 948 | - } else $groundspeed = 0; |
|
| 979 | + } else { |
|
| 980 | + $groundspeed = 0; |
|
| 981 | + } |
|
| 949 | 982 | date_default_timezone_set('UTC'); |
| 950 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 983 | + if ($date == '') { |
|
| 984 | + $date = date("Y-m-d H:i:s", time()); |
|
| 985 | + } |
|
| 951 | 986 | |
| 952 | 987 | |
| 953 | 988 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -991,10 +1026,18 @@ discard block |
||
| 991 | 1026 | $arrival_airport_country = ''; |
| 992 | 1027 | |
| 993 | 1028 | |
| 994 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 995 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 996 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 997 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1029 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
| 1030 | + $squawk = NULL; |
|
| 1031 | + } |
|
| 1032 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
| 1033 | + $verticalrate = NULL; |
|
| 1034 | + } |
|
| 1035 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 1036 | + $groundspeed = 0; |
|
| 1037 | + } |
|
| 1038 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 1039 | + $heading = 0; |
|
| 1040 | + } |
|
| 998 | 1041 | |
| 999 | 1042 | $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
| 1000 | 1043 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
@@ -1008,10 +1051,14 @@ discard block |
||
| 1008 | 1051 | return "error : ".$e->getMessage(); |
| 1009 | 1052 | } |
| 1010 | 1053 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1011 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
| 1054 | + if ($globalDebug) { |
|
| 1055 | + echo '(Add to SBS archive : '; |
|
| 1056 | + } |
|
| 1012 | 1057 | $SpotterArchive = new SpotterArchive($this->db); |
| 1013 | 1058 | $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
| 1014 | - if ($globalDebug) echo $result.')'; |
|
| 1059 | + if ($globalDebug) { |
|
| 1060 | + echo $result.')'; |
|
| 1061 | + } |
|
| 1015 | 1062 | } |
| 1016 | 1063 | return "success"; |
| 1017 | 1064 | |
@@ -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) { |
@@ -96,8 +98,11 @@ discard block |
||
| 96 | 98 | } |
| 97 | 99 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
| 98 | 100 | } |
| 99 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 100 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 101 | + if ($filter_query_where == '' && $where) { |
|
| 102 | + $filter_query_where = ' WHERE'; |
|
| 103 | + } elseif ($filter_query_where != '' && $and) { |
|
| 104 | + $filter_query_where .= ' AND'; |
|
| 105 | + } |
|
| 101 | 106 | if ($filter_query_where != '') { |
| 102 | 107 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 103 | 108 | } |
@@ -111,10 +116,17 @@ discard block |
||
| 111 | 116 | if ($over_country == '') { |
| 112 | 117 | $Spotter = new Spotter($this->db); |
| 113 | 118 | $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
| 114 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
| 115 | - else $country = ''; |
|
| 116 | - } else $country = $over_country; |
|
| 117 | - if ($airline_type === NULL) $airline_type =''; |
|
| 119 | + if (!empty($data_country)) { |
|
| 120 | + $country = $data_country['iso2']; |
|
| 121 | + } else { |
|
| 122 | + $country = ''; |
|
| 123 | + } |
|
| 124 | + } else { |
|
| 125 | + $country = $over_country; |
|
| 126 | + } |
|
| 127 | + if ($airline_type === NULL) { |
|
| 128 | + $airline_type =''; |
|
| 129 | + } |
|
| 118 | 130 | |
| 119 | 131 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
| 120 | 132 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
@@ -617,7 +629,9 @@ discard block |
||
| 617 | 629 | $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
| 618 | 630 | $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
| 619 | 631 | $translate = $Translation->ident2icao($q_item); |
| 620 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
| 632 | + if ($translate != $q_item) { |
|
| 633 | + $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
| 634 | + } |
|
| 621 | 635 | $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
| 622 | 636 | $additional_query .= ")"; |
| 623 | 637 | } |
@@ -835,7 +849,9 @@ discard block |
||
| 835 | 849 | date_default_timezone_set($globalTimezone); |
| 836 | 850 | $datetime = new DateTime(); |
| 837 | 851 | $offset = $datetime->format('P'); |
| 838 | - } else $offset = '+00:00'; |
|
| 852 | + } else { |
|
| 853 | + $offset = '+00:00'; |
|
| 854 | + } |
|
| 839 | 855 | |
| 840 | 856 | |
| 841 | 857 | if ($date_array[1] != "") |
@@ -1111,9 +1127,13 @@ discard block |
||
| 1111 | 1127 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 1112 | 1128 | } |
| 1113 | 1129 | } |
| 1114 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 1130 | + if ($sincedate != '') { |
|
| 1131 | + $query .= "AND date > '".$sincedate."' "; |
|
| 1132 | + } |
|
| 1115 | 1133 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
| 1116 | - if ($limit) $query .= " LIMIT 0,10"; |
|
| 1134 | + if ($limit) { |
|
| 1135 | + $query .= " LIMIT 0,10"; |
|
| 1136 | + } |
|
| 1117 | 1137 | |
| 1118 | 1138 | |
| 1119 | 1139 | $sth = $this->db->prepare($query); |
@@ -1157,9 +1177,13 @@ discard block |
||
| 1157 | 1177 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 1158 | 1178 | } |
| 1159 | 1179 | } |
| 1160 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
| 1180 | + if ($sincedate != '') { |
|
| 1181 | + $query .= "AND s.date > '".$sincedate."' "; |
|
| 1182 | + } |
|
| 1161 | 1183 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
| 1162 | - if ($limit) $query .= " LIMIT 0,10"; |
|
| 1184 | + if ($limit) { |
|
| 1185 | + $query .= " LIMIT 0,10"; |
|
| 1186 | + } |
|
| 1163 | 1187 | |
| 1164 | 1188 | |
| 1165 | 1189 | $sth = $this->db->prepare($query); |