@@ -15,8 +15,12 @@ discard block |
||
15 | 15 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
17 | 17 | $sql_date = $end_date; |
18 | - } else $sql_date = ''; |
|
19 | -} else $sql_date = ''; |
|
18 | + } else { |
|
19 | + $sql_date = ''; |
|
20 | + } |
|
21 | + } else { |
|
22 | + $sql_date = ''; |
|
23 | +} |
|
20 | 24 | |
21 | 25 | if (isset($_GET['highest_altitude'])) { |
22 | 26 | //for altitude manipulation |
@@ -30,8 +34,12 @@ discard block |
||
30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
31 | 35 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
32 | 36 | $sql_altitude = $start_altitude; |
33 | - } else $sql_altitude = ''; |
|
34 | -} else $sql_altitude = ''; |
|
37 | + } else { |
|
38 | + $sql_altitude = ''; |
|
39 | + } |
|
40 | + } else { |
|
41 | + $sql_altitude = ''; |
|
42 | +} |
|
35 | 43 | |
36 | 44 | //calculuation for the pagination |
37 | 45 | if(!isset($_GET['limit'])) |
@@ -48,7 +56,7 @@ discard block |
||
48 | 56 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
49 | 57 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
50 | 58 | } |
51 | -} else { |
|
59 | +} else { |
|
52 | 60 | $limit_explode = explode(",", $_GET['limit']); |
53 | 61 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
54 | 62 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -66,8 +74,11 @@ discard block |
||
66 | 74 | |
67 | 75 | header('Content-Type: application/json'); |
68 | 76 | |
69 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
70 | -else $sort = ''; |
|
77 | +if (isset($_GET['sort'])) { |
|
78 | + $sort = $_GET['sort']; |
|
79 | +} else { |
|
80 | + $sort = ''; |
|
81 | +} |
|
71 | 82 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
72 | 83 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
73 | 84 | $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
@@ -37,8 +37,11 @@ discard block |
||
37 | 37 | } else { |
38 | 38 | curl_setopt($ch, CURLOPT_USERAGENT, $useragent); |
39 | 39 | } |
40 | - if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
41 | - else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
40 | + if ($timeout == '') { |
|
41 | + curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
42 | + } else { |
|
43 | + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
44 | + } |
|
42 | 45 | curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
43 | 46 | if ($type == 'post') { |
44 | 47 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
@@ -85,8 +88,9 @@ discard block |
||
85 | 88 | private function curlResponseHeaderCallback($ch, $headerLine) { |
86 | 89 | //global $cookies; |
87 | 90 | $cookies = array(); |
88 | - if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) |
|
89 | - $cookies[] = $cookie; |
|
91 | + if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) { |
|
92 | + $cookies[] = $cookie; |
|
93 | + } |
|
90 | 94 | return strlen($headerLine); // Needed by curl |
91 | 95 | } |
92 | 96 | |
@@ -97,11 +101,15 @@ discard block |
||
97 | 101 | curl_setopt($ch, CURLOPT_URL, $url); |
98 | 102 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
99 | 103 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
100 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
104 | + if ($referer != '') { |
|
105 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
106 | + } |
|
101 | 107 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
102 | 108 | curl_setopt($ch, CURLOPT_FILE, $fp); |
103 | 109 | curl_exec($ch); |
104 | - if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch); |
|
110 | + if (curl_errno($ch) && $globalDebug) { |
|
111 | + echo 'Download error: '.curl_error($ch); |
|
112 | + } |
|
105 | 113 | curl_close($ch); |
106 | 114 | fclose($fp); |
107 | 115 | } |
@@ -109,12 +117,16 @@ discard block |
||
109 | 117 | public static function gunzip($in_file,$out_file_name = '') { |
110 | 118 | //echo $in_file.' -> '.$out_file_name."\n"; |
111 | 119 | $buffer_size = 4096; // read 4kb at a time |
112 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
120 | + if ($out_file_name == '') { |
|
121 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
122 | + } |
|
113 | 123 | if ($in_file != '' && file_exists($in_file)) { |
114 | 124 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
115 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
116 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
117 | - else { |
|
125 | + if (function_exists('gzopen')) { |
|
126 | + $file = gzopen($in_file,'rb'); |
|
127 | + } elseif (function_exists('gzopen64')) { |
|
128 | + $file = gzopen64($in_file,'rb'); |
|
129 | + } else { |
|
118 | 130 | echo 'gzopen not available'; |
119 | 131 | die; |
120 | 132 | } |
@@ -130,11 +142,14 @@ discard block |
||
130 | 142 | public static function bunzip2($in_file,$out_file_name = '') { |
131 | 143 | //echo $in_file.' -> '.$out_file_name."\n"; |
132 | 144 | $buffer_size = 4096; // read 4kb at a time |
133 | - if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
|
145 | + if ($out_file_name == '') { |
|
146 | + $out_file_name = str_replace('.bz2', '', $in_file); |
|
147 | + } |
|
134 | 148 | if ($in_file != '' && file_exists($in_file)) { |
135 | 149 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
136 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
137 | - else { |
|
150 | + if (function_exists('bzopen')) { |
|
151 | + $file = bzopen($in_file,'rb'); |
|
152 | + } else { |
|
138 | 153 | echo 'bzopen not available'; |
139 | 154 | die; |
140 | 155 | } |
@@ -153,10 +168,16 @@ discard block |
||
153 | 168 | * @return Array array of the tables in HTML page |
154 | 169 | */ |
155 | 170 | public function table2array($data) { |
156 | - if (!is_string($data)) return array(); |
|
157 | - if ($data == '') return array(); |
|
171 | + if (!is_string($data)) { |
|
172 | + return array(); |
|
173 | + } |
|
174 | + if ($data == '') { |
|
175 | + return array(); |
|
176 | + } |
|
158 | 177 | $html = str_get_html($data); |
159 | - if ($html === false) return array(); |
|
178 | + if ($html === false) { |
|
179 | + return array(); |
|
180 | + } |
|
160 | 181 | $tabledata=array(); |
161 | 182 | foreach($html->find('tr') as $element) |
162 | 183 | { |
@@ -191,7 +212,9 @@ discard block |
||
191 | 212 | */ |
192 | 213 | public function text2array($data) { |
193 | 214 | $html = str_get_html($data); |
194 | - if ($html === false) return array(); |
|
215 | + if ($html === false) { |
|
216 | + return array(); |
|
217 | + } |
|
195 | 218 | $tabledata=array(); |
196 | 219 | foreach($html->find('p') as $element) |
197 | 220 | { |
@@ -212,7 +235,9 @@ discard block |
||
212 | 235 | * @return Float Distance in $unit |
213 | 236 | */ |
214 | 237 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
215 | - if ($lat == $latc && $lon == $lonc) return 0; |
|
238 | + if ($lat == $latc && $lon == $lonc) { |
|
239 | + return 0; |
|
240 | + } |
|
216 | 241 | $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
217 | 242 | if ($unit == "km") { |
218 | 243 | return round($dist * 1.609344); |
@@ -236,10 +261,16 @@ discard block |
||
236 | 261 | public function withinThreshold ($timeDifference, $distance) { |
237 | 262 | $x = abs($timeDifference); |
238 | 263 | $d = abs($distance); |
239 | - if ($x == 0 || $d == 0) return true; |
|
264 | + if ($x == 0 || $d == 0) { |
|
265 | + return true; |
|
266 | + } |
|
240 | 267 | // may be due to Internet jitter; distance is realistic |
241 | - if ($x < 0.7 && $d < 2000) return true; |
|
242 | - else return $d/$x < 1500*0.27778; // 1500 km/h max |
|
268 | + if ($x < 0.7 && $d < 2000) { |
|
269 | + return true; |
|
270 | + } else { |
|
271 | + return $d/$x < 1500*0.27778; |
|
272 | + } |
|
273 | + // 1500 km/h max |
|
243 | 274 | } |
244 | 275 | |
245 | 276 | |
@@ -267,11 +298,17 @@ discard block |
||
267 | 298 | |
268 | 299 | public function convertDM($coord,$latlong) { |
269 | 300 | if ($latlong == 'latitude') { |
270 | - if ($coord < 0) $NSEW = 'S'; |
|
271 | - else $NSEW = 'N'; |
|
301 | + if ($coord < 0) { |
|
302 | + $NSEW = 'S'; |
|
303 | + } else { |
|
304 | + $NSEW = 'N'; |
|
305 | + } |
|
272 | 306 | } else { |
273 | - if ($coord < 0) $NSEW = 'W'; |
|
274 | - else $NSEW = 'E'; |
|
307 | + if ($coord < 0) { |
|
308 | + $NSEW = 'W'; |
|
309 | + } else { |
|
310 | + $NSEW = 'E'; |
|
311 | + } |
|
275 | 312 | } |
276 | 313 | $coord = abs($coord); |
277 | 314 | $deg = floor($coord); |
@@ -314,7 +351,9 @@ discard block |
||
314 | 351 | public function hex2str($hex) { |
315 | 352 | $str = ''; |
316 | 353 | $hexln = strlen($hex); |
317 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
354 | + for($i=0;$i<$hexln;$i+=2) { |
|
355 | + $str .= chr(hexdec(substr($hex,$i,2))); |
|
356 | + } |
|
318 | 357 | return $str; |
319 | 358 | } |
320 | 359 | |
@@ -351,8 +390,11 @@ discard block |
||
351 | 390 | $b = $lat2 - $lat1; |
352 | 391 | $c = -($a*$lat1+$b*$lon1); |
353 | 392 | $d = $a*$lat3+$b*$lon3+$c; |
354 | - if ($d > -$approx && $d < $approx) return true; |
|
355 | - else return false; |
|
393 | + if ($d > -$approx && $d < $approx) { |
|
394 | + return true; |
|
395 | + } else { |
|
396 | + return false; |
|
397 | + } |
|
356 | 398 | } |
357 | 399 | |
358 | 400 | public function array_merge_noappend() { |
@@ -411,7 +453,9 @@ discard block |
||
411 | 453 | return $result; |
412 | 454 | } |
413 | 455 | $handle = @opendir('./locale'); |
414 | - if ($handle === false) return $result; |
|
456 | + if ($handle === false) { |
|
457 | + return $result; |
|
458 | + } |
|
415 | 459 | while (false !== ($file = readdir($handle))) { |
416 | 460 | $path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo'; |
417 | 461 | if ($file != "." && $file != ".." && @file_exists($path)) { |
@@ -478,8 +522,9 @@ discard block |
||
478 | 522 | $error = false; |
479 | 523 | if ($fp_out = gzopen($dest, $mode)) { |
480 | 524 | if ($fp_in = fopen($source,'rb')) { |
481 | - while (!feof($fp_in)) |
|
482 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
525 | + while (!feof($fp_in)) { |
|
526 | + gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
527 | + } |
|
483 | 528 | fclose($fp_in); |
484 | 529 | } else { |
485 | 530 | $error = true; |
@@ -488,14 +533,17 @@ discard block |
||
488 | 533 | } else { |
489 | 534 | $error = true; |
490 | 535 | } |
491 | - if ($error) |
|
492 | - return false; |
|
493 | - else |
|
494 | - return $dest; |
|
536 | + if ($error) { |
|
537 | + return false; |
|
538 | + } else { |
|
539 | + return $dest; |
|
540 | + } |
|
495 | 541 | } |
496 | 542 | |
497 | 543 | public function remove_accents($string) { |
498 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
544 | + if ( !preg_match('/[\x80-\xff]/', $string) ) { |
|
545 | + return $string; |
|
546 | + } |
|
499 | 547 | $chars = array( |
500 | 548 | // Decompositions for Latin-1 Supplement |
501 | 549 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -619,7 +667,9 @@ discard block |
||
619 | 667 | $ip = gethostbyname($host); |
620 | 668 | $s = socket_create(AF_INET, SOCK_STREAM, 0); |
621 | 669 | $r = @socket_connect($s, $ip, $port); |
622 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
670 | + if (!socket_set_nonblock($s)) { |
|
671 | + echo "Unable to set nonblock on socket\n"; |
|
672 | + } |
|
623 | 673 | if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
624 | 674 | return $s; |
625 | 675 | } |
@@ -13,7 +13,9 @@ discard block |
||
13 | 13 | |
14 | 14 | public function __construct($dbc = null) { |
15 | 15 | global $globalFilterName; |
16 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
16 | + if (isset($globalFilterName)) { |
|
17 | + $this->filter_name = $globalFilterName; |
|
18 | + } |
|
17 | 19 | $Connection = new Connection($dbc); |
18 | 20 | $this->db = $Connection->db(); |
19 | 21 | } |
@@ -83,7 +85,9 @@ discard block |
||
83 | 85 | |
84 | 86 | public function getAllAirlineNames($filter_name = '') { |
85 | 87 | global $globalStatsFilters; |
86 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
88 | + if ($filter_name == '') { |
|
89 | + $filter_name = $this->filter_name; |
|
90 | + } |
|
87 | 91 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
88 | 92 | try { |
89 | 93 | $sth = $this->db->prepare($query); |
@@ -103,7 +107,9 @@ discard block |
||
103 | 107 | return $all; |
104 | 108 | } |
105 | 109 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
106 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
110 | + if ($filter_name == '') { |
|
111 | + $filter_name = $this->filter_name; |
|
112 | + } |
|
107 | 113 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
108 | 114 | try { |
109 | 115 | $sth = $this->db->prepare($query); |
@@ -115,7 +121,9 @@ discard block |
||
115 | 121 | return $all; |
116 | 122 | } |
117 | 123 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
118 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
124 | + if ($filter_name == '') { |
|
125 | + $filter_name = $this->filter_name; |
|
126 | + } |
|
119 | 127 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
120 | 128 | try { |
121 | 129 | $sth = $this->db->prepare($query); |
@@ -127,7 +135,9 @@ discard block |
||
127 | 135 | return $all; |
128 | 136 | } |
129 | 137 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
130 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
138 | + if ($filter_name == '') { |
|
139 | + $filter_name = $this->filter_name; |
|
140 | + } |
|
131 | 141 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
132 | 142 | try { |
133 | 143 | $sth = $this->db->prepare($query); |
@@ -140,7 +150,9 @@ discard block |
||
140 | 150 | } |
141 | 151 | |
142 | 152 | public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
143 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
153 | + if ($filter_name == '') { |
|
154 | + $filter_name = $this->filter_name; |
|
155 | + } |
|
144 | 156 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
145 | 157 | try { |
146 | 158 | $sth = $this->db->prepare($query); |
@@ -153,7 +165,9 @@ discard block |
||
153 | 165 | } |
154 | 166 | |
155 | 167 | public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
156 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
168 | + if ($filter_name == '') { |
|
169 | + $filter_name = $this->filter_name; |
|
170 | + } |
|
157 | 171 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
158 | 172 | try { |
159 | 173 | $sth = $this->db->prepare($query); |
@@ -168,7 +182,9 @@ discard block |
||
168 | 182 | |
169 | 183 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
170 | 184 | global $globalStatsFilters; |
171 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
185 | + if ($filter_name == '') { |
|
186 | + $filter_name = $this->filter_name; |
|
187 | + } |
|
172 | 188 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
173 | 189 | $Spotter = new Spotter($this->db); |
174 | 190 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -177,8 +193,11 @@ discard block |
||
177 | 193 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
178 | 194 | } |
179 | 195 | if ($year == '' && $month == '') { |
180 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
181 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
196 | + if ($limit) { |
|
197 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
198 | + } else { |
|
199 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
200 | + } |
|
182 | 201 | try { |
183 | 202 | $sth = $this->db->prepare($query); |
184 | 203 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -186,11 +205,16 @@ discard block |
||
186 | 205 | echo "error : ".$e->getMessage(); |
187 | 206 | } |
188 | 207 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
189 | - } else $all = array(); |
|
208 | + } else { |
|
209 | + $all = array(); |
|
210 | + } |
|
190 | 211 | } else { |
191 | 212 | if ($year == '' && $month == '') { |
192 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
193 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
213 | + if ($limit) { |
|
214 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
215 | + } else { |
|
216 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
217 | + } |
|
194 | 218 | try { |
195 | 219 | $sth = $this->db->prepare($query); |
196 | 220 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -198,7 +222,9 @@ discard block |
||
198 | 222 | echo "error : ".$e->getMessage(); |
199 | 223 | } |
200 | 224 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
201 | - } else $all = array(); |
|
225 | + } else { |
|
226 | + $all = array(); |
|
227 | + } |
|
202 | 228 | } |
203 | 229 | if (empty($all)) { |
204 | 230 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -217,10 +243,15 @@ discard block |
||
217 | 243 | } |
218 | 244 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
219 | 245 | global $globalStatsFilters; |
220 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
246 | + if ($filter_name == '') { |
|
247 | + $filter_name = $this->filter_name; |
|
248 | + } |
|
221 | 249 | if ($year == '' && $month == '') { |
222 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
223 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
250 | + if ($limit) { |
|
251 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
252 | + } else { |
|
253 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
254 | + } |
|
224 | 255 | try { |
225 | 256 | $sth = $this->db->prepare($query); |
226 | 257 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -228,7 +259,9 @@ discard block |
||
228 | 259 | echo "error : ".$e->getMessage(); |
229 | 260 | } |
230 | 261 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
231 | - } else $all = array(); |
|
262 | + } else { |
|
263 | + $all = array(); |
|
264 | + } |
|
232 | 265 | if (empty($all)) { |
233 | 266 | $Spotter = new Spotter($this->db); |
234 | 267 | $filters = array(); |
@@ -243,7 +276,9 @@ discard block |
||
243 | 276 | } |
244 | 277 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
245 | 278 | global $globalStatsFilters; |
246 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
279 | + if ($filter_name == '') { |
|
280 | + $filter_name = $this->filter_name; |
|
281 | + } |
|
247 | 282 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
248 | 283 | $Spotter = new Spotter($this->db); |
249 | 284 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -252,8 +287,11 @@ discard block |
||
252 | 287 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
253 | 288 | } |
254 | 289 | if ($year == '' && $month == '') { |
255 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
256 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
290 | + if ($limit) { |
|
291 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
292 | + } else { |
|
293 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
294 | + } |
|
257 | 295 | try { |
258 | 296 | $sth = $this->db->prepare($query); |
259 | 297 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -261,11 +299,16 @@ discard block |
||
261 | 299 | echo "error : ".$e->getMessage(); |
262 | 300 | } |
263 | 301 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
264 | - } else $all = array(); |
|
302 | + } else { |
|
303 | + $all = array(); |
|
304 | + } |
|
265 | 305 | } else { |
266 | 306 | if ($year == '' && $month == '') { |
267 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
268 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
307 | + if ($limit) { |
|
308 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
309 | + } else { |
|
310 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
311 | + } |
|
269 | 312 | try { |
270 | 313 | $sth = $this->db->prepare($query); |
271 | 314 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -273,7 +316,9 @@ discard block |
||
273 | 316 | echo "error : ".$e->getMessage(); |
274 | 317 | } |
275 | 318 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
276 | - } else $all = array(); |
|
319 | + } else { |
|
320 | + $all = array(); |
|
321 | + } |
|
277 | 322 | } |
278 | 323 | if (empty($all)) { |
279 | 324 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -293,7 +338,9 @@ discard block |
||
293 | 338 | |
294 | 339 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
295 | 340 | global $globalStatsFilters; |
296 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
341 | + if ($filter_name == '') { |
|
342 | + $filter_name = $this->filter_name; |
|
343 | + } |
|
297 | 344 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
298 | 345 | $Spotter = new Spotter($this->db); |
299 | 346 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -302,8 +349,11 @@ discard block |
||
302 | 349 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
303 | 350 | } |
304 | 351 | if ($year == '' && $month == '') { |
305 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
306 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
352 | + if ($limit) { |
|
353 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
354 | + } else { |
|
355 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
356 | + } |
|
307 | 357 | try { |
308 | 358 | $sth = $this->db->prepare($query); |
309 | 359 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -311,11 +361,16 @@ discard block |
||
311 | 361 | echo "error : ".$e->getMessage(); |
312 | 362 | } |
313 | 363 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
314 | - } else $all = array(); |
|
364 | + } else { |
|
365 | + $all = array(); |
|
366 | + } |
|
315 | 367 | } else { |
316 | 368 | if ($year == '' && $month == '') { |
317 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
318 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
369 | + if ($limit) { |
|
370 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
371 | + } else { |
|
372 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
373 | + } |
|
319 | 374 | try { |
320 | 375 | $sth = $this->db->prepare($query); |
321 | 376 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -323,7 +378,9 @@ discard block |
||
323 | 378 | echo "error : ".$e->getMessage(); |
324 | 379 | } |
325 | 380 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
326 | - } else $all = array(); |
|
381 | + } else { |
|
382 | + $all = array(); |
|
383 | + } |
|
327 | 384 | } |
328 | 385 | if (empty($all)) { |
329 | 386 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -342,7 +399,9 @@ discard block |
||
342 | 399 | } |
343 | 400 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
344 | 401 | global $globalStatsFilters; |
345 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
402 | + if ($filter_name == '') { |
|
403 | + $filter_name = $this->filter_name; |
|
404 | + } |
|
346 | 405 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
347 | 406 | $Spotter = new Spotter($this->db); |
348 | 407 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -350,12 +409,18 @@ discard block |
||
350 | 409 | foreach ($airlines as $airline) { |
351 | 410 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
352 | 411 | } |
353 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
354 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
412 | + if ($limit) { |
|
413 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
414 | + } else { |
|
415 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
416 | + } |
|
355 | 417 | $query_values = array(':filter_name' => $filter_name); |
356 | 418 | } else { |
357 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
358 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
419 | + if ($limit) { |
|
420 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
421 | + } else { |
|
422 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
423 | + } |
|
359 | 424 | $query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
360 | 425 | } |
361 | 426 | try { |
@@ -383,17 +448,29 @@ discard block |
||
383 | 448 | |
384 | 449 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
385 | 450 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
386 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
451 | + if ($filter_name == '') { |
|
452 | + $filter_name = $this->filter_name; |
|
453 | + } |
|
387 | 454 | if ($year == '' && $month == '') { |
388 | - if ($globalVATSIM) $forsource = 'vatsim'; |
|
389 | - if ($globalIVAO) $forsource = 'ivao'; |
|
455 | + if ($globalVATSIM) { |
|
456 | + $forsource = 'vatsim'; |
|
457 | + } |
|
458 | + if ($globalIVAO) { |
|
459 | + $forsource = 'ivao'; |
|
460 | + } |
|
390 | 461 | if (isset($forsource)) { |
391 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
392 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
462 | + if ($limit) { |
|
463 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
464 | + } else { |
|
465 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
466 | + } |
|
393 | 467 | $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
394 | 468 | } else { |
395 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
396 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
469 | + if ($limit) { |
|
470 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
471 | + } else { |
|
472 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
473 | + } |
|
397 | 474 | $query_values = array(':filter_name' => $filter_name); |
398 | 475 | } |
399 | 476 | try { |
@@ -403,7 +480,9 @@ discard block |
||
403 | 480 | echo "error : ".$e->getMessage(); |
404 | 481 | } |
405 | 482 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
406 | - } else $all = array(); |
|
483 | + } else { |
|
484 | + $all = array(); |
|
485 | + } |
|
407 | 486 | if (empty($all)) { |
408 | 487 | $Spotter = new Spotter($this->db); |
409 | 488 | $filters = array(); |
@@ -418,7 +497,9 @@ discard block |
||
418 | 497 | } |
419 | 498 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
420 | 499 | global $globalStatsFilters; |
421 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
500 | + if ($filter_name == '') { |
|
501 | + $filter_name = $this->filter_name; |
|
502 | + } |
|
422 | 503 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
423 | 504 | $Spotter = new Spotter($this->db); |
424 | 505 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -427,8 +508,11 @@ discard block |
||
427 | 508 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
428 | 509 | } |
429 | 510 | if ($year == '' && $month == '') { |
430 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
431 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
511 | + if ($limit) { |
|
512 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
513 | + } else { |
|
514 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
515 | + } |
|
432 | 516 | try { |
433 | 517 | $sth = $this->db->prepare($query); |
434 | 518 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -436,11 +520,16 @@ discard block |
||
436 | 520 | echo "error : ".$e->getMessage(); |
437 | 521 | } |
438 | 522 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
439 | - } else $all = array(); |
|
523 | + } else { |
|
524 | + $all = array(); |
|
525 | + } |
|
440 | 526 | } else { |
441 | 527 | if ($year == '' && $month == '') { |
442 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
443 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
528 | + if ($limit) { |
|
529 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
530 | + } else { |
|
531 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
532 | + } |
|
444 | 533 | try { |
445 | 534 | $sth = $this->db->prepare($query); |
446 | 535 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -448,7 +537,9 @@ discard block |
||
448 | 537 | echo "error : ".$e->getMessage(); |
449 | 538 | } |
450 | 539 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
451 | - } else $all = array(); |
|
540 | + } else { |
|
541 | + $all = array(); |
|
542 | + } |
|
452 | 543 | } |
453 | 544 | if (empty($all)) { |
454 | 545 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -467,7 +558,9 @@ discard block |
||
467 | 558 | } |
468 | 559 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
469 | 560 | global $globalStatsFilters; |
470 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
561 | + if ($filter_name == '') { |
|
562 | + $filter_name = $this->filter_name; |
|
563 | + } |
|
471 | 564 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
472 | 565 | $Spotter = new Spotter($this->db); |
473 | 566 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -476,8 +569,11 @@ discard block |
||
476 | 569 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
477 | 570 | } |
478 | 571 | if ($year == '' && $month == '') { |
479 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
480 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
572 | + if ($limit) { |
|
573 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
574 | + } else { |
|
575 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
576 | + } |
|
481 | 577 | try { |
482 | 578 | $sth = $this->db->prepare($query); |
483 | 579 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -485,11 +581,16 @@ discard block |
||
485 | 581 | echo "error : ".$e->getMessage(); |
486 | 582 | } |
487 | 583 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
488 | - } else $all = array(); |
|
584 | + } else { |
|
585 | + $all = array(); |
|
586 | + } |
|
489 | 587 | } else { |
490 | 588 | if ($year == '' && $month == '') { |
491 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
492 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
589 | + if ($limit) { |
|
590 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
591 | + } else { |
|
592 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
593 | + } |
|
493 | 594 | try { |
494 | 595 | $sth = $this->db->prepare($query); |
495 | 596 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -497,7 +598,9 @@ discard block |
||
497 | 598 | echo "error : ".$e->getMessage(); |
498 | 599 | } |
499 | 600 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
500 | - } else $all = array(); |
|
601 | + } else { |
|
602 | + $all = array(); |
|
603 | + } |
|
501 | 604 | } |
502 | 605 | if (empty($all)) { |
503 | 606 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -516,7 +619,9 @@ discard block |
||
516 | 619 | } |
517 | 620 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
518 | 621 | $Connection = new Connection(); |
519 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
622 | + if ($filter_name == '') { |
|
623 | + $filter_name = $this->filter_name; |
|
624 | + } |
|
520 | 625 | if ($Connection->tableExists('countries')) { |
521 | 626 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
522 | 627 | $Spotter = new Spotter($this->db); |
@@ -526,8 +631,11 @@ discard block |
||
526 | 631 | foreach ($airlines as $airline) { |
527 | 632 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
528 | 633 | } |
529 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
530 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
634 | + if ($limit) { |
|
635 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
636 | + } else { |
|
637 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
638 | + } |
|
531 | 639 | try { |
532 | 640 | $sth = $this->db->prepare($query); |
533 | 641 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -536,11 +644,16 @@ discard block |
||
536 | 644 | } |
537 | 645 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
538 | 646 | return $all; |
539 | - } else return array(); |
|
647 | + } else { |
|
648 | + return array(); |
|
649 | + } |
|
540 | 650 | } else { |
541 | 651 | if ($year == '' && $month == '') { |
542 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
543 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
652 | + if ($limit) { |
|
653 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
654 | + } else { |
|
655 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
656 | + } |
|
544 | 657 | try { |
545 | 658 | $sth = $this->db->prepare($query); |
546 | 659 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -549,7 +662,9 @@ discard block |
||
549 | 662 | } |
550 | 663 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
551 | 664 | return $all; |
552 | - } else return array(); |
|
665 | + } else { |
|
666 | + return array(); |
|
667 | + } |
|
553 | 668 | } |
554 | 669 | } else { |
555 | 670 | /* |
@@ -563,10 +678,15 @@ discard block |
||
563 | 678 | } |
564 | 679 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
565 | 680 | global $globalStatsFilters; |
566 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
681 | + if ($filter_name == '') { |
|
682 | + $filter_name = $this->filter_name; |
|
683 | + } |
|
567 | 684 | if ($year == '' && $month == '') { |
568 | - if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
569 | - else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
685 | + if ($limit) { |
|
686 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
687 | + } else { |
|
688 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
689 | + } |
|
570 | 690 | try { |
571 | 691 | $sth = $this->db->prepare($query); |
572 | 692 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -574,7 +694,9 @@ discard block |
||
574 | 694 | echo "error : ".$e->getMessage(); |
575 | 695 | } |
576 | 696 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
577 | - } else $all = array(); |
|
697 | + } else { |
|
698 | + $all = array(); |
|
699 | + } |
|
578 | 700 | if (empty($all)) { |
579 | 701 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
580 | 702 | if ($filter_name != '') { |
@@ -589,7 +711,9 @@ discard block |
||
589 | 711 | |
590 | 712 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
591 | 713 | global $globalStatsFilters; |
592 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
714 | + if ($filter_name == '') { |
|
715 | + $filter_name = $this->filter_name; |
|
716 | + } |
|
593 | 717 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
594 | 718 | $Spotter = new Spotter($this->db); |
595 | 719 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -598,8 +722,11 @@ discard block |
||
598 | 722 | foreach ($airlines as $airline) { |
599 | 723 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
600 | 724 | } |
601 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
602 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
725 | + if ($limit) { |
|
726 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
727 | + } else { |
|
728 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
729 | + } |
|
603 | 730 | try { |
604 | 731 | $sth = $this->db->prepare($query); |
605 | 732 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -607,11 +734,16 @@ discard block |
||
607 | 734 | echo "error : ".$e->getMessage(); |
608 | 735 | } |
609 | 736 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
610 | - } else $all = array(); |
|
737 | + } else { |
|
738 | + $all = array(); |
|
739 | + } |
|
611 | 740 | } else { |
612 | 741 | if ($year == '' && $month == '') { |
613 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
614 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
742 | + if ($limit) { |
|
743 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
744 | + } else { |
|
745 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
746 | + } |
|
615 | 747 | try { |
616 | 748 | $sth = $this->db->prepare($query); |
617 | 749 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -619,7 +751,9 @@ discard block |
||
619 | 751 | echo "error : ".$e->getMessage(); |
620 | 752 | } |
621 | 753 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
622 | - } else $all = array(); |
|
754 | + } else { |
|
755 | + $all = array(); |
|
756 | + } |
|
623 | 757 | } |
624 | 758 | if (empty($all)) { |
625 | 759 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -638,7 +772,9 @@ discard block |
||
638 | 772 | } |
639 | 773 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
640 | 774 | global $globalStatsFilters; |
641 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
775 | + if ($filter_name == '') { |
|
776 | + $filter_name = $this->filter_name; |
|
777 | + } |
|
642 | 778 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
643 | 779 | $Spotter = new Spotter($this->db); |
644 | 780 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -647,8 +783,11 @@ discard block |
||
647 | 783 | foreach ($airlines as $airline) { |
648 | 784 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
649 | 785 | } |
650 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
651 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
786 | + if ($limit) { |
|
787 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
788 | + } else { |
|
789 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
790 | + } |
|
652 | 791 | try { |
653 | 792 | $sth = $this->db->prepare($query); |
654 | 793 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -656,11 +795,16 @@ discard block |
||
656 | 795 | echo "error : ".$e->getMessage(); |
657 | 796 | } |
658 | 797 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
659 | - } else $all = array(); |
|
798 | + } else { |
|
799 | + $all = array(); |
|
800 | + } |
|
660 | 801 | } else { |
661 | 802 | if ($year == '' && $month == '') { |
662 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
663 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
803 | + if ($limit) { |
|
804 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
805 | + } else { |
|
806 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
807 | + } |
|
664 | 808 | try { |
665 | 809 | $sth = $this->db->prepare($query); |
666 | 810 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -668,7 +812,9 @@ discard block |
||
668 | 812 | echo "error : ".$e->getMessage(); |
669 | 813 | } |
670 | 814 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
671 | - } else $all = array(); |
|
815 | + } else { |
|
816 | + $all = array(); |
|
817 | + } |
|
672 | 818 | } |
673 | 819 | if (empty($all)) { |
674 | 820 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -693,7 +839,9 @@ discard block |
||
693 | 839 | $icao = $value['airport_departure_icao']; |
694 | 840 | if (isset($all[$icao])) { |
695 | 841 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
696 | - } else $all[$icao] = $value; |
|
842 | + } else { |
|
843 | + $all[$icao] = $value; |
|
844 | + } |
|
697 | 845 | } |
698 | 846 | $count = array(); |
699 | 847 | foreach ($all as $key => $row) { |
@@ -705,7 +853,9 @@ discard block |
||
705 | 853 | } |
706 | 854 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
707 | 855 | global $globalStatsFilters; |
708 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
856 | + if ($filter_name == '') { |
|
857 | + $filter_name = $this->filter_name; |
|
858 | + } |
|
709 | 859 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
710 | 860 | $Spotter = new Spotter($this->db); |
711 | 861 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -714,8 +864,11 @@ discard block |
||
714 | 864 | foreach ($airlines as $airline) { |
715 | 865 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
716 | 866 | } |
717 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
718 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
867 | + if ($limit) { |
|
868 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
869 | + } else { |
|
870 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
871 | + } |
|
719 | 872 | try { |
720 | 873 | $sth = $this->db->prepare($query); |
721 | 874 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -723,11 +876,16 @@ discard block |
||
723 | 876 | echo "error : ".$e->getMessage(); |
724 | 877 | } |
725 | 878 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
726 | - } else $all = array(); |
|
879 | + } else { |
|
880 | + $all = array(); |
|
881 | + } |
|
727 | 882 | } else { |
728 | 883 | if ($year == '' && $month == '') { |
729 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
730 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
884 | + if ($limit) { |
|
885 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
886 | + } else { |
|
887 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
888 | + } |
|
731 | 889 | try { |
732 | 890 | $sth = $this->db->prepare($query); |
733 | 891 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -735,7 +893,9 @@ discard block |
||
735 | 893 | echo "error : ".$e->getMessage(); |
736 | 894 | } |
737 | 895 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
738 | - } else $all = array(); |
|
896 | + } else { |
|
897 | + $all = array(); |
|
898 | + } |
|
739 | 899 | } |
740 | 900 | if (empty($all)) { |
741 | 901 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -760,7 +920,9 @@ discard block |
||
760 | 920 | $icao = $value['airport_arrival_icao']; |
761 | 921 | if (isset($all[$icao])) { |
762 | 922 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
763 | - } else $all[$icao] = $value; |
|
923 | + } else { |
|
924 | + $all[$icao] = $value; |
|
925 | + } |
|
764 | 926 | } |
765 | 927 | $count = array(); |
766 | 928 | foreach ($all as $key => $row) { |
@@ -772,7 +934,9 @@ discard block |
||
772 | 934 | } |
773 | 935 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
774 | 936 | global $globalDBdriver, $globalStatsFilters; |
775 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
937 | + if ($filter_name == '') { |
|
938 | + $filter_name = $this->filter_name; |
|
939 | + } |
|
776 | 940 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
777 | 941 | $Spotter = new Spotter($this->db); |
778 | 942 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -781,20 +945,32 @@ discard block |
||
781 | 945 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
782 | 946 | } |
783 | 947 | if ($globalDBdriver == 'mysql') { |
784 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
785 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
948 | + if ($limit) { |
|
949 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
950 | + } else { |
|
951 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
952 | + } |
|
786 | 953 | } else { |
787 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
788 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
954 | + if ($limit) { |
|
955 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
956 | + } else { |
|
957 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
958 | + } |
|
789 | 959 | } |
790 | 960 | $query_data = array(':filter_name' => $filter_name); |
791 | 961 | } else { |
792 | 962 | if ($globalDBdriver == 'mysql') { |
793 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
794 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
963 | + if ($limit) { |
|
964 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
965 | + } else { |
|
966 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
967 | + } |
|
795 | 968 | } else { |
796 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
797 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
969 | + if ($limit) { |
|
970 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
971 | + } else { |
|
972 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
973 | + } |
|
798 | 974 | } |
799 | 975 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
800 | 976 | } |
@@ -822,7 +998,9 @@ discard block |
||
822 | 998 | |
823 | 999 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
824 | 1000 | global $globalStatsFilters; |
825 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1001 | + if ($filter_name == '') { |
|
1002 | + $filter_name = $this->filter_name; |
|
1003 | + } |
|
826 | 1004 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
827 | 1005 | $Spotter = new Spotter($this->db); |
828 | 1006 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -859,7 +1037,9 @@ discard block |
||
859 | 1037 | } |
860 | 1038 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
861 | 1039 | global $globalDBdriver, $globalStatsFilters; |
862 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1040 | + if ($filter_name == '') { |
|
1041 | + $filter_name = $this->filter_name; |
|
1042 | + } |
|
863 | 1043 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
864 | 1044 | $Spotter = new Spotter($this->db); |
865 | 1045 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -904,7 +1084,9 @@ discard block |
||
904 | 1084 | } |
905 | 1085 | public function countAllDates($stats_airline = '',$filter_name = '') { |
906 | 1086 | global $globalStatsFilters; |
907 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1087 | + if ($filter_name == '') { |
|
1088 | + $filter_name = $this->filter_name; |
|
1089 | + } |
|
908 | 1090 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
909 | 1091 | $Spotter = new Spotter($this->db); |
910 | 1092 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -941,7 +1123,9 @@ discard block |
||
941 | 1123 | } |
942 | 1124 | public function countAllDatesByAirlines($filter_name = '') { |
943 | 1125 | global $globalStatsFilters; |
944 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1126 | + if ($filter_name == '') { |
|
1127 | + $filter_name = $this->filter_name; |
|
1128 | + } |
|
945 | 1129 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
946 | 1130 | $query_data = array('filter_name' => $filter_name); |
947 | 1131 | try { |
@@ -963,7 +1147,9 @@ discard block |
||
963 | 1147 | } |
964 | 1148 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
965 | 1149 | global $globalStatsFilters, $globalDBdriver; |
966 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1150 | + if ($filter_name == '') { |
|
1151 | + $filter_name = $this->filter_name; |
|
1152 | + } |
|
967 | 1153 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
968 | 1154 | $Spotter = new Spotter($this->db); |
969 | 1155 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1048,7 +1234,9 @@ discard block |
||
1048 | 1234 | } |
1049 | 1235 | public function countAllMilitaryMonths($filter_name = '') { |
1050 | 1236 | global $globalStatsFilters; |
1051 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1237 | + if ($filter_name == '') { |
|
1238 | + $filter_name = $this->filter_name; |
|
1239 | + } |
|
1052 | 1240 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
1053 | 1241 | try { |
1054 | 1242 | $sth = $this->db->prepare($query); |
@@ -1069,7 +1257,9 @@ discard block |
||
1069 | 1257 | } |
1070 | 1258 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
1071 | 1259 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
1072 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1260 | + if ($filter_name == '') { |
|
1261 | + $filter_name = $this->filter_name; |
|
1262 | + } |
|
1073 | 1263 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1074 | 1264 | $Spotter = new Spotter($this->db); |
1075 | 1265 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1077,12 +1267,18 @@ discard block |
||
1077 | 1267 | foreach ($airlines as $airline) { |
1078 | 1268 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
1079 | 1269 | } |
1080 | - if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1081 | - else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1270 | + if ($limit) { |
|
1271 | + $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1272 | + } else { |
|
1273 | + $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1274 | + } |
|
1082 | 1275 | $query_data = array(':filter_name' => $filter_name); |
1083 | 1276 | } else { |
1084 | - if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1085 | - else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1277 | + if ($limit) { |
|
1278 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1279 | + } else { |
|
1280 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1281 | + } |
|
1086 | 1282 | $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
1087 | 1283 | } |
1088 | 1284 | if ($orderby == 'hour') { |
@@ -1092,7 +1288,9 @@ discard block |
||
1092 | 1288 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
1093 | 1289 | } |
1094 | 1290 | } |
1095 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
1291 | + if ($orderby == 'count') { |
|
1292 | + $query .= " ORDER BY hour_count DESC"; |
|
1293 | + } |
|
1096 | 1294 | try { |
1097 | 1295 | $sth = $this->db->prepare($query); |
1098 | 1296 | $sth->execute($query_data); |
@@ -1116,8 +1314,12 @@ discard block |
||
1116 | 1314 | } |
1117 | 1315 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
1118 | 1316 | global $globalStatsFilters; |
1119 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1120 | - if ($year == '') $year = date('Y'); |
|
1317 | + if ($filter_name == '') { |
|
1318 | + $filter_name = $this->filter_name; |
|
1319 | + } |
|
1320 | + if ($year == '') { |
|
1321 | + $year = date('Y'); |
|
1322 | + } |
|
1121 | 1323 | $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
1122 | 1324 | if (empty($all)) { |
1123 | 1325 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1136,8 +1338,12 @@ discard block |
||
1136 | 1338 | } |
1137 | 1339 | public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
1138 | 1340 | global $globalStatsFilters; |
1139 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1140 | - if ($year == '') $year = date('Y'); |
|
1341 | + if ($filter_name == '') { |
|
1342 | + $filter_name = $this->filter_name; |
|
1343 | + } |
|
1344 | + if ($year == '') { |
|
1345 | + $year = date('Y'); |
|
1346 | + } |
|
1141 | 1347 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
1142 | 1348 | if (empty($all)) { |
1143 | 1349 | $filters = array(); |
@@ -1153,8 +1359,12 @@ discard block |
||
1153 | 1359 | } |
1154 | 1360 | public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
1155 | 1361 | global $globalStatsFilters; |
1156 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1157 | - if ($year == '') $year = date('Y'); |
|
1362 | + if ($filter_name == '') { |
|
1363 | + $filter_name = $this->filter_name; |
|
1364 | + } |
|
1365 | + if ($year == '') { |
|
1366 | + $year = date('Y'); |
|
1367 | + } |
|
1158 | 1368 | $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
1159 | 1369 | if (empty($all)) { |
1160 | 1370 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1173,7 +1383,9 @@ discard block |
||
1173 | 1383 | } |
1174 | 1384 | public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
1175 | 1385 | global $globalStatsFilters; |
1176 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1386 | + if ($filter_name == '') { |
|
1387 | + $filter_name = $this->filter_name; |
|
1388 | + } |
|
1177 | 1389 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1178 | 1390 | $Spotter = new Spotter($this->db); |
1179 | 1391 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1191,7 +1403,9 @@ discard block |
||
1191 | 1403 | } |
1192 | 1404 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1193 | 1405 | $all = $result[0]['nb']; |
1194 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1406 | + } else { |
|
1407 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1408 | + } |
|
1195 | 1409 | } else { |
1196 | 1410 | if ($year == '' && $month == '') { |
1197 | 1411 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1203,7 +1417,9 @@ discard block |
||
1203 | 1417 | } |
1204 | 1418 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1205 | 1419 | $all = $result[0]['nb']; |
1206 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1420 | + } else { |
|
1421 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1422 | + } |
|
1207 | 1423 | } |
1208 | 1424 | if (empty($all)) { |
1209 | 1425 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1222,7 +1438,9 @@ discard block |
||
1222 | 1438 | } |
1223 | 1439 | public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
1224 | 1440 | global $globalStatsFilters; |
1225 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1441 | + if ($filter_name == '') { |
|
1442 | + $filter_name = $this->filter_name; |
|
1443 | + } |
|
1226 | 1444 | if ($year == '' && $month == '') { |
1227 | 1445 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
1228 | 1446 | try { |
@@ -1233,7 +1451,9 @@ discard block |
||
1233 | 1451 | } |
1234 | 1452 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1235 | 1453 | $all = $result[0]['nb_airline']; |
1236 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
1454 | + } else { |
|
1455 | + $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
1456 | + } |
|
1237 | 1457 | if (empty($all)) { |
1238 | 1458 | $filters = array(); |
1239 | 1459 | $filters = array('year' => $year,'month' => $month); |
@@ -1248,7 +1468,9 @@ discard block |
||
1248 | 1468 | } |
1249 | 1469 | public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
1250 | 1470 | global $globalStatsFilters; |
1251 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1471 | + if ($filter_name == '') { |
|
1472 | + $filter_name = $this->filter_name; |
|
1473 | + } |
|
1252 | 1474 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1253 | 1475 | $Spotter = new Spotter($this->db); |
1254 | 1476 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1303,7 +1525,9 @@ discard block |
||
1303 | 1525 | } |
1304 | 1526 | public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
1305 | 1527 | global $globalStatsFilters; |
1306 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1528 | + if ($filter_name == '') { |
|
1529 | + $filter_name = $this->filter_name; |
|
1530 | + } |
|
1307 | 1531 | //if ($year == '') $year = date('Y'); |
1308 | 1532 | if ($year == '' && $month == '') { |
1309 | 1533 | $query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1332,7 +1556,9 @@ discard block |
||
1332 | 1556 | } |
1333 | 1557 | |
1334 | 1558 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
1335 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1559 | + if ($filter_name == '') { |
|
1560 | + $filter_name = $this->filter_name; |
|
1561 | + } |
|
1336 | 1562 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1337 | 1563 | $Spotter = new Spotter($this->db); |
1338 | 1564 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1356,7 +1582,9 @@ discard block |
||
1356 | 1582 | return $all; |
1357 | 1583 | } |
1358 | 1584 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
1359 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1585 | + if ($filter_name == '') { |
|
1586 | + $filter_name = $this->filter_name; |
|
1587 | + } |
|
1360 | 1588 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
1361 | 1589 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
1362 | 1590 | try { |
@@ -1369,7 +1597,9 @@ discard block |
||
1369 | 1597 | return $all; |
1370 | 1598 | } |
1371 | 1599 | public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
1372 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1600 | + if ($filter_name == '') { |
|
1601 | + $filter_name = $this->filter_name; |
|
1602 | + } |
|
1373 | 1603 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1374 | 1604 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
1375 | 1605 | try { |
@@ -1380,7 +1610,9 @@ discard block |
||
1380 | 1610 | } |
1381 | 1611 | } |
1382 | 1612 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
1383 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1613 | + if ($filter_name == '') { |
|
1614 | + $filter_name = $this->filter_name; |
|
1615 | + } |
|
1384 | 1616 | global $globalArchiveMonths, $globalDBdriver; |
1385 | 1617 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1386 | 1618 | $Spotter = new Spotter($this->db); |
@@ -1436,7 +1668,9 @@ discard block |
||
1436 | 1668 | } |
1437 | 1669 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
1438 | 1670 | global $globalArchiveMonths, $globalDBdriver; |
1439 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1671 | + if ($filter_name == '') { |
|
1672 | + $filter_name = $this->filter_name; |
|
1673 | + } |
|
1440 | 1674 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1441 | 1675 | $Spotter = new Spotter($this->db); |
1442 | 1676 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1469,7 +1703,9 @@ discard block |
||
1469 | 1703 | } |
1470 | 1704 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
1471 | 1705 | global $globalArchiveMonths, $globalDBdriver; |
1472 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1706 | + if ($filter_name == '') { |
|
1707 | + $filter_name = $this->filter_name; |
|
1708 | + } |
|
1473 | 1709 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1474 | 1710 | $Spotter = new Spotter($this->db); |
1475 | 1711 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1500,7 +1736,9 @@ discard block |
||
1500 | 1736 | } |
1501 | 1737 | public function getStatsAirlineTotal($filter_name = '') { |
1502 | 1738 | global $globalArchiveMonths, $globalDBdriver; |
1503 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1739 | + if ($filter_name == '') { |
|
1740 | + $filter_name = $this->filter_name; |
|
1741 | + } |
|
1504 | 1742 | if ($globalDBdriver == 'mysql') { |
1505 | 1743 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
1506 | 1744 | } else { |
@@ -1517,7 +1755,9 @@ discard block |
||
1517 | 1755 | } |
1518 | 1756 | public function getStatsOwnerTotal($filter_name = '') { |
1519 | 1757 | global $globalArchiveMonths, $globalDBdriver; |
1520 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1758 | + if ($filter_name == '') { |
|
1759 | + $filter_name = $this->filter_name; |
|
1760 | + } |
|
1521 | 1761 | if ($globalDBdriver == 'mysql') { |
1522 | 1762 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
1523 | 1763 | } else { |
@@ -1534,7 +1774,9 @@ discard block |
||
1534 | 1774 | } |
1535 | 1775 | public function getStatsOwner($owner_name,$filter_name = '') { |
1536 | 1776 | global $globalArchiveMonths, $globalDBdriver; |
1537 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1777 | + if ($filter_name == '') { |
|
1778 | + $filter_name = $this->filter_name; |
|
1779 | + } |
|
1538 | 1780 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
1539 | 1781 | try { |
1540 | 1782 | $sth = $this->db->prepare($query); |
@@ -1543,12 +1785,17 @@ discard block |
||
1543 | 1785 | echo "error : ".$e->getMessage(); |
1544 | 1786 | } |
1545 | 1787 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1546 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1547 | - else return 0; |
|
1788 | + if (isset($all[0]['cnt'])) { |
|
1789 | + return $all[0]['cnt']; |
|
1790 | + } else { |
|
1791 | + return 0; |
|
1792 | + } |
|
1548 | 1793 | } |
1549 | 1794 | public function getStatsPilotTotal($filter_name = '') { |
1550 | 1795 | global $globalArchiveMonths, $globalDBdriver; |
1551 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1796 | + if ($filter_name == '') { |
|
1797 | + $filter_name = $this->filter_name; |
|
1798 | + } |
|
1552 | 1799 | if ($globalDBdriver == 'mysql') { |
1553 | 1800 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
1554 | 1801 | } else { |
@@ -1565,7 +1812,9 @@ discard block |
||
1565 | 1812 | } |
1566 | 1813 | public function getStatsPilot($pilot,$filter_name = '') { |
1567 | 1814 | global $globalArchiveMonths, $globalDBdriver; |
1568 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1815 | + if ($filter_name == '') { |
|
1816 | + $filter_name = $this->filter_name; |
|
1817 | + } |
|
1569 | 1818 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
1570 | 1819 | try { |
1571 | 1820 | $sth = $this->db->prepare($query); |
@@ -1574,13 +1823,18 @@ discard block |
||
1574 | 1823 | echo "error : ".$e->getMessage(); |
1575 | 1824 | } |
1576 | 1825 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1577 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1578 | - else return 0; |
|
1826 | + if (isset($all[0]['cnt'])) { |
|
1827 | + return $all[0]['cnt']; |
|
1828 | + } else { |
|
1829 | + return 0; |
|
1830 | + } |
|
1579 | 1831 | } |
1580 | 1832 | |
1581 | 1833 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
1582 | 1834 | global $globalDBdriver; |
1583 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1835 | + if ($filter_name == '') { |
|
1836 | + $filter_name = $this->filter_name; |
|
1837 | + } |
|
1584 | 1838 | if ($globalDBdriver == 'mysql') { |
1585 | 1839 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
1586 | 1840 | } else { |
@@ -1596,7 +1850,9 @@ discard block |
||
1596 | 1850 | } |
1597 | 1851 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
1598 | 1852 | global $globalDBdriver; |
1599 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1853 | + if ($filter_name == '') { |
|
1854 | + $filter_name = $this->filter_name; |
|
1855 | + } |
|
1600 | 1856 | if ($globalDBdriver == 'mysql') { |
1601 | 1857 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
1602 | 1858 | } else { |
@@ -1982,10 +2238,14 @@ discard block |
||
1982 | 2238 | $Connection = new Connection(); |
1983 | 2239 | date_default_timezone_set('UTC'); |
1984 | 2240 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
1985 | - if ($globalDebug) echo 'Update stats !'."\n"; |
|
2241 | + if ($globalDebug) { |
|
2242 | + echo 'Update stats !'."\n"; |
|
2243 | + } |
|
1986 | 2244 | if (isset($last_update[0]['value'])) { |
1987 | 2245 | $last_update_day = $last_update[0]['value']; |
1988 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
2246 | + } else { |
|
2247 | + $last_update_day = '2012-12-12 12:12:12'; |
|
2248 | + } |
|
1989 | 2249 | $reset = false; |
1990 | 2250 | //if ($globalStatsResetYear && date('Y',strtotime($last_update_day)) != date('Y')) { |
1991 | 2251 | if ($globalStatsResetYear) { |
@@ -1994,43 +2254,63 @@ discard block |
||
1994 | 2254 | } |
1995 | 2255 | $Spotter = new Spotter($this->db); |
1996 | 2256 | |
1997 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
2257 | + if ($globalDebug) { |
|
2258 | + echo 'Count all aircraft types...'."\n"; |
|
2259 | + } |
|
1998 | 2260 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
1999 | 2261 | foreach ($alldata as $number) { |
2000 | 2262 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
2001 | 2263 | } |
2002 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
2264 | + if ($globalDebug) { |
|
2265 | + echo 'Count all airlines...'."\n"; |
|
2266 | + } |
|
2003 | 2267 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
2004 | 2268 | foreach ($alldata as $number) { |
2005 | 2269 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
2006 | 2270 | } |
2007 | - if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
2271 | + if ($globalDebug) { |
|
2272 | + echo 'Count all registrations...'."\n"; |
|
2273 | + } |
|
2008 | 2274 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
2009 | 2275 | foreach ($alldata as $number) { |
2010 | 2276 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
2011 | 2277 | } |
2012 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
2278 | + if ($globalDebug) { |
|
2279 | + echo 'Count all callsigns...'."\n"; |
|
2280 | + } |
|
2013 | 2281 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
2014 | 2282 | foreach ($alldata as $number) { |
2015 | 2283 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
2016 | 2284 | } |
2017 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
2285 | + if ($globalDebug) { |
|
2286 | + echo 'Count all owners...'."\n"; |
|
2287 | + } |
|
2018 | 2288 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
2019 | 2289 | foreach ($alldata as $number) { |
2020 | 2290 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
2021 | 2291 | } |
2022 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
2292 | + if ($globalDebug) { |
|
2293 | + echo 'Count all pilots...'."\n"; |
|
2294 | + } |
|
2023 | 2295 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
2024 | 2296 | foreach ($alldata as $number) { |
2025 | - if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name']; |
|
2297 | + if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') { |
|
2298 | + $number['pilot_id'] = $number['pilot_name']; |
|
2299 | + } |
|
2026 | 2300 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
2027 | 2301 | } |
2028 | 2302 | |
2029 | - if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
2303 | + if ($globalDebug) { |
|
2304 | + echo 'Count all departure airports...'."\n"; |
|
2305 | + } |
|
2030 | 2306 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
2031 | - if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
2307 | + if ($globalDebug) { |
|
2308 | + echo 'Count all detected departure airports...'."\n"; |
|
2309 | + } |
|
2032 | 2310 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
2033 | - if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
2311 | + if ($globalDebug) { |
|
2312 | + echo 'Order departure airports...'."\n"; |
|
2313 | + } |
|
2034 | 2314 | $alldata = array(); |
2035 | 2315 | foreach ($pall as $value) { |
2036 | 2316 | $icao = $value['airport_departure_icao']; |
@@ -2040,7 +2320,9 @@ discard block |
||
2040 | 2320 | $icao = $value['airport_departure_icao']; |
2041 | 2321 | if (isset($alldata[$icao])) { |
2042 | 2322 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
2043 | - } else $alldata[$icao] = $value; |
|
2323 | + } else { |
|
2324 | + $alldata[$icao] = $value; |
|
2325 | + } |
|
2044 | 2326 | } |
2045 | 2327 | $count = array(); |
2046 | 2328 | foreach ($alldata as $key => $row) { |
@@ -2050,11 +2332,17 @@ discard block |
||
2050 | 2332 | foreach ($alldata as $number) { |
2051 | 2333 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
2052 | 2334 | } |
2053 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
2335 | + if ($globalDebug) { |
|
2336 | + echo 'Count all arrival airports...'."\n"; |
|
2337 | + } |
|
2054 | 2338 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
2055 | - if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
2339 | + if ($globalDebug) { |
|
2340 | + echo 'Count all detected arrival airports...'."\n"; |
|
2341 | + } |
|
2056 | 2342 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
2057 | - if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
2343 | + if ($globalDebug) { |
|
2344 | + echo 'Order arrival airports...'."\n"; |
|
2345 | + } |
|
2058 | 2346 | $alldata = array(); |
2059 | 2347 | foreach ($pall as $value) { |
2060 | 2348 | $icao = $value['airport_arrival_icao']; |
@@ -2064,7 +2352,9 @@ discard block |
||
2064 | 2352 | $icao = $value['airport_arrival_icao']; |
2065 | 2353 | if (isset($alldata[$icao])) { |
2066 | 2354 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
2067 | - } else $alldata[$icao] = $value; |
|
2355 | + } else { |
|
2356 | + $alldata[$icao] = $value; |
|
2357 | + } |
|
2068 | 2358 | } |
2069 | 2359 | $count = array(); |
2070 | 2360 | foreach ($alldata as $key => $row) { |
@@ -2075,7 +2365,9 @@ discard block |
||
2075 | 2365 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
2076 | 2366 | } |
2077 | 2367 | if ($Connection->tableExists('countries')) { |
2078 | - if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
2368 | + if ($globalDebug) { |
|
2369 | + echo 'Count all flights by countries...'."\n"; |
|
2370 | + } |
|
2079 | 2371 | //$SpotterArchive = new SpotterArchive(); |
2080 | 2372 | //$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
2081 | 2373 | $Spotter = new Spotter($this->db); |
@@ -2086,7 +2378,9 @@ discard block |
||
2086 | 2378 | } |
2087 | 2379 | |
2088 | 2380 | if (isset($globalAccidents) && $globalAccidents) { |
2089 | - if ($globalDebug) echo 'Count fatalities stats...'."\n"; |
|
2381 | + if ($globalDebug) { |
|
2382 | + echo 'Count fatalities stats...'."\n"; |
|
2383 | + } |
|
2090 | 2384 | $Accident = new Accident(); |
2091 | 2385 | $this->deleteStatsByType('fatalities_byyear'); |
2092 | 2386 | $alldata = $Accident->countFatalitiesByYear(); |
@@ -2102,48 +2396,68 @@ discard block |
||
2102 | 2396 | |
2103 | 2397 | // Add by month using getstat if month finish... |
2104 | 2398 | //if (date('m',strtotime($last_update_day)) != date('m')) { |
2105 | - if ($globalDebug) echo 'Count all flights by months...'."\n"; |
|
2399 | + if ($globalDebug) { |
|
2400 | + echo 'Count all flights by months...'."\n"; |
|
2401 | + } |
|
2106 | 2402 | $last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
2107 | 2403 | $filter_last_month = array('since_date' => $last_month); |
2108 | 2404 | $Spotter = new Spotter($this->db); |
2109 | 2405 | $alldata = $Spotter->countAllMonths($filter_last_month); |
2110 | 2406 | $lastyear = false; |
2111 | 2407 | foreach ($alldata as $number) { |
2112 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
2408 | + if ($number['year_name'] != date('Y')) { |
|
2409 | + $lastyear = true; |
|
2410 | + } |
|
2113 | 2411 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2114 | 2412 | } |
2115 | - if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
2413 | + if ($globalDebug) { |
|
2414 | + echo 'Count all military flights by months...'."\n"; |
|
2415 | + } |
|
2116 | 2416 | $alldata = $Spotter->countAllMilitaryMonths($filter_last_month); |
2117 | 2417 | foreach ($alldata as $number) { |
2118 | 2418 | $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2119 | 2419 | } |
2120 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
2420 | + if ($globalDebug) { |
|
2421 | + echo 'Count all owners by months...'."\n"; |
|
2422 | + } |
|
2121 | 2423 | $alldata = $Spotter->countAllMonthsOwners($filter_last_month); |
2122 | 2424 | foreach ($alldata as $number) { |
2123 | 2425 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2124 | 2426 | } |
2125 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
2427 | + if ($globalDebug) { |
|
2428 | + echo 'Count all pilots by months...'."\n"; |
|
2429 | + } |
|
2126 | 2430 | $alldata = $Spotter->countAllMonthsPilots($filter_last_month); |
2127 | 2431 | foreach ($alldata as $number) { |
2128 | 2432 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2129 | 2433 | } |
2130 | - if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
2434 | + if ($globalDebug) { |
|
2435 | + echo 'Count all airlines by months...'."\n"; |
|
2436 | + } |
|
2131 | 2437 | $alldata = $Spotter->countAllMonthsAirlines($filter_last_month); |
2132 | 2438 | foreach ($alldata as $number) { |
2133 | 2439 | $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2134 | 2440 | } |
2135 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
2441 | + if ($globalDebug) { |
|
2442 | + echo 'Count all aircrafts by months...'."\n"; |
|
2443 | + } |
|
2136 | 2444 | $alldata = $Spotter->countAllMonthsAircrafts($filter_last_month); |
2137 | 2445 | foreach ($alldata as $number) { |
2138 | 2446 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2139 | 2447 | } |
2140 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
2448 | + if ($globalDebug) { |
|
2449 | + echo 'Count all real arrivals by months...'."\n"; |
|
2450 | + } |
|
2141 | 2451 | $alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month); |
2142 | 2452 | foreach ($alldata as $number) { |
2143 | 2453 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2144 | 2454 | } |
2145 | - if ($globalDebug) echo 'Airports data...'."\n"; |
|
2146 | - if ($globalDebug) echo '...Departure'."\n"; |
|
2455 | + if ($globalDebug) { |
|
2456 | + echo 'Airports data...'."\n"; |
|
2457 | + } |
|
2458 | + if ($globalDebug) { |
|
2459 | + echo '...Departure'."\n"; |
|
2460 | + } |
|
2147 | 2461 | $this->deleteStatAirport('daily'); |
2148 | 2462 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
2149 | 2463 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
@@ -2261,7 +2575,9 @@ discard block |
||
2261 | 2575 | // Count by airlines |
2262 | 2576 | echo '--- Stats by airlines ---'."\n"; |
2263 | 2577 | if ($Connection->tableExists('countries')) { |
2264 | - if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
|
2578 | + if ($globalDebug) { |
|
2579 | + echo 'Count all flights by countries by airlines...'."\n"; |
|
2580 | + } |
|
2265 | 2581 | $SpotterArchive = new SpotterArchive(); |
2266 | 2582 | //$Spotter = new Spotter($this->db); |
2267 | 2583 | $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
@@ -2270,37 +2586,53 @@ discard block |
||
2270 | 2586 | $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
2271 | 2587 | } |
2272 | 2588 | } |
2273 | - if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
2589 | + if ($globalDebug) { |
|
2590 | + echo 'Count all aircraft types by airlines...'."\n"; |
|
2591 | + } |
|
2274 | 2592 | $Spotter = new Spotter($this->db); |
2275 | 2593 | $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
2276 | 2594 | foreach ($alldata as $number) { |
2277 | 2595 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
2278 | 2596 | } |
2279 | - if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
2597 | + if ($globalDebug) { |
|
2598 | + echo 'Count all aircraft registrations by airlines...'."\n"; |
|
2599 | + } |
|
2280 | 2600 | $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
2281 | 2601 | foreach ($alldata as $number) { |
2282 | 2602 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
2283 | 2603 | } |
2284 | - if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
2604 | + if ($globalDebug) { |
|
2605 | + echo 'Count all callsigns by airlines...'."\n"; |
|
2606 | + } |
|
2285 | 2607 | $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
2286 | 2608 | foreach ($alldata as $number) { |
2287 | 2609 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
2288 | 2610 | } |
2289 | - if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
2611 | + if ($globalDebug) { |
|
2612 | + echo 'Count all owners by airlines...'."\n"; |
|
2613 | + } |
|
2290 | 2614 | $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
2291 | 2615 | foreach ($alldata as $number) { |
2292 | 2616 | $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
2293 | 2617 | } |
2294 | - if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
2618 | + if ($globalDebug) { |
|
2619 | + echo 'Count all pilots by airlines...'."\n"; |
|
2620 | + } |
|
2295 | 2621 | $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
2296 | 2622 | foreach ($alldata as $number) { |
2297 | 2623 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
2298 | 2624 | } |
2299 | - if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
2625 | + if ($globalDebug) { |
|
2626 | + echo 'Count all departure airports by airlines...'."\n"; |
|
2627 | + } |
|
2300 | 2628 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
2301 | - if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
2629 | + if ($globalDebug) { |
|
2630 | + echo 'Count all detected departure airports by airlines...'."\n"; |
|
2631 | + } |
|
2302 | 2632 | $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
2303 | - if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
2633 | + if ($globalDebug) { |
|
2634 | + echo 'Order detected departure airports by airlines...'."\n"; |
|
2635 | + } |
|
2304 | 2636 | //$alldata = array(); |
2305 | 2637 | foreach ($dall as $value) { |
2306 | 2638 | $icao = $value['airport_departure_icao']; |
@@ -2321,11 +2653,17 @@ discard block |
||
2321 | 2653 | foreach ($alldata as $number) { |
2322 | 2654 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
2323 | 2655 | } |
2324 | - if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
2656 | + if ($globalDebug) { |
|
2657 | + echo 'Count all arrival airports by airlines...'."\n"; |
|
2658 | + } |
|
2325 | 2659 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
2326 | - if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
2660 | + if ($globalDebug) { |
|
2661 | + echo 'Count all detected arrival airports by airlines...'."\n"; |
|
2662 | + } |
|
2327 | 2663 | $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
2328 | - if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
2664 | + if ($globalDebug) { |
|
2665 | + echo 'Order arrival airports by airlines...'."\n"; |
|
2666 | + } |
|
2329 | 2667 | //$alldata = array(); |
2330 | 2668 | foreach ($dall as $value) { |
2331 | 2669 | $icao = $value['airport_arrival_icao']; |
@@ -2344,37 +2682,53 @@ discard block |
||
2344 | 2682 | } |
2345 | 2683 | $alldata = $pall; |
2346 | 2684 | foreach ($alldata as $number) { |
2347 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
2685 | + if ($number['airline_icao'] != '') { |
|
2686 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
2687 | + } |
|
2688 | + } |
|
2689 | + if ($globalDebug) { |
|
2690 | + echo 'Count all flights by months by airlines...'."\n"; |
|
2348 | 2691 | } |
2349 | - if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
2350 | 2692 | $Spotter = new Spotter($this->db); |
2351 | 2693 | $alldata = $Spotter->countAllMonthsByAirlines($filter_last_month); |
2352 | 2694 | $lastyear = false; |
2353 | 2695 | foreach ($alldata as $number) { |
2354 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
2696 | + if ($number['year_name'] != date('Y')) { |
|
2697 | + $lastyear = true; |
|
2698 | + } |
|
2355 | 2699 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
2356 | 2700 | } |
2357 | - if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
2701 | + if ($globalDebug) { |
|
2702 | + echo 'Count all owners by months by airlines...'."\n"; |
|
2703 | + } |
|
2358 | 2704 | $alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month); |
2359 | 2705 | foreach ($alldata as $number) { |
2360 | 2706 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
2361 | 2707 | } |
2362 | - if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
2708 | + if ($globalDebug) { |
|
2709 | + echo 'Count all pilots by months by airlines...'."\n"; |
|
2710 | + } |
|
2363 | 2711 | $alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month); |
2364 | 2712 | foreach ($alldata as $number) { |
2365 | 2713 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
2366 | 2714 | } |
2367 | - if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
2715 | + if ($globalDebug) { |
|
2716 | + echo 'Count all aircrafts by months by airlines...'."\n"; |
|
2717 | + } |
|
2368 | 2718 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month); |
2369 | 2719 | foreach ($alldata as $number) { |
2370 | 2720 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
2371 | 2721 | } |
2372 | - if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
2722 | + if ($globalDebug) { |
|
2723 | + echo 'Count all real arrivals by months by airlines...'."\n"; |
|
2724 | + } |
|
2373 | 2725 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month); |
2374 | 2726 | foreach ($alldata as $number) { |
2375 | 2727 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
2376 | 2728 | } |
2377 | - if ($globalDebug) echo '...Departure'."\n"; |
|
2729 | + if ($globalDebug) { |
|
2730 | + echo '...Departure'."\n"; |
|
2731 | + } |
|
2378 | 2732 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
2379 | 2733 | $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
2380 | 2734 | foreach ($dall as $value) { |
@@ -2397,7 +2751,9 @@ discard block |
||
2397 | 2751 | foreach ($alldata as $number) { |
2398 | 2752 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
2399 | 2753 | } |
2400 | - if ($globalDebug) echo '...Arrival'."\n"; |
|
2754 | + if ($globalDebug) { |
|
2755 | + echo '...Arrival'."\n"; |
|
2756 | + } |
|
2401 | 2757 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
2402 | 2758 | $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
2403 | 2759 | foreach ($dall as $value) { |
@@ -2421,13 +2777,19 @@ discard block |
||
2421 | 2777 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
2422 | 2778 | } |
2423 | 2779 | |
2424 | - if ($globalDebug) echo 'Flights data...'."\n"; |
|
2425 | - if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
2780 | + if ($globalDebug) { |
|
2781 | + echo 'Flights data...'."\n"; |
|
2782 | + } |
|
2783 | + if ($globalDebug) { |
|
2784 | + echo '-> countAllDatesLastMonth...'."\n"; |
|
2785 | + } |
|
2426 | 2786 | $alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month); |
2427 | 2787 | foreach ($alldata as $number) { |
2428 | 2788 | $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
2429 | 2789 | } |
2430 | - if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
2790 | + if ($globalDebug) { |
|
2791 | + echo '-> countAllDates...'."\n"; |
|
2792 | + } |
|
2431 | 2793 | //$previousdata = $this->countAllDatesByAirlines(); |
2432 | 2794 | $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month)); |
2433 | 2795 | $values = array(); |
@@ -2440,21 +2802,27 @@ discard block |
||
2440 | 2802 | $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
2441 | 2803 | } |
2442 | 2804 | |
2443 | - if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
2805 | + if ($globalDebug) { |
|
2806 | + echo '-> countAllHours...'."\n"; |
|
2807 | + } |
|
2444 | 2808 | $alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month); |
2445 | 2809 | foreach ($alldata as $number) { |
2446 | 2810 | $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
2447 | 2811 | } |
2448 | 2812 | |
2449 | 2813 | // Stats by filters |
2450 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
2814 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
2815 | + $globalStatsFilters = array(); |
|
2816 | + } |
|
2451 | 2817 | foreach ($globalStatsFilters as $name => $filter) { |
2452 | 2818 | //$filter_name = $filter['name']; |
2453 | 2819 | $filter_name = $name; |
2454 | 2820 | $reset = false; |
2455 | 2821 | $last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name); |
2456 | 2822 | if (isset($filter['resetall']) && isset($last_update[0]['value']) && strtotime($filter['resetall']) > strtotime($last_update[0]['value'])) { |
2457 | - if ($globalDebug) echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
2823 | + if ($globalDebug) { |
|
2824 | + echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
2825 | + } |
|
2458 | 2826 | $this->deleteOldStats($filter_name); |
2459 | 2827 | unset($last_update); |
2460 | 2828 | } |
@@ -2473,7 +2841,9 @@ discard block |
||
2473 | 2841 | |
2474 | 2842 | |
2475 | 2843 | // Count by filter |
2476 | - if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
2844 | + if ($globalDebug) { |
|
2845 | + echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
2846 | + } |
|
2477 | 2847 | $Spotter = new Spotter($this->db); |
2478 | 2848 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
2479 | 2849 | foreach ($alldata as $number) { |
@@ -2510,7 +2880,9 @@ discard block |
||
2510 | 2880 | $icao = $value['airport_departure_icao']; |
2511 | 2881 | if (isset($alldata[$icao])) { |
2512 | 2882 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
2513 | - } else $alldata[$icao] = $value; |
|
2883 | + } else { |
|
2884 | + $alldata[$icao] = $value; |
|
2885 | + } |
|
2514 | 2886 | } |
2515 | 2887 | $count = array(); |
2516 | 2888 | foreach ($alldata as $key => $row) { |
@@ -2531,7 +2903,9 @@ discard block |
||
2531 | 2903 | $icao = $value['airport_arrival_icao']; |
2532 | 2904 | if (isset($alldata[$icao])) { |
2533 | 2905 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
2534 | - } else $alldata[$icao] = $value; |
|
2906 | + } else { |
|
2907 | + $alldata[$icao] = $value; |
|
2908 | + } |
|
2535 | 2909 | } |
2536 | 2910 | $count = array(); |
2537 | 2911 | foreach ($alldata as $key => $row) { |
@@ -2545,7 +2919,9 @@ discard block |
||
2545 | 2919 | $alldata = $Spotter->countAllMonths($filter); |
2546 | 2920 | $lastyear = false; |
2547 | 2921 | foreach ($alldata as $number) { |
2548 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
2922 | + if ($number['year_name'] != date('Y')) { |
|
2923 | + $lastyear = true; |
|
2924 | + } |
|
2549 | 2925 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
2550 | 2926 | } |
2551 | 2927 | $alldata = $Spotter->countAllMonthsOwners($filter); |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | } |
43 | 43 | $Stats = new Stats(); |
44 | 44 | $airline_names = $Stats->getAllAirlineNames(); |
45 | - if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
|
45 | + if (empty($airline_names)) { |
|
46 | + $airline_names = $Spotter->getAllAirlineNames(); |
|
47 | + } |
|
46 | 48 | foreach($airline_names as $airline_name) |
47 | 49 | { |
48 | 50 | if($airline == $airline_name['airline_icao']) |
@@ -65,8 +67,7 @@ discard block |
||
65 | 67 | if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif')) |
66 | 68 | { |
67 | 69 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
68 | - } |
|
69 | - elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
70 | + } elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
70 | 71 | { |
71 | 72 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
72 | 73 | } |
@@ -41,7 +41,9 @@ discard block |
||
41 | 41 | } |
42 | 42 | $Stats = new Stats(); |
43 | 43 | $airline_names = $Stats->getAllAirlineNames(); |
44 | - if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
|
44 | + if (empty($airline_names)) { |
|
45 | + $airline_names = $Spotter->getAllAirlineNames(); |
|
46 | + } |
|
45 | 47 | foreach($airline_names as $airline_name) |
46 | 48 | { |
47 | 49 | if($_GET['airline'] == $airline_name['airline_icao']) |
@@ -64,8 +66,7 @@ discard block |
||
64 | 66 | if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif')) |
65 | 67 | { |
66 | 68 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
67 | - } |
|
68 | - elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
69 | + } elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
69 | 70 | { |
70 | 71 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
71 | 72 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $limit_start = 0; |
15 | 15 | $limit_end = 25; |
16 | 16 | $absolute_difference = 25; |
17 | - } else { |
|
17 | + } else { |
|
18 | 18 | $limit_explode = explode(",", $_GET['limit']); |
19 | 19 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
20 | 20 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -46,7 +46,9 @@ discard block |
||
46 | 46 | } else { |
47 | 47 | if (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) { |
48 | 48 | $title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
49 | - } else $title = ''; |
|
49 | + } else { |
|
50 | + $title = ''; |
|
51 | + } |
|
50 | 52 | } |
51 | 53 | require_once('header.php'); |
52 | 54 | |
@@ -67,7 +69,9 @@ discard block |
||
67 | 69 | } |
68 | 70 | $Stats = new Stats(); |
69 | 71 | $airline_names = $Stats->getAllAirlineNames(); |
70 | - if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
|
72 | + if (empty($airline_names)) { |
|
73 | + $airline_names = $Spotter->getAllAirlineNames(); |
|
74 | + } |
|
71 | 75 | foreach($airline_names as $airline_name) |
72 | 76 | { |
73 | 77 | if($airline == $airline_name['airline_icao']) |
@@ -97,10 +101,16 @@ discard block |
||
97 | 101 | print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['airline_name'].'</div>'; |
98 | 102 | print '<div><span class="label">'._("Country").'</span>'.$spotter_array[0]['airline_country'].'</div>'; |
99 | 103 | print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['airline_icao'].'</div>'; |
100 | - if (isset($spotter_array[0]['airline_iata'])) print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>'; |
|
101 | - if (isset($spotter_array[0]['airline_callsign'])) print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>'; |
|
104 | + if (isset($spotter_array[0]['airline_iata'])) { |
|
105 | + print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>'; |
|
106 | + } |
|
107 | + if (isset($spotter_array[0]['airline_callsign'])) { |
|
108 | + print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>'; |
|
109 | + } |
|
102 | 110 | print '<div><span class="label">'._("Type").'</span>'.ucwords($spotter_array[0]['airline_type']).'</div>'; |
103 | - if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>'; |
|
111 | + if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) { |
|
112 | + print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>'; |
|
113 | + } |
|
104 | 114 | print '</div>'; |
105 | 115 | } else { |
106 | 116 | print '<div class="info column">'; |
@@ -31,7 +31,9 @@ discard block |
||
31 | 31 | if (@getimagesize('images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png') || @getimagesize($globalURL.'/images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png')) |
32 | 32 | { |
33 | 33 | print '<img src="'.$globalURL.'/images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png" alt="'._("Click to see alliance activity").'" title="'._("Click to see alliance activity").'" /> '; |
34 | - } else print $alliance['alliance']; |
|
34 | + } else { |
|
35 | + print $alliance['alliance']; |
|
36 | + } |
|
35 | 37 | print '</a>'; |
36 | 38 | print '</div>'; |
37 | 39 | } |
@@ -40,13 +42,21 @@ discard block |
||
40 | 42 | } |
41 | 43 | print '<div class="select-item"><form action="'.$globalURL.'/airline" method="post"><select name="airline_type" class="selectpicker" data-live-search="true">'; |
42 | 44 | print '<option value="all"'; |
43 | - if ($airline_type == 'all') print 'selected="selected" '; |
|
45 | + if ($airline_type == 'all') { |
|
46 | + print 'selected="selected" '; |
|
47 | + } |
|
44 | 48 | print '>'._("All").'</option><option value="passenger"'; |
45 | - if ($airline_type == 'passenger') print 'selected="selected" '; |
|
49 | + if ($airline_type == 'passenger') { |
|
50 | + print 'selected="selected" '; |
|
51 | + } |
|
46 | 52 | print '>'._("Passenger").'</option><option value="cargo"'; |
47 | - if ($airline_type == 'cargo') print 'selected="selected" '; |
|
53 | + if ($airline_type == 'cargo') { |
|
54 | + print 'selected="selected" '; |
|
55 | + } |
|
48 | 56 | print '>'._("Cargo").'</option><option value="military"'; |
49 | - if ($airline_type == 'military') print 'selected="selected" '; |
|
57 | + if ($airline_type == 'military') { |
|
58 | + print 'selected="selected" '; |
|
59 | + } |
|
50 | 60 | print '>'._("Military").'</option></select>'; |
51 | 61 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button></form></div>'; |
52 | 62 | |
@@ -73,7 +83,9 @@ discard block |
||
73 | 83 | $firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8'); |
74 | 84 | if($previous !== $firstLetter) |
75 | 85 | { |
76 | - if ($previous !== null) print ' | '; |
|
86 | + if ($previous !== null) { |
|
87 | + print ' | '; |
|
88 | + } |
|
77 | 89 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
78 | 90 | } |
79 | 91 | $previous = $firstLetter; |
@@ -86,7 +98,9 @@ discard block |
||
86 | 98 | { |
87 | 99 | if($previous !== $firstLetter) |
88 | 100 | { |
89 | - if ($previous !== null) print '</div>'; |
|
101 | + if ($previous !== null) { |
|
102 | + print '</div>'; |
|
103 | + } |
|
90 | 104 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
91 | 105 | } |
92 | 106 | $previous = $firstLetter; |
@@ -98,10 +112,14 @@ discard block |
||
98 | 112 | } elseif (@getimagesize('images/airlines/'.$value['airline_icao'].'.png') || @getimagesize($globalURL.'/images/airlines/'.$value['airline_icao'].'.png')) |
99 | 113 | { |
100 | 114 | print '<img src="'.$globalURL.'/images/airlines/'.$value['airline_icao'].'.png" alt="'._("Click to see airline activity").'" title="'._("Click to see airline activity").'" /> '; |
101 | - if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> '; |
|
115 | + if (isset($value['ban_eu']) && $value['ban_eu'] == 1) { |
|
116 | + print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> '; |
|
117 | + } |
|
102 | 118 | } else { |
103 | 119 | print $value['airline_name']; |
104 | - if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> '; |
|
120 | + if (isset($value['ban_eu']) && $value['ban_eu'] == 1) { |
|
121 | + print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> '; |
|
122 | + } |
|
105 | 123 | } |
106 | 124 | print '</a>'; |
107 | 125 | print '</div>'; |
@@ -41,7 +41,9 @@ discard block |
||
41 | 41 | } |
42 | 42 | $Stats = new Stats(); |
43 | 43 | $airline_names = $Stats->getAllAirlineNames(); |
44 | - if (empty($ariline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
|
44 | + if (empty($ariline_names)) { |
|
45 | + $airline_names = $Spotter->getAllAirlineNames(); |
|
46 | + } |
|
45 | 47 | foreach($airline_names as $airline_name) |
46 | 48 | { |
47 | 49 | if($_GET['airline'] == $airline_name['airline_icao']) |
@@ -64,8 +66,7 @@ discard block |
||
64 | 66 | if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif')) |
65 | 67 | { |
66 | 68 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
67 | - } |
|
68 | - elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
69 | + } elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
69 | 70 | { |
70 | 71 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
71 | 72 | } |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | } |
43 | 43 | $Stats = new Stats(); |
44 | 44 | $airline_names = $Stats->getAllAirlineNames(); |
45 | - if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
|
45 | + if (empty($airline_names)) { |
|
46 | + $airline_names = $Spotter->getAllAirlineNames(); |
|
47 | + } |
|
46 | 48 | foreach($airline_names as $airline_name) |
47 | 49 | { |
48 | 50 | if($airline == $airline_name['airline_icao']) |
@@ -65,8 +67,7 @@ discard block |
||
65 | 67 | if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif')) |
66 | 68 | { |
67 | 69 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
68 | - } |
|
69 | - elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
70 | + } elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
70 | 71 | { |
71 | 72 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
72 | 73 | } |