@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | $this->db = $Connection->db(); |
18 | 18 | } |
19 | 19 | |
20 | - public function addLastStatsUpdate($type,$stats_date) { |
|
20 | + public function addLastStatsUpdate($type, $stats_date) { |
|
21 | 21 | $query = "DELETE FROM config WHERE name = :type; |
22 | 22 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
23 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
23 | + $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
24 | 24 | try { |
25 | 25 | $sth = $this->db->prepare($query); |
26 | 26 | $sth->execute($query_values); |
27 | - } catch(PDOException $e) { |
|
27 | + } catch (PDOException $e) { |
|
28 | 28 | return "error : ".$e->getMessage(); |
29 | 29 | } |
30 | 30 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | try { |
35 | 35 | $sth = $this->db->prepare($query); |
36 | 36 | $sth->execute(array(':type' => $type)); |
37 | - } catch(PDOException $e) { |
|
37 | + } catch (PDOException $e) { |
|
38 | 38 | echo "error : ".$e->getMessage(); |
39 | 39 | } |
40 | 40 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | try { |
55 | 55 | $sth = $this->db->prepare($query); |
56 | 56 | $sth->execute(array(':filter_name' => $filter_name)); |
57 | - } catch(PDOException $e) { |
|
57 | + } catch (PDOException $e) { |
|
58 | 58 | return "error : ".$e->getMessage(); |
59 | 59 | } |
60 | 60 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | try { |
65 | 65 | $sth = $this->db->prepare($query); |
66 | 66 | $sth->execute(); |
67 | - } catch(PDOException $e) { |
|
67 | + } catch (PDOException $e) { |
|
68 | 68 | return "error : ".$e->getMessage(); |
69 | 69 | } |
70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | try { |
73 | 73 | $sth = $this->db->prepare($query); |
74 | 74 | $sth->execute(array(':filter_name' => $filter_name)); |
75 | - } catch(PDOException $e) { |
|
75 | + } catch (PDOException $e) { |
|
76 | 76 | return "error : ".$e->getMessage(); |
77 | 77 | } |
78 | 78 | } |
@@ -82,69 +82,69 @@ discard block |
||
82 | 82 | try { |
83 | 83 | $sth = $this->db->prepare($query); |
84 | 84 | $sth->execute(array(':filter_name' => $filter_name)); |
85 | - } catch(PDOException $e) { |
|
85 | + } catch (PDOException $e) { |
|
86 | 86 | echo "error : ".$e->getMessage(); |
87 | 87 | } |
88 | 88 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
89 | 89 | return $all; |
90 | 90 | } |
91 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
91 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
92 | 92 | if ($filter_name == '') $filter_name = $this->filter_name; |
93 | 93 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
94 | 94 | try { |
95 | 95 | $sth = $this->db->prepare($query); |
96 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
97 | - } catch(PDOException $e) { |
|
96 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
97 | + } catch (PDOException $e) { |
|
98 | 98 | echo "error : ".$e->getMessage(); |
99 | 99 | } |
100 | 100 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
101 | 101 | return $all; |
102 | 102 | } |
103 | - public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
103 | + public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
|
104 | 104 | if ($filter_name == '') $filter_name = $this->filter_name; |
105 | 105 | $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"; |
106 | 106 | try { |
107 | 107 | $sth = $this->db->prepare($query); |
108 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
109 | - } catch(PDOException $e) { |
|
108 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
109 | + } catch (PDOException $e) { |
|
110 | 110 | echo "error : ".$e->getMessage(); |
111 | 111 | } |
112 | 112 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
113 | 113 | return $all; |
114 | 114 | } |
115 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
115 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
116 | 116 | if ($filter_name == '') $filter_name = $this->filter_name; |
117 | 117 | $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"; |
118 | 118 | try { |
119 | 119 | $sth = $this->db->prepare($query); |
120 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
121 | - } catch(PDOException $e) { |
|
120 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
121 | + } catch (PDOException $e) { |
|
122 | 122 | echo "error : ".$e->getMessage(); |
123 | 123 | } |
124 | 124 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
125 | 125 | return $all; |
126 | 126 | } |
127 | 127 | |
128 | - public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
|
128 | + public function getAllOwnerNames($stats_airline = '', $filter_name = '') { |
|
129 | 129 | if ($filter_name == '') $filter_name = $this->filter_name; |
130 | 130 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
131 | 131 | try { |
132 | 132 | $sth = $this->db->prepare($query); |
133 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
134 | - } catch(PDOException $e) { |
|
133 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
134 | + } catch (PDOException $e) { |
|
135 | 135 | echo "error : ".$e->getMessage(); |
136 | 136 | } |
137 | 137 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
138 | 138 | return $all; |
139 | 139 | } |
140 | 140 | |
141 | - public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
|
141 | + public function getAllPilotNames($stats_airline = '', $filter_name = '') { |
|
142 | 142 | if ($filter_name == '') $filter_name = $this->filter_name; |
143 | 143 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
144 | 144 | try { |
145 | 145 | $sth = $this->db->prepare($query); |
146 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
147 | - } catch(PDOException $e) { |
|
146 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
147 | + } catch (PDOException $e) { |
|
148 | 148 | echo "error : ".$e->getMessage(); |
149 | 149 | } |
150 | 150 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | |
155 | - public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
155 | + public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
156 | 156 | global $globalStatsFilters; |
157 | 157 | if ($filter_name == '') $filter_name = $this->filter_name; |
158 | 158 | if ($year == '' && $month == '') { |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | 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"; |
161 | 161 | try { |
162 | 162 | $sth = $this->db->prepare($query); |
163 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
164 | - } catch(PDOException $e) { |
|
163 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
164 | + } catch (PDOException $e) { |
|
165 | 165 | echo "error : ".$e->getMessage(); |
166 | 166 | } |
167 | 167 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | if (empty($all)) { |
170 | 170 | $filters = array('airlines' => array($stats_airline)); |
171 | 171 | if ($filter_name != '') { |
172 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
172 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
173 | 173 | } |
174 | 174 | $Spotter = new Spotter($this->db); |
175 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
|
175 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters, $year, $month); |
|
176 | 176 | } |
177 | 177 | return $all; |
178 | 178 | } |
179 | - public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
|
179 | + public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
|
180 | 180 | global $globalStatsFilters; |
181 | 181 | if ($filter_name == '') $filter_name = $this->filter_name; |
182 | 182 | if ($year == '' && $month == '') { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | try { |
186 | 186 | $sth = $this->db->prepare($query); |
187 | 187 | $sth->execute(array(':filter_name' => $filter_name)); |
188 | - } catch(PDOException $e) { |
|
188 | + } catch (PDOException $e) { |
|
189 | 189 | echo "error : ".$e->getMessage(); |
190 | 190 | } |
191 | 191 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | $Spotter = new Spotter($this->db); |
195 | 195 | $filters = array(); |
196 | 196 | if ($filter_name != '') { |
197 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
197 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
198 | 198 | } |
199 | - $all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
|
199 | + $all = $Spotter->countAllAirlineCountries($limit, $filters, $year, $month); |
|
200 | 200 | } |
201 | 201 | return $all; |
202 | 202 | } |
203 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
203 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
204 | 204 | global $globalStatsFilters; |
205 | 205 | if ($filter_name == '') $filter_name = $this->filter_name; |
206 | 206 | if ($year == '' && $month == '') { |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | 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"; |
209 | 209 | try { |
210 | 210 | $sth = $this->db->prepare($query); |
211 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
212 | - } catch(PDOException $e) { |
|
211 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
212 | + } catch (PDOException $e) { |
|
213 | 213 | echo "error : ".$e->getMessage(); |
214 | 214 | } |
215 | 215 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | if (empty($all)) { |
218 | 218 | $filters = array('airlines' => array($stats_airline)); |
219 | 219 | if ($filter_name != '') { |
220 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
220 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
221 | 221 | } |
222 | 222 | $Spotter = new Spotter($this->db); |
223 | - $all = $Spotter->countAllAircraftManufacturers($filters,$year,$month); |
|
223 | + $all = $Spotter->countAllAircraftManufacturers($filters, $year, $month); |
|
224 | 224 | } |
225 | 225 | return $all; |
226 | 226 | } |
227 | 227 | |
228 | - public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
228 | + public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
229 | 229 | global $globalStatsFilters; |
230 | 230 | if ($filter_name == '') $filter_name = $this->filter_name; |
231 | 231 | if ($year == '' && $month == '') { |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
234 | 234 | try { |
235 | 235 | $sth = $this->db->prepare($query); |
236 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
237 | - } catch(PDOException $e) { |
|
236 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
237 | + } catch (PDOException $e) { |
|
238 | 238 | echo "error : ".$e->getMessage(); |
239 | 239 | } |
240 | 240 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | if (empty($all)) { |
243 | 243 | $filters = array('airlines' => array($stats_airline)); |
244 | 244 | if ($filter_name != '') { |
245 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
245 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
246 | 246 | } |
247 | 247 | $Spotter = new Spotter($this->db); |
248 | - $all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
|
248 | + $all = $Spotter->countAllArrivalCountries($limit, $filters, $year, $month); |
|
249 | 249 | } |
250 | 250 | return $all; |
251 | 251 | } |
@@ -256,23 +256,23 @@ discard block |
||
256 | 256 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
257 | 257 | try { |
258 | 258 | $sth = $this->db->prepare($query); |
259 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
260 | - } catch(PDOException $e) { |
|
259 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
260 | + } catch (PDOException $e) { |
|
261 | 261 | echo "error : ".$e->getMessage(); |
262 | 262 | } |
263 | 263 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
264 | 264 | if (empty($all)) { |
265 | 265 | $filters = array('airlines' => array($stats_airline)); |
266 | 266 | if ($filter_name != '') { |
267 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
267 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
268 | 268 | } |
269 | 269 | $Spotter = new Spotter($this->db); |
270 | - $all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
|
270 | + $all = $Spotter->countAllDepartureCountries($filters, $year, $month); |
|
271 | 271 | } |
272 | 272 | return $all; |
273 | 273 | } |
274 | 274 | |
275 | - public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
|
275 | + public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') { |
|
276 | 276 | global $globalStatsFilters; |
277 | 277 | if ($filter_name == '') $filter_name = $this->filter_name; |
278 | 278 | if ($year == '' && $month == '') { |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | if (isset($forsource)) { |
282 | 282 | 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"; |
283 | 283 | 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"; |
284 | - $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
|
284 | + $query_values = array(':filter_name' => $filter_name, ':forsource' => $forsource); |
|
285 | 285 | } else { |
286 | 286 | 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"; |
287 | 287 | 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"; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | try { |
291 | 291 | $sth = $this->db->prepare($query); |
292 | 292 | $sth->execute($query_values); |
293 | - } catch(PDOException $e) { |
|
293 | + } catch (PDOException $e) { |
|
294 | 294 | echo "error : ".$e->getMessage(); |
295 | 295 | } |
296 | 296 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -299,13 +299,13 @@ discard block |
||
299 | 299 | $Spotter = new Spotter($this->db); |
300 | 300 | $filters = array(); |
301 | 301 | if ($filter_name != '') { |
302 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
302 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
303 | 303 | } |
304 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
|
304 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters, $year, $month); |
|
305 | 305 | } |
306 | 306 | return $all; |
307 | 307 | } |
308 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
308 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
309 | 309 | global $globalStatsFilters; |
310 | 310 | if ($filter_name == '') $filter_name = $this->filter_name; |
311 | 311 | if ($year == '' && $month == '') { |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | 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"; |
314 | 314 | try { |
315 | 315 | $sth = $this->db->prepare($query); |
316 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
317 | - } catch(PDOException $e) { |
|
316 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
317 | + } catch (PDOException $e) { |
|
318 | 318 | echo "error : ".$e->getMessage(); |
319 | 319 | } |
320 | 320 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | if (empty($all)) { |
323 | 323 | $filters = array('airlines' => array($stats_airline)); |
324 | 324 | if ($filter_name != '') { |
325 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
325 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
326 | 326 | } |
327 | 327 | $Spotter = new Spotter($this->db); |
328 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
|
328 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters, $year, $month); |
|
329 | 329 | } |
330 | 330 | return $all; |
331 | 331 | } |
332 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
332 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
333 | 333 | global $globalStatsFilters; |
334 | 334 | if ($filter_name == '') $filter_name = $this->filter_name; |
335 | 335 | if ($year == '' && $month == '') { |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | 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"; |
338 | 338 | try { |
339 | 339 | $sth = $this->db->prepare($query); |
340 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
341 | - } catch(PDOException $e) { |
|
340 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
341 | + } catch (PDOException $e) { |
|
342 | 342 | echo "error : ".$e->getMessage(); |
343 | 343 | } |
344 | 344 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -346,14 +346,14 @@ discard block |
||
346 | 346 | if (empty($all)) { |
347 | 347 | $filters = array('airlines' => array($stats_airline)); |
348 | 348 | if ($filter_name != '') { |
349 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
349 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
350 | 350 | } |
351 | 351 | $Spotter = new Spotter($this->db); |
352 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month); |
|
352 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters, $year, $month); |
|
353 | 353 | } |
354 | 354 | return $all; |
355 | 355 | } |
356 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
356 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
357 | 357 | $Connection = new Connection(); |
358 | 358 | if ($filter_name == '') $filter_name = $this->filter_name; |
359 | 359 | if ($Connection->tableExists('countries')) { |
@@ -362,8 +362,8 @@ discard block |
||
362 | 362 | 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"; |
363 | 363 | try { |
364 | 364 | $sth = $this->db->prepare($query); |
365 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
366 | - } catch(PDOException $e) { |
|
365 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
366 | + } catch (PDOException $e) { |
|
367 | 367 | echo "error : ".$e->getMessage(); |
368 | 368 | } |
369 | 369 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | return array(); |
380 | 380 | } |
381 | 381 | } |
382 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
|
382 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
383 | 383 | global $globalStatsFilters; |
384 | 384 | if ($filter_name == '') $filter_name = $this->filter_name; |
385 | 385 | if ($year == '' && $month == '') { |
@@ -387,8 +387,8 @@ discard block |
||
387 | 387 | 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"; |
388 | 388 | try { |
389 | 389 | $sth = $this->db->prepare($query); |
390 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
391 | - } catch(PDOException $e) { |
|
390 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
391 | + } catch (PDOException $e) { |
|
392 | 392 | echo "error : ".$e->getMessage(); |
393 | 393 | } |
394 | 394 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -396,15 +396,15 @@ discard block |
||
396 | 396 | if (empty($all)) { |
397 | 397 | $filters = array('airlines' => array($stats_airline)); |
398 | 398 | if ($filter_name != '') { |
399 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
399 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
400 | 400 | } |
401 | 401 | $Spotter = new Spotter($this->db); |
402 | - $all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month); |
|
402 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters, $year, $month); |
|
403 | 403 | } |
404 | 404 | return $all; |
405 | 405 | } |
406 | 406 | |
407 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
407 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
408 | 408 | global $globalStatsFilters; |
409 | 409 | if ($filter_name == '') $filter_name = $this->filter_name; |
410 | 410 | if ($year == '' && $month == '') { |
@@ -412,8 +412,8 @@ discard block |
||
412 | 412 | 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"; |
413 | 413 | try { |
414 | 414 | $sth = $this->db->prepare($query); |
415 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
416 | - } catch(PDOException $e) { |
|
415 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
416 | + } catch (PDOException $e) { |
|
417 | 417 | echo "error : ".$e->getMessage(); |
418 | 418 | } |
419 | 419 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -421,14 +421,14 @@ discard block |
||
421 | 421 | if (empty($all)) { |
422 | 422 | $filters = array('airlines' => array($stats_airline)); |
423 | 423 | if ($filter_name != '') { |
424 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
424 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
425 | 425 | } |
426 | 426 | $Spotter = new Spotter($this->db); |
427 | - $all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
|
427 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters, $year, $month); |
|
428 | 428 | } |
429 | 429 | return $all; |
430 | 430 | } |
431 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
431 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
432 | 432 | global $globalStatsFilters; |
433 | 433 | if ($filter_name == '') $filter_name = $this->filter_name; |
434 | 434 | if ($year == '' && $month == '') { |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | 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 FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
437 | 437 | try { |
438 | 438 | $sth = $this->db->prepare($query); |
439 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
440 | - } catch(PDOException $e) { |
|
439 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
440 | + } catch (PDOException $e) { |
|
441 | 441 | echo "error : ".$e->getMessage(); |
442 | 442 | } |
443 | 443 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -445,11 +445,11 @@ discard block |
||
445 | 445 | if (empty($all)) { |
446 | 446 | $filters = array('airlines' => array($stats_airline)); |
447 | 447 | if ($filter_name != '') { |
448 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
448 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
449 | 449 | } |
450 | 450 | $Spotter = new Spotter($this->db); |
451 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
|
452 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
|
451 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters, $year, $month); |
|
452 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters, $year, $month); |
|
453 | 453 | $all = array(); |
454 | 454 | foreach ($pall as $value) { |
455 | 455 | $icao = $value['airport_departure_icao']; |
@@ -466,11 +466,11 @@ discard block |
||
466 | 466 | foreach ($all as $key => $row) { |
467 | 467 | $count[$key] = $row['airport_departure_icao_count']; |
468 | 468 | } |
469 | - array_multisort($count,SORT_DESC,$all); |
|
469 | + array_multisort($count, SORT_DESC, $all); |
|
470 | 470 | } |
471 | 471 | return $all; |
472 | 472 | } |
473 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
473 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
474 | 474 | global $globalStatsFilters; |
475 | 475 | if ($filter_name == '') $filter_name = $this->filter_name; |
476 | 476 | if ($year == '' && $month == '') { |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | 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 FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
479 | 479 | try { |
480 | 480 | $sth = $this->db->prepare($query); |
481 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
482 | - } catch(PDOException $e) { |
|
481 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
482 | + } catch (PDOException $e) { |
|
483 | 483 | echo "error : ".$e->getMessage(); |
484 | 484 | } |
485 | 485 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -487,11 +487,11 @@ discard block |
||
487 | 487 | if (empty($all)) { |
488 | 488 | $filters = array('airlines' => array($stats_airline)); |
489 | 489 | if ($filter_name != '') { |
490 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
490 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
491 | 491 | } |
492 | 492 | $Spotter = new Spotter($this->db); |
493 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month); |
|
494 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
|
493 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters, $year, $month); |
|
494 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters, $year, $month); |
|
495 | 495 | $all = array(); |
496 | 496 | foreach ($pall as $value) { |
497 | 497 | $icao = $value['airport_arrival_icao']; |
@@ -508,12 +508,12 @@ discard block |
||
508 | 508 | foreach ($all as $key => $row) { |
509 | 509 | $count[$key] = $row['airport_arrival_icao_count']; |
510 | 510 | } |
511 | - array_multisort($count,SORT_DESC,$all); |
|
511 | + array_multisort($count, SORT_DESC, $all); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | return $all; |
515 | 515 | } |
516 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
516 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
517 | 517 | global $globalDBdriver, $globalStatsFilters; |
518 | 518 | if ($filter_name == '') $filter_name = $this->filter_name; |
519 | 519 | if ($globalDBdriver == 'mysql') { |
@@ -523,18 +523,18 @@ discard block |
||
523 | 523 | 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"; |
524 | 524 | 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"; |
525 | 525 | } |
526 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
526 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
527 | 527 | try { |
528 | 528 | $sth = $this->db->prepare($query); |
529 | 529 | $sth->execute($query_data); |
530 | - } catch(PDOException $e) { |
|
530 | + } catch (PDOException $e) { |
|
531 | 531 | echo "error : ".$e->getMessage(); |
532 | 532 | } |
533 | 533 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
534 | 534 | if (empty($all)) { |
535 | 535 | $filters = array('airlines' => array($stats_airline)); |
536 | 536 | if ($filter_name != '') { |
537 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
537 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
538 | 538 | } |
539 | 539 | $Spotter = new Spotter($this->db); |
540 | 540 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -543,29 +543,29 @@ discard block |
||
543 | 543 | return $all; |
544 | 544 | } |
545 | 545 | |
546 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
546 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
547 | 547 | global $globalStatsFilters; |
548 | 548 | if ($filter_name == '') $filter_name = $this->filter_name; |
549 | 549 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
550 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
550 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
551 | 551 | try { |
552 | 552 | $sth = $this->db->prepare($query); |
553 | 553 | $sth->execute($query_data); |
554 | - } catch(PDOException $e) { |
|
554 | + } catch (PDOException $e) { |
|
555 | 555 | echo "error : ".$e->getMessage(); |
556 | 556 | } |
557 | 557 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
558 | 558 | if (empty($all)) { |
559 | 559 | $filters = array('airlines' => array($stats_airline)); |
560 | 560 | if ($filter_name != '') { |
561 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
561 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
562 | 562 | } |
563 | 563 | $Spotter = new Spotter($this->db); |
564 | 564 | $all = $Spotter->countAllDatesLastMonth($filters); |
565 | 565 | } |
566 | 566 | return $all; |
567 | 567 | } |
568 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
568 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
569 | 569 | global $globalDBdriver, $globalStatsFilters; |
570 | 570 | if ($filter_name == '') $filter_name = $this->filter_name; |
571 | 571 | if ($globalDBdriver == 'mysql') { |
@@ -573,40 +573,40 @@ discard block |
||
573 | 573 | } else { |
574 | 574 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
575 | 575 | } |
576 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
576 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
577 | 577 | try { |
578 | 578 | $sth = $this->db->prepare($query); |
579 | 579 | $sth->execute($query_data); |
580 | - } catch(PDOException $e) { |
|
580 | + } catch (PDOException $e) { |
|
581 | 581 | echo "error : ".$e->getMessage(); |
582 | 582 | } |
583 | 583 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
584 | 584 | if (empty($all)) { |
585 | 585 | $filters = array('airlines' => array($stats_airline)); |
586 | 586 | if ($filter_name != '') { |
587 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
587 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
588 | 588 | } |
589 | 589 | $Spotter = new Spotter($this->db); |
590 | 590 | $all = $Spotter->countAllDatesLast7Days($filters); |
591 | 591 | } |
592 | 592 | return $all; |
593 | 593 | } |
594 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
594 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
595 | 595 | global $globalStatsFilters; |
596 | 596 | if ($filter_name == '') $filter_name = $this->filter_name; |
597 | 597 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
598 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
598 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
599 | 599 | try { |
600 | 600 | $sth = $this->db->prepare($query); |
601 | 601 | $sth->execute($query_data); |
602 | - } catch(PDOException $e) { |
|
602 | + } catch (PDOException $e) { |
|
603 | 603 | echo "error : ".$e->getMessage(); |
604 | 604 | } |
605 | 605 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
606 | 606 | if (empty($all)) { |
607 | 607 | $filters = array('airlines' => array($stats_airline)); |
608 | 608 | if ($filter_name != '') { |
609 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
609 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
610 | 610 | } |
611 | 611 | $Spotter = new Spotter($this->db); |
612 | 612 | $all = $Spotter->countAllDates($filters); |
@@ -621,28 +621,28 @@ discard block |
||
621 | 621 | try { |
622 | 622 | $sth = $this->db->prepare($query); |
623 | 623 | $sth->execute($query_data); |
624 | - } catch(PDOException $e) { |
|
624 | + } catch (PDOException $e) { |
|
625 | 625 | echo "error : ".$e->getMessage(); |
626 | 626 | } |
627 | 627 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
628 | 628 | if (empty($all)) { |
629 | 629 | $filters = array(); |
630 | 630 | if ($filter_name != '') { |
631 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
631 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
632 | 632 | } |
633 | 633 | $Spotter = new Spotter($this->db); |
634 | 634 | $all = $Spotter->countAllDatesByAirlines($filters); |
635 | 635 | } |
636 | 636 | return $all; |
637 | 637 | } |
638 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
638 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
639 | 639 | global $globalStatsFilters; |
640 | 640 | if ($filter_name == '') $filter_name = $this->filter_name; |
641 | 641 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
642 | 642 | try { |
643 | 643 | $sth = $this->db->prepare($query); |
644 | 644 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
645 | - } catch(PDOException $e) { |
|
645 | + } catch (PDOException $e) { |
|
646 | 646 | echo "error : ".$e->getMessage(); |
647 | 647 | } |
648 | 648 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | if (empty($all)) { |
651 | 651 | $filters = array('airlines' => array($stats_airline)); |
652 | 652 | if ($filter_name != '') { |
653 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
653 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
654 | 654 | } |
655 | 655 | $Spotter = new Spotter($this->db); |
656 | 656 | $all = $Spotter->countAllMonths($filters); |
@@ -665,21 +665,21 @@ discard block |
||
665 | 665 | try { |
666 | 666 | $sth = $this->db->prepare($query); |
667 | 667 | $sth->execute(array(':filter_name' => $filter_name)); |
668 | - } catch(PDOException $e) { |
|
668 | + } catch (PDOException $e) { |
|
669 | 669 | echo "error : ".$e->getMessage(); |
670 | 670 | } |
671 | 671 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
672 | 672 | if (empty($all)) { |
673 | 673 | $filters = array(); |
674 | 674 | if ($filter_name != '') { |
675 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
675 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
676 | 676 | } |
677 | 677 | $Spotter = new Spotter($this->db); |
678 | 678 | $all = $Spotter->countAllMilitaryMonths($filters); |
679 | 679 | } |
680 | 680 | return $all; |
681 | 681 | } |
682 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
682 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
683 | 683 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
684 | 684 | if ($filter_name == '') $filter_name = $this->filter_name; |
685 | 685 | 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"; |
@@ -696,91 +696,91 @@ discard block |
||
696 | 696 | try { |
697 | 697 | $sth = $this->db->prepare($query); |
698 | 698 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
699 | - } catch(PDOException $e) { |
|
699 | + } catch (PDOException $e) { |
|
700 | 700 | echo "error : ".$e->getMessage(); |
701 | 701 | } |
702 | 702 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
703 | 703 | if (empty($all)) { |
704 | 704 | $filters = array('airlines' => array($stats_airline)); |
705 | 705 | if ($filter_name != '') { |
706 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
706 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
707 | 707 | } |
708 | 708 | $Spotter = new Spotter($this->db); |
709 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
709 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
710 | 710 | } |
711 | 711 | return $all; |
712 | 712 | } |
713 | 713 | |
714 | - public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
714 | + public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
715 | 715 | global $globalStatsFilters; |
716 | 716 | if ($filter_name == '') $filter_name = $this->filter_name; |
717 | 717 | if ($year == '') $year = date('Y'); |
718 | - $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
|
718 | + $all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month); |
|
719 | 719 | if (empty($all)) { |
720 | 720 | $filters = array('airlines' => array($stats_airline)); |
721 | 721 | if ($filter_name != '') { |
722 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
722 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
723 | 723 | } |
724 | 724 | $Spotter = new Spotter($this->db); |
725 | - $all = $Spotter->countOverallFlights($filters,$year,$month); |
|
725 | + $all = $Spotter->countOverallFlights($filters, $year, $month); |
|
726 | 726 | } |
727 | 727 | return $all; |
728 | 728 | } |
729 | - public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
|
729 | + public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') { |
|
730 | 730 | global $globalStatsFilters; |
731 | 731 | if ($filter_name == '') $filter_name = $this->filter_name; |
732 | 732 | if ($year == '') $year = date('Y'); |
733 | - $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
|
733 | + $all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month); |
|
734 | 734 | if (empty($all)) { |
735 | 735 | $filters = array(); |
736 | 736 | if ($filter_name != '') { |
737 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
737 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
738 | 738 | } |
739 | 739 | $Spotter = new Spotter($this->db); |
740 | - $all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
|
740 | + $all = $Spotter->countOverallMilitaryFlights($filters, $year, $month); |
|
741 | 741 | } |
742 | 742 | return $all; |
743 | 743 | } |
744 | - public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
|
744 | + public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
745 | 745 | global $globalStatsFilters; |
746 | 746 | if ($filter_name == '') $filter_name = $this->filter_name; |
747 | 747 | if ($year == '') $year = date('Y'); |
748 | - $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
|
748 | + $all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month); |
|
749 | 749 | if (empty($all)) { |
750 | 750 | $filters = array('airlines' => array($stats_airline)); |
751 | 751 | if ($filter_name != '') { |
752 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
752 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
753 | 753 | } |
754 | 754 | $Spotter = new Spotter($this->db); |
755 | - $all = $Spotter->countOverallArrival($filters,$year,$month); |
|
755 | + $all = $Spotter->countOverallArrival($filters, $year, $month); |
|
756 | 756 | } |
757 | 757 | return $all; |
758 | 758 | } |
759 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
759 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
760 | 760 | global $globalStatsFilters; |
761 | 761 | if ($filter_name == '') $filter_name = $this->filter_name; |
762 | 762 | if ($year == '' && $month == '') { |
763 | 763 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
764 | 764 | try { |
765 | 765 | $sth = $this->db->prepare($query); |
766 | - $sth->execute(array(':filter_name' => $filter_name,':stats_airline' => $stats_airline)); |
|
767 | - } catch(PDOException $e) { |
|
766 | + $sth->execute(array(':filter_name' => $filter_name, ':stats_airline' => $stats_airline)); |
|
767 | + } catch (PDOException $e) { |
|
768 | 768 | echo "error : ".$e->getMessage(); |
769 | 769 | } |
770 | 770 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
771 | 771 | $all = $result[0]['nb']; |
772 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
772 | + } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
773 | 773 | if (empty($all)) { |
774 | 774 | $filters = array('airlines' => array($stats_airline)); |
775 | 775 | if ($filter_name != '') { |
776 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
776 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
777 | 777 | } |
778 | 778 | $Spotter = new Spotter($this->db); |
779 | - $all = $Spotter->countOverallAircrafts($filters,$year,$month); |
|
779 | + $all = $Spotter->countOverallAircrafts($filters, $year, $month); |
|
780 | 780 | } |
781 | 781 | return $all; |
782 | 782 | } |
783 | - public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
|
783 | + public function countOverallAirlines($filter_name = '', $year = '', $month = '') { |
|
784 | 784 | global $globalStatsFilters; |
785 | 785 | if ($filter_name == '') $filter_name = $this->filter_name; |
786 | 786 | if ($year == '' && $month == '') { |
@@ -788,23 +788,23 @@ discard block |
||
788 | 788 | try { |
789 | 789 | $sth = $this->db->prepare($query); |
790 | 790 | $sth->execute(array(':filter_name' => $filter_name)); |
791 | - } catch(PDOException $e) { |
|
791 | + } catch (PDOException $e) { |
|
792 | 792 | echo "error : ".$e->getMessage(); |
793 | 793 | } |
794 | 794 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
795 | 795 | $all = $result[0]['nb_airline']; |
796 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
796 | + } else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month); |
|
797 | 797 | if (empty($all)) { |
798 | 798 | $filters = array(); |
799 | 799 | if ($filter_name != '') { |
800 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
800 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
801 | 801 | } |
802 | 802 | $Spotter = new Spotter($this->db); |
803 | - $all = $Spotter->countOverallAirlines($filters,$year,$month); |
|
803 | + $all = $Spotter->countOverallAirlines($filters, $year, $month); |
|
804 | 804 | } |
805 | 805 | return $all; |
806 | 806 | } |
807 | - public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
807 | + public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
808 | 808 | global $globalStatsFilters; |
809 | 809 | if ($filter_name == '') $filter_name = $this->filter_name; |
810 | 810 | if ($year == '' && $month == '') { |
@@ -813,25 +813,25 @@ discard block |
||
813 | 813 | try { |
814 | 814 | $sth = $this->db->prepare($query); |
815 | 815 | $sth->execute($query_values); |
816 | - } catch(PDOException $e) { |
|
816 | + } catch (PDOException $e) { |
|
817 | 817 | echo "error : ".$e->getMessage(); |
818 | 818 | } |
819 | 819 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
820 | 820 | $all = $result[0]['nb']; |
821 | 821 | } else { |
822 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
822 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
823 | 823 | } |
824 | 824 | if (empty($all)) { |
825 | 825 | $filters = array('airlines' => array($stats_airline)); |
826 | 826 | if ($filter_name != '') { |
827 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
827 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
828 | 828 | } |
829 | 829 | $Spotter = new Spotter($this->db); |
830 | - $all = $Spotter->countOverallOwners($filters,$year,$month); |
|
830 | + $all = $Spotter->countOverallOwners($filters, $year, $month); |
|
831 | 831 | } |
832 | 832 | return $all; |
833 | 833 | } |
834 | - public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
834 | + public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
835 | 835 | global $globalStatsFilters; |
836 | 836 | if ($filter_name == '') $filter_name = $this->filter_name; |
837 | 837 | //if ($year == '') $year = date('Y'); |
@@ -841,75 +841,75 @@ discard block |
||
841 | 841 | try { |
842 | 842 | $sth = $this->db->prepare($query); |
843 | 843 | $sth->execute($query_values); |
844 | - } catch(PDOException $e) { |
|
844 | + } catch (PDOException $e) { |
|
845 | 845 | echo "error : ".$e->getMessage(); |
846 | 846 | } |
847 | 847 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
848 | 848 | $all = $result[0]['nb']; |
849 | 849 | } else { |
850 | - $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
|
850 | + $all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month); |
|
851 | 851 | } |
852 | 852 | if (empty($all)) { |
853 | 853 | $filters = array('airlines' => array($stats_airline)); |
854 | 854 | if ($filter_name != '') { |
855 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
855 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
856 | 856 | } |
857 | 857 | $Spotter = new Spotter($this->db); |
858 | - $all = $Spotter->countOverallPilots($filters,$year,$month); |
|
858 | + $all = $Spotter->countOverallPilots($filters, $year, $month); |
|
859 | 859 | } |
860 | 860 | return $all; |
861 | 861 | } |
862 | 862 | |
863 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
863 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
864 | 864 | if ($filter_name == '') $filter_name = $this->filter_name; |
865 | 865 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
866 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
866 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
867 | 867 | try { |
868 | 868 | $sth = $this->db->prepare($query); |
869 | 869 | $sth->execute($query_values); |
870 | - } catch(PDOException $e) { |
|
870 | + } catch (PDOException $e) { |
|
871 | 871 | echo "error : ".$e->getMessage(); |
872 | 872 | } |
873 | 873 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
874 | 874 | return $all; |
875 | 875 | } |
876 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
876 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
877 | 877 | if ($filter_name == '') $filter_name = $this->filter_name; |
878 | 878 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
879 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
879 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
880 | 880 | try { |
881 | 881 | $sth = $this->db->prepare($query); |
882 | 882 | $sth->execute($query_values); |
883 | - } catch(PDOException $e) { |
|
883 | + } catch (PDOException $e) { |
|
884 | 884 | echo "error : ".$e->getMessage(); |
885 | 885 | } |
886 | 886 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
887 | 887 | return $all; |
888 | 888 | } |
889 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
|
889 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') { |
|
890 | 890 | if ($filter_name == '') $filter_name = $this->filter_name; |
891 | 891 | global $globalArchiveMonths, $globalDBdriver; |
892 | 892 | if ($globalDBdriver == 'mysql') { |
893 | 893 | if ($month == '') { |
894 | 894 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
895 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
895 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
896 | 896 | } else { |
897 | 897 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
898 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
898 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
899 | 899 | } |
900 | 900 | } else { |
901 | 901 | if ($month == '') { |
902 | 902 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
903 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
903 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
904 | 904 | } else { |
905 | 905 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
906 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
906 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
907 | 907 | } |
908 | 908 | } |
909 | 909 | try { |
910 | 910 | $sth = $this->db->prepare($query); |
911 | 911 | $sth->execute($query_values); |
912 | - } catch(PDOException $e) { |
|
912 | + } catch (PDOException $e) { |
|
913 | 913 | echo "error : ".$e->getMessage(); |
914 | 914 | } |
915 | 915 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | try { |
928 | 928 | $sth = $this->db->prepare($query); |
929 | 929 | $sth->execute($query_values); |
930 | - } catch(PDOException $e) { |
|
930 | + } catch (PDOException $e) { |
|
931 | 931 | echo "error : ".$e->getMessage(); |
932 | 932 | } |
933 | 933 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | try { |
945 | 945 | $sth = $this->db->prepare($query); |
946 | 946 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
947 | - } catch(PDOException $e) { |
|
947 | + } catch (PDOException $e) { |
|
948 | 948 | echo "error : ".$e->getMessage(); |
949 | 949 | } |
950 | 950 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | try { |
962 | 962 | $sth = $this->db->prepare($query); |
963 | 963 | $sth->execute(array(':filter_name' => $filter_name)); |
964 | - } catch(PDOException $e) { |
|
964 | + } catch (PDOException $e) { |
|
965 | 965 | echo "error : ".$e->getMessage(); |
966 | 966 | } |
967 | 967 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -978,20 +978,20 @@ discard block |
||
978 | 978 | try { |
979 | 979 | $sth = $this->db->prepare($query); |
980 | 980 | $sth->execute(array(':filter_name' => $filter_name)); |
981 | - } catch(PDOException $e) { |
|
981 | + } catch (PDOException $e) { |
|
982 | 982 | echo "error : ".$e->getMessage(); |
983 | 983 | } |
984 | 984 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
985 | 985 | return $all[0]['total']; |
986 | 986 | } |
987 | - public function getStatsOwner($owner_name,$filter_name = '') { |
|
987 | + public function getStatsOwner($owner_name, $filter_name = '') { |
|
988 | 988 | global $globalArchiveMonths, $globalDBdriver; |
989 | 989 | if ($filter_name == '') $filter_name = $this->filter_name; |
990 | 990 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
991 | 991 | try { |
992 | 992 | $sth = $this->db->prepare($query); |
993 | - $sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name)); |
|
994 | - } catch(PDOException $e) { |
|
993 | + $sth->execute(array(':filter_name' => $filter_name, ':owner_name' => $owner_name)); |
|
994 | + } catch (PDOException $e) { |
|
995 | 995 | echo "error : ".$e->getMessage(); |
996 | 996 | } |
997 | 997 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1009,20 +1009,20 @@ discard block |
||
1009 | 1009 | try { |
1010 | 1010 | $sth = $this->db->prepare($query); |
1011 | 1011 | $sth->execute(array(':filter_name' => $filter_name)); |
1012 | - } catch(PDOException $e) { |
|
1012 | + } catch (PDOException $e) { |
|
1013 | 1013 | echo "error : ".$e->getMessage(); |
1014 | 1014 | } |
1015 | 1015 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1016 | 1016 | return $all[0]['total']; |
1017 | 1017 | } |
1018 | - public function getStatsPilot($pilot,$filter_name = '') { |
|
1018 | + public function getStatsPilot($pilot, $filter_name = '') { |
|
1019 | 1019 | global $globalArchiveMonths, $globalDBdriver; |
1020 | 1020 | if ($filter_name == '') $filter_name = $this->filter_name; |
1021 | 1021 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
1022 | 1022 | try { |
1023 | 1023 | $sth = $this->db->prepare($query); |
1024 | - $sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot)); |
|
1025 | - } catch(PDOException $e) { |
|
1024 | + $sth->execute(array(':filter_name' => $filter_name, ':pilot' => $pilot)); |
|
1025 | + } catch (PDOException $e) { |
|
1026 | 1026 | echo "error : ".$e->getMessage(); |
1027 | 1027 | } |
1028 | 1028 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | else return 0; |
1031 | 1031 | } |
1032 | 1032 | |
1033 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1033 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
1034 | 1034 | global $globalDBdriver; |
1035 | 1035 | if ($filter_name == '') $filter_name = $this->filter_name; |
1036 | 1036 | if ($globalDBdriver == 'mysql') { |
@@ -1038,15 +1038,15 @@ discard block |
||
1038 | 1038 | } else { |
1039 | 1039 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1040 | 1040 | } |
1041 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1041 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1042 | 1042 | try { |
1043 | 1043 | $sth = $this->db->prepare($query); |
1044 | 1044 | $sth->execute($query_values); |
1045 | - } catch(PDOException $e) { |
|
1045 | + } catch (PDOException $e) { |
|
1046 | 1046 | return "error : ".$e->getMessage(); |
1047 | 1047 | } |
1048 | 1048 | } |
1049 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1049 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
1050 | 1050 | global $globalDBdriver; |
1051 | 1051 | if ($filter_name == '') $filter_name = $this->filter_name; |
1052 | 1052 | if ($globalDBdriver == 'mysql') { |
@@ -1055,11 +1055,11 @@ discard block |
||
1055 | 1055 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
1056 | 1056 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1057 | 1057 | } |
1058 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1058 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1059 | 1059 | try { |
1060 | 1060 | $sth = $this->db->prepare($query); |
1061 | 1061 | $sth->execute($query_values); |
1062 | - } catch(PDOException $e) { |
|
1062 | + } catch (PDOException $e) { |
|
1063 | 1063 | return "error : ".$e->getMessage(); |
1064 | 1064 | } |
1065 | 1065 | } |
@@ -1083,75 +1083,75 @@ discard block |
||
1083 | 1083 | } |
1084 | 1084 | */ |
1085 | 1085 | |
1086 | - public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
|
1086 | + public function getStatsSource($stats_type, $year = '', $month = '', $day = '') { |
|
1087 | 1087 | global $globalDBdriver; |
1088 | 1088 | $query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
1089 | 1089 | $query_values = array(); |
1090 | 1090 | if ($globalDBdriver == 'mysql') { |
1091 | 1091 | if ($year != '') { |
1092 | 1092 | $query .= ' AND YEAR(stats_date) = :year'; |
1093 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1093 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1094 | 1094 | } |
1095 | 1095 | if ($month != '') { |
1096 | 1096 | $query .= ' AND MONTH(stats_date) = :month'; |
1097 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1097 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1098 | 1098 | } |
1099 | 1099 | if ($day != '') { |
1100 | 1100 | $query .= ' AND DAY(stats_date) = :day'; |
1101 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1101 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1102 | 1102 | } |
1103 | 1103 | } else { |
1104 | 1104 | if ($year != '') { |
1105 | 1105 | $query .= ' AND EXTRACT(YEAR FROM stats_date) = :year'; |
1106 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1106 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1107 | 1107 | } |
1108 | 1108 | if ($month != '') { |
1109 | 1109 | $query .= ' AND EXTRACT(MONTH FROM stats_date) = :month'; |
1110 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1110 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1111 | 1111 | } |
1112 | 1112 | if ($day != '') { |
1113 | 1113 | $query .= ' AND EXTRACT(DAY FROM stats_date) = :day'; |
1114 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1114 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1115 | 1115 | } |
1116 | 1116 | } |
1117 | 1117 | $query .= " ORDER BY source_name"; |
1118 | - $query_values = array_merge($query_values,array(':stats_type' => $stats_type)); |
|
1118 | + $query_values = array_merge($query_values, array(':stats_type' => $stats_type)); |
|
1119 | 1119 | try { |
1120 | 1120 | $sth = $this->db->prepare($query); |
1121 | 1121 | $sth->execute($query_values); |
1122 | - } catch(PDOException $e) { |
|
1122 | + } catch (PDOException $e) { |
|
1123 | 1123 | echo "error : ".$e->getMessage(); |
1124 | 1124 | } |
1125 | 1125 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1126 | 1126 | return $all; |
1127 | 1127 | } |
1128 | 1128 | |
1129 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
1129 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
1130 | 1130 | global $globalDBdriver; |
1131 | 1131 | if ($globalDBdriver == 'mysql') { |
1132 | 1132 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
1133 | 1133 | } else { |
1134 | 1134 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
1135 | 1135 | } |
1136 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
1136 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
1137 | 1137 | try { |
1138 | 1138 | $sth = $this->db->prepare($query); |
1139 | 1139 | $sth->execute($query_values); |
1140 | - } catch(PDOException $e) { |
|
1140 | + } catch (PDOException $e) { |
|
1141 | 1141 | return "error : ".$e->getMessage(); |
1142 | 1142 | } |
1143 | 1143 | } |
1144 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
1144 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
1145 | 1145 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
1146 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1146 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1147 | 1147 | try { |
1148 | 1148 | $sth = $this->db->prepare($query); |
1149 | 1149 | $sth->execute($query_values); |
1150 | - } catch(PDOException $e) { |
|
1150 | + } catch (PDOException $e) { |
|
1151 | 1151 | return "error : ".$e->getMessage(); |
1152 | 1152 | } |
1153 | 1153 | } |
1154 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
|
1154 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1155 | 1155 | global $globalDBdriver; |
1156 | 1156 | if ($globalDBdriver == 'mysql') { |
1157 | 1157 | if ($reset) { |
@@ -1166,15 +1166,15 @@ discard block |
||
1166 | 1166 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1167 | 1167 | } |
1168 | 1168 | } |
1169 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1169 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1170 | 1170 | try { |
1171 | 1171 | $sth = $this->db->prepare($query); |
1172 | 1172 | $sth->execute($query_values); |
1173 | - } catch(PDOException $e) { |
|
1173 | + } catch (PDOException $e) { |
|
1174 | 1174 | return "error : ".$e->getMessage(); |
1175 | 1175 | } |
1176 | 1176 | } |
1177 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
|
1177 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1178 | 1178 | global $globalDBdriver; |
1179 | 1179 | if ($globalDBdriver == 'mysql') { |
1180 | 1180 | if ($reset) { |
@@ -1189,15 +1189,15 @@ discard block |
||
1189 | 1189 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
1190 | 1190 | } |
1191 | 1191 | } |
1192 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1192 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1193 | 1193 | try { |
1194 | 1194 | $sth = $this->db->prepare($query); |
1195 | 1195 | $sth->execute($query_values); |
1196 | - } catch(PDOException $e) { |
|
1196 | + } catch (PDOException $e) { |
|
1197 | 1197 | return "error : ".$e->getMessage(); |
1198 | 1198 | } |
1199 | 1199 | } |
1200 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1200 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1201 | 1201 | global $globalDBdriver; |
1202 | 1202 | if ($globalDBdriver == 'mysql') { |
1203 | 1203 | if ($reset) { |
@@ -1212,15 +1212,15 @@ discard block |
||
1212 | 1212 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline; INSERT INTO stats_country (iso2,iso3,name,cnt,stats_airline,filter_name) SELECT :iso2,:iso3,:name,:cnt,:airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline);"; |
1213 | 1213 | } |
1214 | 1214 | } |
1215 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
1215 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name, ':airline' => $airline_icao); |
|
1216 | 1216 | try { |
1217 | 1217 | $sth = $this->db->prepare($query); |
1218 | 1218 | $sth->execute($query_values); |
1219 | - } catch(PDOException $e) { |
|
1219 | + } catch (PDOException $e) { |
|
1220 | 1220 | return "error : ".$e->getMessage(); |
1221 | 1221 | } |
1222 | 1222 | } |
1223 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1223 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1224 | 1224 | global $globalDBdriver; |
1225 | 1225 | if ($globalDBdriver == 'mysql') { |
1226 | 1226 | if ($reset) { |
@@ -1235,15 +1235,15 @@ discard block |
||
1235 | 1235 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1236 | 1236 | } |
1237 | 1237 | } |
1238 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1238 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1239 | 1239 | try { |
1240 | 1240 | $sth = $this->db->prepare($query); |
1241 | 1241 | $sth->execute($query_values); |
1242 | - } catch(PDOException $e) { |
|
1242 | + } catch (PDOException $e) { |
|
1243 | 1243 | return "error : ".$e->getMessage(); |
1244 | 1244 | } |
1245 | 1245 | } |
1246 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
|
1246 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) { |
|
1247 | 1247 | global $globalDBdriver; |
1248 | 1248 | if ($globalDBdriver == 'mysql') { |
1249 | 1249 | if ($reset) { |
@@ -1258,15 +1258,15 @@ discard block |
||
1258 | 1258 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
1259 | 1259 | } |
1260 | 1260 | } |
1261 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1261 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1262 | 1262 | try { |
1263 | 1263 | $sth = $this->db->prepare($query); |
1264 | 1264 | $sth->execute($query_values); |
1265 | - } catch(PDOException $e) { |
|
1265 | + } catch (PDOException $e) { |
|
1266 | 1266 | return "error : ".$e->getMessage(); |
1267 | 1267 | } |
1268 | 1268 | } |
1269 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
|
1269 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) { |
|
1270 | 1270 | global $globalDBdriver; |
1271 | 1271 | if ($globalDBdriver == 'mysql') { |
1272 | 1272 | if ($reset) { |
@@ -1281,15 +1281,15 @@ discard block |
||
1281 | 1281 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1282 | 1282 | } |
1283 | 1283 | } |
1284 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1284 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1285 | 1285 | try { |
1286 | 1286 | $sth = $this->db->prepare($query); |
1287 | 1287 | $sth->execute($query_values); |
1288 | - } catch(PDOException $e) { |
|
1288 | + } catch (PDOException $e) { |
|
1289 | 1289 | return "error : ".$e->getMessage(); |
1290 | 1290 | } |
1291 | 1291 | } |
1292 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
|
1292 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) { |
|
1293 | 1293 | global $globalDBdriver; |
1294 | 1294 | if ($globalDBdriver == 'mysql') { |
1295 | 1295 | if ($reset) { |
@@ -1304,15 +1304,15 @@ discard block |
||
1304 | 1304 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; |
1305 | 1305 | } |
1306 | 1306 | } |
1307 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
1307 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source); |
|
1308 | 1308 | try { |
1309 | 1309 | $sth = $this->db->prepare($query); |
1310 | 1310 | $sth->execute($query_values); |
1311 | - } catch(PDOException $e) { |
|
1311 | + } catch (PDOException $e) { |
|
1312 | 1312 | return "error : ".$e->getMessage(); |
1313 | 1313 | } |
1314 | 1314 | } |
1315 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1315 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1316 | 1316 | global $globalDBdriver; |
1317 | 1317 | if ($airport_icao != '') { |
1318 | 1318 | if ($globalDBdriver == 'mysql') { |
@@ -1328,16 +1328,16 @@ discard block |
||
1328 | 1328 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1329 | 1329 | } |
1330 | 1330 | } |
1331 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1331 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1332 | 1332 | try { |
1333 | 1333 | $sth = $this->db->prepare($query); |
1334 | 1334 | $sth->execute($query_values); |
1335 | - } catch(PDOException $e) { |
|
1335 | + } catch (PDOException $e) { |
|
1336 | 1336 | return "error : ".$e->getMessage(); |
1337 | 1337 | } |
1338 | 1338 | } |
1339 | 1339 | } |
1340 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1340 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1341 | 1341 | global $globalDBdriver; |
1342 | 1342 | if ($airport_icao != '') { |
1343 | 1343 | if ($globalDBdriver == 'mysql') { |
@@ -1345,16 +1345,16 @@ discard block |
||
1345 | 1345 | } else { |
1346 | 1346 | $query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1347 | 1347 | } |
1348 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1348 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1349 | 1349 | try { |
1350 | 1350 | $sth = $this->db->prepare($query); |
1351 | 1351 | $sth->execute($query_values); |
1352 | - } catch(PDOException $e) { |
|
1352 | + } catch (PDOException $e) { |
|
1353 | 1353 | return "error : ".$e->getMessage(); |
1354 | 1354 | } |
1355 | 1355 | } |
1356 | 1356 | } |
1357 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1357 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1358 | 1358 | global $globalDBdriver; |
1359 | 1359 | if ($airport_icao != '') { |
1360 | 1360 | if ($globalDBdriver == 'mysql') { |
@@ -1370,16 +1370,16 @@ discard block |
||
1370 | 1370 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1371 | 1371 | } |
1372 | 1372 | } |
1373 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1373 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1374 | 1374 | try { |
1375 | 1375 | $sth = $this->db->prepare($query); |
1376 | 1376 | $sth->execute($query_values); |
1377 | - } catch(PDOException $e) { |
|
1377 | + } catch (PDOException $e) { |
|
1378 | 1378 | return "error : ".$e->getMessage(); |
1379 | 1379 | } |
1380 | 1380 | } |
1381 | 1381 | } |
1382 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1382 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1383 | 1383 | global $globalDBdriver; |
1384 | 1384 | if ($airport_icao != '') { |
1385 | 1385 | if ($globalDBdriver == 'mysql') { |
@@ -1387,11 +1387,11 @@ discard block |
||
1387 | 1387 | } else { |
1388 | 1388 | $query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1389 | 1389 | } |
1390 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1390 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1391 | 1391 | try { |
1392 | 1392 | $sth = $this->db->prepare($query); |
1393 | 1393 | $sth->execute($query_values); |
1394 | - } catch(PDOException $e) { |
|
1394 | + } catch (PDOException $e) { |
|
1395 | 1395 | return "error : ".$e->getMessage(); |
1396 | 1396 | } |
1397 | 1397 | } |
@@ -1403,7 +1403,7 @@ discard block |
||
1403 | 1403 | try { |
1404 | 1404 | $sth = $this->db->prepare($query); |
1405 | 1405 | $sth->execute($query_values); |
1406 | - } catch(PDOException $e) { |
|
1406 | + } catch (PDOException $e) { |
|
1407 | 1407 | return "error : ".$e->getMessage(); |
1408 | 1408 | } |
1409 | 1409 | } |
@@ -1413,7 +1413,7 @@ discard block |
||
1413 | 1413 | try { |
1414 | 1414 | $sth = $this->db->prepare($query); |
1415 | 1415 | $sth->execute($query_values); |
1416 | - } catch(PDOException $e) { |
|
1416 | + } catch (PDOException $e) { |
|
1417 | 1417 | return "error : ".$e->getMessage(); |
1418 | 1418 | } |
1419 | 1419 | } |
@@ -1423,13 +1423,13 @@ discard block |
||
1423 | 1423 | try { |
1424 | 1424 | $sth = $this->db->prepare($query); |
1425 | 1425 | $sth->execute($query_values); |
1426 | - } catch(PDOException $e) { |
|
1426 | + } catch (PDOException $e) { |
|
1427 | 1427 | return "error : ".$e->getMessage(); |
1428 | 1428 | } |
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | public function addOldStats() { |
1432 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear; |
|
1432 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear; |
|
1433 | 1433 | $Common = new Common(); |
1434 | 1434 | $Connection = new Connection(); |
1435 | 1435 | date_default_timezone_set('UTC'); |
@@ -1446,40 +1446,40 @@ discard block |
||
1446 | 1446 | $Spotter = new Spotter($this->db); |
1447 | 1447 | |
1448 | 1448 | if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
1449 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1449 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
1450 | 1450 | foreach ($alldata as $number) { |
1451 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
|
1451 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset); |
|
1452 | 1452 | } |
1453 | 1453 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
1454 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
1454 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
1455 | 1455 | foreach ($alldata as $number) { |
1456 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
|
1456 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset); |
|
1457 | 1457 | } |
1458 | 1458 | if ($globalDebug) echo 'Count all registrations...'."\n"; |
1459 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
1459 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
1460 | 1460 | foreach ($alldata as $number) { |
1461 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
|
1461 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset); |
|
1462 | 1462 | } |
1463 | 1463 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
1464 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
1464 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
1465 | 1465 | foreach ($alldata as $number) { |
1466 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
1466 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
1467 | 1467 | } |
1468 | 1468 | if ($globalDebug) echo 'Count all owners...'."\n"; |
1469 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
1469 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
1470 | 1470 | foreach ($alldata as $number) { |
1471 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
|
1471 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset); |
|
1472 | 1472 | } |
1473 | 1473 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
1474 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
1474 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
1475 | 1475 | foreach ($alldata as $number) { |
1476 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
|
1476 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset); |
|
1477 | 1477 | } |
1478 | 1478 | |
1479 | 1479 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
1480 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
1480 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
1481 | 1481 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
1482 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1482 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
1483 | 1483 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
1484 | 1484 | $alldata = array(); |
1485 | 1485 | |
@@ -1497,14 +1497,14 @@ discard block |
||
1497 | 1497 | foreach ($alldata as $key => $row) { |
1498 | 1498 | $count[$key] = $row['airport_departure_icao_count']; |
1499 | 1499 | } |
1500 | - array_multisort($count,SORT_DESC,$alldata); |
|
1500 | + array_multisort($count, SORT_DESC, $alldata); |
|
1501 | 1501 | foreach ($alldata as $number) { |
1502 | - 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); |
|
1502 | + 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); |
|
1503 | 1503 | } |
1504 | 1504 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
1505 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
1505 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
1506 | 1506 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
1507 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1507 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
1508 | 1508 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
1509 | 1509 | $alldata = array(); |
1510 | 1510 | foreach ($pall as $value) { |
@@ -1521,16 +1521,16 @@ discard block |
||
1521 | 1521 | foreach ($alldata as $key => $row) { |
1522 | 1522 | $count[$key] = $row['airport_arrival_icao_count']; |
1523 | 1523 | } |
1524 | - array_multisort($count,SORT_DESC,$alldata); |
|
1524 | + array_multisort($count, SORT_DESC, $alldata); |
|
1525 | 1525 | foreach ($alldata as $number) { |
1526 | - 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); |
|
1526 | + 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); |
|
1527 | 1527 | } |
1528 | 1528 | if ($Connection->tableExists('countries')) { |
1529 | 1529 | if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
1530 | 1530 | $SpotterArchive = new SpotterArchive(); |
1531 | - $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
1531 | + $alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day); |
|
1532 | 1532 | foreach ($alldata as $number) { |
1533 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'','',$reset); |
|
1533 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', '', $reset); |
|
1534 | 1534 | } |
1535 | 1535 | } |
1536 | 1536 | |
@@ -1544,37 +1544,37 @@ discard block |
||
1544 | 1544 | $lastyear = false; |
1545 | 1545 | foreach ($alldata as $number) { |
1546 | 1546 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1547 | - $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']))); |
|
1547 | + $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']))); |
|
1548 | 1548 | } |
1549 | 1549 | if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
1550 | 1550 | $alldata = $Spotter->countAllMilitaryMonths(); |
1551 | 1551 | foreach ($alldata as $number) { |
1552 | - $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']))); |
|
1552 | + $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']))); |
|
1553 | 1553 | } |
1554 | 1554 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
1555 | 1555 | $alldata = $Spotter->countAllMonthsOwners(); |
1556 | 1556 | foreach ($alldata as $number) { |
1557 | - $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']))); |
|
1557 | + $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']))); |
|
1558 | 1558 | } |
1559 | 1559 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
1560 | 1560 | $alldata = $Spotter->countAllMonthsPilots(); |
1561 | 1561 | foreach ($alldata as $number) { |
1562 | - $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']))); |
|
1562 | + $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']))); |
|
1563 | 1563 | } |
1564 | 1564 | if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
1565 | 1565 | $alldata = $Spotter->countAllMonthsAirlines(); |
1566 | 1566 | foreach ($alldata as $number) { |
1567 | - $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']))); |
|
1567 | + $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']))); |
|
1568 | 1568 | } |
1569 | 1569 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
1570 | 1570 | $alldata = $Spotter->countAllMonthsAircrafts(); |
1571 | 1571 | foreach ($alldata as $number) { |
1572 | - $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']))); |
|
1572 | + $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']))); |
|
1573 | 1573 | } |
1574 | 1574 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
1575 | 1575 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
1576 | 1576 | foreach ($alldata as $number) { |
1577 | - $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']))); |
|
1577 | + $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']))); |
|
1578 | 1578 | } |
1579 | 1579 | if ($globalDebug) echo 'Airports data...'."\n"; |
1580 | 1580 | if ($globalDebug) echo '...Departure'."\n"; |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | } |
1620 | 1620 | $alldata = $pall; |
1621 | 1621 | foreach ($alldata as $number) { |
1622 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
1622 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
1623 | 1623 | } |
1624 | 1624 | echo '...Arrival'."\n"; |
1625 | 1625 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | } |
1662 | 1662 | $alldata = $pall; |
1663 | 1663 | foreach ($alldata as $number) { |
1664 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
1664 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
1665 | 1665 | } |
1666 | 1666 | |
1667 | 1667 | echo 'Flights data...'."\n"; |
@@ -1669,28 +1669,28 @@ discard block |
||
1669 | 1669 | echo '-> countAllDatesLastMonth...'."\n"; |
1670 | 1670 | $alldata = $Spotter->countAllDatesLastMonth(); |
1671 | 1671 | foreach ($alldata as $number) { |
1672 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
1672 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
1673 | 1673 | } |
1674 | 1674 | echo '-> countAllDates...'."\n"; |
1675 | 1675 | $previousdata = $this->countAllDates(); |
1676 | 1676 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
1677 | 1677 | $this->deleteStatFlight('date'); |
1678 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates()); |
|
1678 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates()); |
|
1679 | 1679 | $values = array(); |
1680 | 1680 | foreach ($alldata as $cnt) { |
1681 | 1681 | $values[] = $cnt['date_count']; |
1682 | 1682 | } |
1683 | - array_multisort($values,SORT_DESC,$alldata); |
|
1684 | - array_splice($alldata,11); |
|
1683 | + array_multisort($values, SORT_DESC, $alldata); |
|
1684 | + array_splice($alldata, 11); |
|
1685 | 1685 | foreach ($alldata as $number) { |
1686 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
1686 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
1687 | 1687 | } |
1688 | 1688 | |
1689 | 1689 | $this->deleteStatFlight('hour'); |
1690 | 1690 | echo '-> countAllHours...'."\n"; |
1691 | 1691 | $alldata = $Spotter->countAllHours('hour'); |
1692 | 1692 | foreach ($alldata as $number) { |
1693 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
1693 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | |
@@ -1700,41 +1700,41 @@ discard block |
||
1700 | 1700 | if ($Connection->tableExists('countries')) { |
1701 | 1701 | if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
1702 | 1702 | $SpotterArchive = new SpotterArchive(); |
1703 | - $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
|
1703 | + $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false, 0, $last_update_day); |
|
1704 | 1704 | foreach ($alldata as $number) { |
1705 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
|
1705 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], $number['airline_icao'], '', $reset); |
|
1706 | 1706 | } |
1707 | 1707 | } |
1708 | 1708 | if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
1709 | 1709 | $Spotter = new Spotter($this->db); |
1710 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
1710 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
1711 | 1711 | foreach ($alldata as $number) { |
1712 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
|
1712 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset); |
|
1713 | 1713 | } |
1714 | 1714 | if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
1715 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
1715 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
1716 | 1716 | foreach ($alldata as $number) { |
1717 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
|
1717 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset); |
|
1718 | 1718 | } |
1719 | 1719 | if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
1720 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
1720 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
1721 | 1721 | foreach ($alldata as $number) { |
1722 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
1722 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
1723 | 1723 | } |
1724 | 1724 | if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
1725 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
1725 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
1726 | 1726 | foreach ($alldata as $number) { |
1727 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
|
1727 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset); |
|
1728 | 1728 | } |
1729 | 1729 | if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
1730 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
1730 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
1731 | 1731 | foreach ($alldata as $number) { |
1732 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
|
1732 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset); |
|
1733 | 1733 | } |
1734 | 1734 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
1735 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1735 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1736 | 1736 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
1737 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1737 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1738 | 1738 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
1739 | 1739 | //$alldata = array(); |
1740 | 1740 | foreach ($dall as $value) { |
@@ -1754,12 +1754,12 @@ discard block |
||
1754 | 1754 | } |
1755 | 1755 | $alldata = $pall; |
1756 | 1756 | foreach ($alldata as $number) { |
1757 | - 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); |
|
1757 | + 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); |
|
1758 | 1758 | } |
1759 | 1759 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
1760 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1760 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1761 | 1761 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
1762 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1762 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1763 | 1763 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
1764 | 1764 | //$alldata = array(); |
1765 | 1765 | foreach ($dall as $value) { |
@@ -1779,7 +1779,7 @@ discard block |
||
1779 | 1779 | } |
1780 | 1780 | $alldata = $pall; |
1781 | 1781 | foreach ($alldata as $number) { |
1782 | - 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); |
|
1782 | + 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); |
|
1783 | 1783 | } |
1784 | 1784 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
1785 | 1785 | $Spotter = new Spotter($this->db); |
@@ -1787,27 +1787,27 @@ discard block |
||
1787 | 1787 | $lastyear = false; |
1788 | 1788 | foreach ($alldata as $number) { |
1789 | 1789 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1790 | - $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']); |
|
1790 | + $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']); |
|
1791 | 1791 | } |
1792 | 1792 | if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
1793 | 1793 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
1794 | 1794 | foreach ($alldata as $number) { |
1795 | - $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']); |
|
1795 | + $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']); |
|
1796 | 1796 | } |
1797 | 1797 | if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
1798 | 1798 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
1799 | 1799 | foreach ($alldata as $number) { |
1800 | - $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']); |
|
1800 | + $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']); |
|
1801 | 1801 | } |
1802 | 1802 | if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
1803 | 1803 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
1804 | 1804 | foreach ($alldata as $number) { |
1805 | - $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']); |
|
1805 | + $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']); |
|
1806 | 1806 | } |
1807 | 1807 | if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
1808 | 1808 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
1809 | 1809 | foreach ($alldata as $number) { |
1810 | - $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']); |
|
1810 | + $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']); |
|
1811 | 1811 | } |
1812 | 1812 | if ($globalDebug) echo '...Departure'."\n"; |
1813 | 1813 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | } |
1831 | 1831 | $alldata = $pall; |
1832 | 1832 | foreach ($alldata as $number) { |
1833 | - $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']); |
|
1833 | + $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']); |
|
1834 | 1834 | } |
1835 | 1835 | if ($globalDebug) echo '...Arrival'."\n"; |
1836 | 1836 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -1853,32 +1853,32 @@ discard block |
||
1853 | 1853 | } |
1854 | 1854 | $alldata = $pall; |
1855 | 1855 | foreach ($alldata as $number) { |
1856 | - $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']); |
|
1856 | + $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']); |
|
1857 | 1857 | } |
1858 | 1858 | |
1859 | 1859 | if ($globalDebug) echo 'Flights data...'."\n"; |
1860 | 1860 | if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
1861 | 1861 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
1862 | 1862 | foreach ($alldata as $number) { |
1863 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
1863 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1864 | 1864 | } |
1865 | 1865 | if ($globalDebug) echo '-> countAllDates...'."\n"; |
1866 | 1866 | //$previousdata = $this->countAllDatesByAirlines(); |
1867 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
|
1867 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines()); |
|
1868 | 1868 | $values = array(); |
1869 | 1869 | foreach ($alldata as $cnt) { |
1870 | 1870 | $values[] = $cnt['date_count']; |
1871 | 1871 | } |
1872 | - array_multisort($values,SORT_DESC,$alldata); |
|
1873 | - array_splice($alldata,11); |
|
1872 | + array_multisort($values, SORT_DESC, $alldata); |
|
1873 | + array_splice($alldata, 11); |
|
1874 | 1874 | foreach ($alldata as $number) { |
1875 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
1875 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1876 | 1876 | } |
1877 | 1877 | |
1878 | 1878 | if ($globalDebug) echo '-> countAllHours...'."\n"; |
1879 | 1879 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
1880 | 1880 | foreach ($alldata as $number) { |
1881 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
1881 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
1882 | 1882 | } |
1883 | 1883 | |
1884 | 1884 | |
@@ -1897,32 +1897,32 @@ discard block |
||
1897 | 1897 | // Count by filter |
1898 | 1898 | if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
1899 | 1899 | $Spotter = new Spotter($this->db); |
1900 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
1900 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
1901 | 1901 | foreach ($alldata as $number) { |
1902 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
|
1902 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset); |
|
1903 | 1903 | } |
1904 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
1904 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
1905 | 1905 | foreach ($alldata as $number) { |
1906 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
|
1906 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset); |
|
1907 | 1907 | } |
1908 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
1908 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
1909 | 1909 | foreach ($alldata as $number) { |
1910 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
|
1910 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset); |
|
1911 | 1911 | } |
1912 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
1912 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
1913 | 1913 | foreach ($alldata as $number) { |
1914 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
|
1914 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset); |
|
1915 | 1915 | } |
1916 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
1916 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
1917 | 1917 | foreach ($alldata as $number) { |
1918 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
|
1918 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset); |
|
1919 | 1919 | } |
1920 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
1920 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
1921 | 1921 | foreach ($alldata as $number) { |
1922 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
|
1922 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset); |
|
1923 | 1923 | } |
1924 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
1925 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
1924 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
1925 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
1926 | 1926 | $alldata = array(); |
1927 | 1927 | foreach ($pall as $value) { |
1928 | 1928 | $icao = $value['airport_departure_icao']; |
@@ -1938,12 +1938,12 @@ discard block |
||
1938 | 1938 | foreach ($alldata as $key => $row) { |
1939 | 1939 | $count[$key] = $row['airport_departure_icao_count']; |
1940 | 1940 | } |
1941 | - array_multisort($count,SORT_DESC,$alldata); |
|
1941 | + array_multisort($count, SORT_DESC, $alldata); |
|
1942 | 1942 | foreach ($alldata as $number) { |
1943 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
|
1943 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name, $reset); |
|
1944 | 1944 | } |
1945 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
|
1946 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
1945 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
1946 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
1947 | 1947 | $alldata = array(); |
1948 | 1948 | foreach ($pall as $value) { |
1949 | 1949 | $icao = $value['airport_arrival_icao']; |
@@ -1959,40 +1959,40 @@ discard block |
||
1959 | 1959 | foreach ($alldata as $key => $row) { |
1960 | 1960 | $count[$key] = $row['airport_arrival_icao_count']; |
1961 | 1961 | } |
1962 | - array_multisort($count,SORT_DESC,$alldata); |
|
1962 | + array_multisort($count, SORT_DESC, $alldata); |
|
1963 | 1963 | foreach ($alldata as $number) { |
1964 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset); |
|
1964 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name, $reset); |
|
1965 | 1965 | } |
1966 | 1966 | $Spotter = new Spotter($this->db); |
1967 | 1967 | $alldata = $Spotter->countAllMonths($filter); |
1968 | 1968 | $lastyear = false; |
1969 | 1969 | foreach ($alldata as $number) { |
1970 | 1970 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1971 | - $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); |
|
1971 | + $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); |
|
1972 | 1972 | } |
1973 | 1973 | $alldata = $Spotter->countAllMonthsOwners($filter); |
1974 | 1974 | foreach ($alldata as $number) { |
1975 | - $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'])),'',$filter_name); |
|
1975 | + $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'])), '', $filter_name); |
|
1976 | 1976 | } |
1977 | 1977 | $alldata = $Spotter->countAllMonthsPilots($filter); |
1978 | 1978 | foreach ($alldata as $number) { |
1979 | - $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'])),'',$filter_name); |
|
1979 | + $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'])), '', $filter_name); |
|
1980 | 1980 | } |
1981 | 1981 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
1982 | 1982 | foreach ($alldata as $number) { |
1983 | - $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'])),'',$filter_name); |
|
1983 | + $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'])), '', $filter_name); |
|
1984 | 1984 | } |
1985 | 1985 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
1986 | 1986 | foreach ($alldata as $number) { |
1987 | - $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'])),'',$filter_name); |
|
1987 | + $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'])), '', $filter_name); |
|
1988 | 1988 | } |
1989 | 1989 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
1990 | 1990 | foreach ($alldata as $number) { |
1991 | - $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'])),'',$filter_name); |
|
1991 | + $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'])), '', $filter_name); |
|
1992 | 1992 | } |
1993 | 1993 | echo '...Departure'."\n"; |
1994 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
1995 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
1994 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
1995 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
1996 | 1996 | foreach ($dall as $value) { |
1997 | 1997 | $icao = $value['departure_airport_icao']; |
1998 | 1998 | $ddate = $value['date']; |
@@ -2010,11 +2010,11 @@ discard block |
||
2010 | 2010 | } |
2011 | 2011 | $alldata = $pall; |
2012 | 2012 | foreach ($alldata as $number) { |
2013 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
|
2013 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name); |
|
2014 | 2014 | } |
2015 | 2015 | echo '...Arrival'."\n"; |
2016 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
2017 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
2016 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
2017 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
2018 | 2018 | foreach ($dall as $value) { |
2019 | 2019 | $icao = $value['arrival_airport_icao']; |
2020 | 2020 | $ddate = $value['date']; |
@@ -2032,40 +2032,40 @@ discard block |
||
2032 | 2032 | } |
2033 | 2033 | $alldata = $pall; |
2034 | 2034 | foreach ($alldata as $number) { |
2035 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
|
2035 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name); |
|
2036 | 2036 | } |
2037 | 2037 | |
2038 | 2038 | echo 'Flights data...'."\n"; |
2039 | 2039 | echo '-> countAllDatesLastMonth...'."\n"; |
2040 | 2040 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
2041 | 2041 | foreach ($alldata as $number) { |
2042 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
2042 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2043 | 2043 | } |
2044 | 2044 | echo '-> countAllDates...'."\n"; |
2045 | - $previousdata = $this->countAllDates('',$filter_name); |
|
2046 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
2045 | + $previousdata = $this->countAllDates('', $filter_name); |
|
2046 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
2047 | 2047 | $values = array(); |
2048 | 2048 | foreach ($alldata as $cnt) { |
2049 | 2049 | $values[] = $cnt['date_count']; |
2050 | 2050 | } |
2051 | - array_multisort($values,SORT_DESC,$alldata); |
|
2052 | - array_splice($alldata,11); |
|
2051 | + array_multisort($values, SORT_DESC, $alldata); |
|
2052 | + array_splice($alldata, 11); |
|
2053 | 2053 | foreach ($alldata as $number) { |
2054 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
2054 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2055 | 2055 | } |
2056 | 2056 | |
2057 | 2057 | echo '-> countAllHours...'."\n"; |
2058 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
2058 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
2059 | 2059 | foreach ($alldata as $number) { |
2060 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
2060 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
2061 | 2061 | } |
2062 | 2062 | echo 'Insert last stats update date...'."\n"; |
2063 | 2063 | date_default_timezone_set('UTC'); |
2064 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
2064 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
|
2065 | 2065 | if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
2066 | - if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2066 | + if (date('Y', strtotime($last_update_day)) != date('Y')) { |
|
2067 | 2067 | $this->deleteOldStats($filter_name); |
2068 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
2068 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
|
2069 | 2069 | } |
2070 | 2070 | } |
2071 | 2071 | |
@@ -2078,16 +2078,16 @@ discard block |
||
2078 | 2078 | // SUM all previous month to put as year |
2079 | 2079 | $previous_year = date('Y'); |
2080 | 2080 | $previous_year--; |
2081 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2082 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2083 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2084 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2081 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2082 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2083 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2084 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2085 | 2085 | $allairlines = $this->getAllAirlineNames(); |
2086 | 2086 | foreach ($allairlines as $data) { |
2087 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2088 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2089 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2090 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2087 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2088 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2089 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2090 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2091 | 2091 | } |
2092 | 2092 | |
2093 | 2093 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -2096,7 +2096,7 @@ discard block |
||
2096 | 2096 | try { |
2097 | 2097 | $sth = $this->db->prepare($query); |
2098 | 2098 | $sth->execute(); |
2099 | - } catch(PDOException $e) { |
|
2099 | + } catch (PDOException $e) { |
|
2100 | 2100 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2101 | 2101 | } |
2102 | 2102 | } |
@@ -2105,15 +2105,15 @@ discard block |
||
2105 | 2105 | try { |
2106 | 2106 | $sth = $this->db->prepare($query); |
2107 | 2107 | $sth->execute(); |
2108 | - } catch(PDOException $e) { |
|
2108 | + } catch (PDOException $e) { |
|
2109 | 2109 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2110 | 2110 | } |
2111 | 2111 | } |
2112 | 2112 | if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
2113 | 2113 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
2114 | - if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
2114 | + if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
|
2115 | 2115 | $this->deleteOldStats(); |
2116 | - $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
2116 | + $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
|
2117 | 2117 | $lastyearupdate = true; |
2118 | 2118 | } |
2119 | 2119 | } |
@@ -2135,7 +2135,7 @@ discard block |
||
2135 | 2135 | try { |
2136 | 2136 | $sth = $this->db->prepare($query); |
2137 | 2137 | $sth->execute(); |
2138 | - } catch(PDOException $e) { |
|
2138 | + } catch (PDOException $e) { |
|
2139 | 2139 | return "error : ".$e->getMessage(); |
2140 | 2140 | } |
2141 | 2141 | } |
@@ -2149,14 +2149,14 @@ discard block |
||
2149 | 2149 | try { |
2150 | 2150 | $sth = $this->db->prepare($query); |
2151 | 2151 | $sth->execute(); |
2152 | - } catch(PDOException $e) { |
|
2152 | + } catch (PDOException $e) { |
|
2153 | 2153 | return "error : ".$e->getMessage(); |
2154 | 2154 | } |
2155 | 2155 | } |
2156 | 2156 | if (!isset($lastyearupdate)) { |
2157 | 2157 | echo 'Insert last stats update date...'."\n"; |
2158 | 2158 | date_default_timezone_set('UTC'); |
2159 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
2159 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
2160 | 2160 | } |
2161 | 2161 | if ($globalStatsResetYear) { |
2162 | 2162 | require_once(dirname(__FILE__).'/../install/class.settings.php'); |