@@ -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,43 +82,43 @@ 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); |
@@ -133,22 +133,22 @@ discard block |
||
133 | 133 | else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name 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"; |
134 | 134 | try { |
135 | 135 | $sth = $this->db->prepare($query); |
136 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
137 | - } catch(PDOException $e) { |
|
136 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
137 | + } catch (PDOException $e) { |
|
138 | 138 | echo "error : ".$e->getMessage(); |
139 | 139 | } |
140 | 140 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
141 | 141 | if (empty($all)) { |
142 | 142 | $filters = array('airlines' => array($stats_airline)); |
143 | 143 | if ($filter_name != '') { |
144 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
144 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
145 | 145 | } |
146 | 146 | $Spotter = new Spotter($this->db); |
147 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
147 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
148 | 148 | } |
149 | 149 | return $all; |
150 | 150 | } |
151 | - public function countAllAirlineCountries($limit = true,$filter_name = '') { |
|
151 | + public function countAllAirlineCountries($limit = true, $filter_name = '') { |
|
152 | 152 | global $globalStatsFilters; |
153 | 153 | if ($filter_name == '') $filter_name = $this->filter_name; |
154 | 154 | if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | try { |
157 | 157 | $sth = $this->db->prepare($query); |
158 | 158 | $sth->execute(array(':filter_name' => $filter_name)); |
159 | - } catch(PDOException $e) { |
|
159 | + } catch (PDOException $e) { |
|
160 | 160 | echo "error : ".$e->getMessage(); |
161 | 161 | } |
162 | 162 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -164,28 +164,28 @@ discard block |
||
164 | 164 | $Spotter = new Spotter($this->db); |
165 | 165 | $filters = array(); |
166 | 166 | if ($filter_name != '') { |
167 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
167 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
168 | 168 | } |
169 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
169 | + $all = $Spotter->countAllAirlineCountries($limit, $filters); |
|
170 | 170 | } |
171 | 171 | return $all; |
172 | 172 | } |
173 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') { |
|
173 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '') { |
|
174 | 174 | global $globalStatsFilters; |
175 | 175 | if ($filter_name == '') $filter_name = $this->filter_name; |
176 | 176 | if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
177 | 177 | 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"; |
178 | 178 | try { |
179 | 179 | $sth = $this->db->prepare($query); |
180 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
181 | - } catch(PDOException $e) { |
|
180 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
181 | + } catch (PDOException $e) { |
|
182 | 182 | echo "error : ".$e->getMessage(); |
183 | 183 | } |
184 | 184 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
185 | 185 | if (empty($all)) { |
186 | 186 | $filters = array('airlines' => array($stats_airline)); |
187 | 187 | if ($filter_name != '') { |
188 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
188 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
189 | 189 | } |
190 | 190 | $Spotter = new Spotter($this->db); |
191 | 191 | $all = $Spotter->countAllAircraftManufacturers($filters); |
@@ -200,18 +200,18 @@ discard block |
||
200 | 200 | 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"; |
201 | 201 | try { |
202 | 202 | $sth = $this->db->prepare($query); |
203 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
204 | - } catch(PDOException $e) { |
|
203 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
204 | + } catch (PDOException $e) { |
|
205 | 205 | echo "error : ".$e->getMessage(); |
206 | 206 | } |
207 | 207 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
208 | 208 | if (empty($all)) { |
209 | 209 | $filters = array('airlines' => array($stats_airline)); |
210 | 210 | if ($filter_name != '') { |
211 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
211 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
212 | 212 | } |
213 | 213 | $Spotter = new Spotter($this->db); |
214 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
214 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
215 | 215 | } |
216 | 216 | return $all; |
217 | 217 | } |
@@ -222,15 +222,15 @@ discard block |
||
222 | 222 | 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"; |
223 | 223 | try { |
224 | 224 | $sth = $this->db->prepare($query); |
225 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
226 | - } catch(PDOException $e) { |
|
225 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
226 | + } catch (PDOException $e) { |
|
227 | 227 | echo "error : ".$e->getMessage(); |
228 | 228 | } |
229 | 229 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
230 | 230 | if (empty($all)) { |
231 | 231 | $filters = array('airlines' => array($stats_airline)); |
232 | 232 | if ($filter_name != '') { |
233 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
233 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
234 | 234 | } |
235 | 235 | $Spotter = new Spotter($this->db); |
236 | 236 | $all = $Spotter->countAllDepartureCountries($filters); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | return $all; |
239 | 239 | } |
240 | 240 | |
241 | - public function countAllAirlines($limit = true,$filter_name = '') { |
|
241 | + public function countAllAirlines($limit = true, $filter_name = '') { |
|
242 | 242 | global $globalStatsFilters; |
243 | 243 | if ($filter_name == '') $filter_name = $this->filter_name; |
244 | 244 | 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 ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | try { |
247 | 247 | $sth = $this->db->prepare($query); |
248 | 248 | $sth->execute(array(':filter_name' => $filter_name)); |
249 | - } catch(PDOException $e) { |
|
249 | + } catch (PDOException $e) { |
|
250 | 250 | echo "error : ".$e->getMessage(); |
251 | 251 | } |
252 | 252 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -254,58 +254,58 @@ discard block |
||
254 | 254 | $Spotter = new Spotter($this->db); |
255 | 255 | $filters = array(); |
256 | 256 | if ($filter_name != '') { |
257 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
257 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
258 | 258 | } |
259 | 259 | |
260 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
260 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
|
261 | 261 | } |
262 | 262 | return $all; |
263 | 263 | } |
264 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') { |
|
264 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '') { |
|
265 | 265 | global $globalStatsFilters; |
266 | 266 | if ($filter_name == '') $filter_name = $this->filter_name; |
267 | 267 | if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
268 | 268 | 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"; |
269 | 269 | try { |
270 | 270 | $sth = $this->db->prepare($query); |
271 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
272 | - } catch(PDOException $e) { |
|
271 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
272 | + } catch (PDOException $e) { |
|
273 | 273 | echo "error : ".$e->getMessage(); |
274 | 274 | } |
275 | 275 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
276 | 276 | if (empty($all)) { |
277 | 277 | $filters = array('airlines' => array($stats_airline)); |
278 | 278 | if ($filter_name != '') { |
279 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
279 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
280 | 280 | } |
281 | 281 | $Spotter = new Spotter($this->db); |
282 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
282 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
283 | 283 | } |
284 | 284 | return $all; |
285 | 285 | } |
286 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') { |
|
286 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '') { |
|
287 | 287 | global $globalStatsFilters; |
288 | 288 | if ($filter_name == '') $filter_name = $this->filter_name; |
289 | 289 | if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
290 | 290 | 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"; |
291 | 291 | try { |
292 | 292 | $sth = $this->db->prepare($query); |
293 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
294 | - } catch(PDOException $e) { |
|
293 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
294 | + } catch (PDOException $e) { |
|
295 | 295 | echo "error : ".$e->getMessage(); |
296 | 296 | } |
297 | 297 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
298 | 298 | if (empty($all)) { |
299 | 299 | $filters = array('airlines' => array($stats_airline)); |
300 | 300 | if ($filter_name != '') { |
301 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
301 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
302 | 302 | } |
303 | 303 | $Spotter = new Spotter($this->db); |
304 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
304 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
305 | 305 | } |
306 | 306 | return $all; |
307 | 307 | } |
308 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') { |
|
308 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '') { |
|
309 | 309 | $Connection = new Connection(); |
310 | 310 | if ($filter_name == '') $filter_name = $this->filter_name; |
311 | 311 | if ($Connection->tableExists('countries')) { |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | 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"; |
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); |
@@ -329,70 +329,70 @@ discard block |
||
329 | 329 | return array(); |
330 | 330 | } |
331 | 331 | } |
332 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') { |
|
332 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '') { |
|
333 | 333 | global $globalStatsFilters; |
334 | 334 | if ($filter_name == '') $filter_name = $this->filter_name; |
335 | 335 | if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
336 | 336 | 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"; |
337 | 337 | try { |
338 | 338 | $sth = $this->db->prepare($query); |
339 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
340 | - } catch(PDOException $e) { |
|
339 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
340 | + } catch (PDOException $e) { |
|
341 | 341 | echo "error : ".$e->getMessage(); |
342 | 342 | } |
343 | 343 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
344 | 344 | if (empty($all)) { |
345 | 345 | $filters = array('airlines' => array($stats_airline)); |
346 | 346 | if ($filter_name != '') { |
347 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
347 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
348 | 348 | } |
349 | 349 | $Spotter = new Spotter($this->db); |
350 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
350 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
351 | 351 | } |
352 | 352 | return $all; |
353 | 353 | } |
354 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') { |
|
354 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '') { |
|
355 | 355 | global $globalStatsFilters; |
356 | 356 | if ($filter_name == '') $filter_name = $this->filter_name; |
357 | 357 | if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
358 | 358 | 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"; |
359 | 359 | try { |
360 | 360 | $sth = $this->db->prepare($query); |
361 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
362 | - } catch(PDOException $e) { |
|
361 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
362 | + } catch (PDOException $e) { |
|
363 | 363 | echo "error : ".$e->getMessage(); |
364 | 364 | } |
365 | 365 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
366 | 366 | if (empty($all)) { |
367 | 367 | $filters = array('airlines' => array($stats_airline)); |
368 | 368 | if ($filter_name != '') { |
369 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
369 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
370 | 370 | } |
371 | 371 | $Spotter = new Spotter($this->db); |
372 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
372 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
373 | 373 | } |
374 | 374 | return $all; |
375 | 375 | } |
376 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') { |
|
376 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '') { |
|
377 | 377 | global $globalStatsFilters; |
378 | 378 | if ($filter_name == '') $filter_name = $this->filter_name; |
379 | 379 | if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count 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 LIMIT 10 OFFSET 0"; |
380 | 380 | 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"; |
381 | 381 | try { |
382 | 382 | $sth = $this->db->prepare($query); |
383 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
384 | - } catch(PDOException $e) { |
|
383 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
384 | + } catch (PDOException $e) { |
|
385 | 385 | echo "error : ".$e->getMessage(); |
386 | 386 | } |
387 | 387 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
388 | 388 | if (empty($all)) { |
389 | 389 | $filters = array('airlines' => array($stats_airline)); |
390 | 390 | if ($filter_name != '') { |
391 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
391 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
392 | 392 | } |
393 | 393 | $Spotter = new Spotter($this->db); |
394 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
395 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
394 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
395 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
396 | 396 | $all = array(); |
397 | 397 | foreach ($pall as $value) { |
398 | 398 | $icao = $value['airport_departure_icao']; |
@@ -409,30 +409,30 @@ discard block |
||
409 | 409 | foreach ($all as $key => $row) { |
410 | 410 | $count[$key] = $row['airport_departure_icao_count']; |
411 | 411 | } |
412 | - array_multisort($count,SORT_DESC,$all); |
|
412 | + array_multisort($count, SORT_DESC, $all); |
|
413 | 413 | } |
414 | 414 | return $all; |
415 | 415 | } |
416 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') { |
|
416 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '') { |
|
417 | 417 | global $globalStatsFilters; |
418 | 418 | if ($filter_name == '') $filter_name = $this->filter_name; |
419 | 419 | if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count 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 LIMIT 10 OFFSET 0"; |
420 | 420 | 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"; |
421 | 421 | try { |
422 | 422 | $sth = $this->db->prepare($query); |
423 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
424 | - } catch(PDOException $e) { |
|
423 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
424 | + } catch (PDOException $e) { |
|
425 | 425 | echo "error : ".$e->getMessage(); |
426 | 426 | } |
427 | 427 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
428 | 428 | if (empty($all)) { |
429 | 429 | $filters = array('airlines' => array($stats_airline)); |
430 | 430 | if ($filter_name != '') { |
431 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
431 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
432 | 432 | } |
433 | 433 | $Spotter = new Spotter($this->db); |
434 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
435 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
434 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
435 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
436 | 436 | $all = array(); |
437 | 437 | foreach ($pall as $value) { |
438 | 438 | $icao = $value['airport_arrival_icao']; |
@@ -449,12 +449,12 @@ discard block |
||
449 | 449 | foreach ($all as $key => $row) { |
450 | 450 | $count[$key] = $row['airport_arrival_icao_count']; |
451 | 451 | } |
452 | - array_multisort($count,SORT_DESC,$all); |
|
452 | + array_multisort($count, SORT_DESC, $all); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | return $all; |
456 | 456 | } |
457 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
457 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
458 | 458 | global $globalDBdriver, $globalStatsFilters; |
459 | 459 | if ($filter_name == '') $filter_name = $this->filter_name; |
460 | 460 | if ($globalDBdriver == 'mysql') { |
@@ -464,18 +464,18 @@ discard block |
||
464 | 464 | 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"; |
465 | 465 | 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"; |
466 | 466 | } |
467 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
467 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
468 | 468 | try { |
469 | 469 | $sth = $this->db->prepare($query); |
470 | 470 | $sth->execute($query_data); |
471 | - } catch(PDOException $e) { |
|
471 | + } catch (PDOException $e) { |
|
472 | 472 | echo "error : ".$e->getMessage(); |
473 | 473 | } |
474 | 474 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
475 | 475 | if (empty($all)) { |
476 | 476 | $filters = array('airlines' => array($stats_airline)); |
477 | 477 | if ($filter_name != '') { |
478 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
478 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
479 | 479 | } |
480 | 480 | $Spotter = new Spotter($this->db); |
481 | 481 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -484,29 +484,29 @@ discard block |
||
484 | 484 | return $all; |
485 | 485 | } |
486 | 486 | |
487 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
487 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
488 | 488 | global $globalStatsFilters; |
489 | 489 | if ($filter_name == '') $filter_name = $this->filter_name; |
490 | 490 | $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"; |
491 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
491 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
492 | 492 | try { |
493 | 493 | $sth = $this->db->prepare($query); |
494 | 494 | $sth->execute($query_data); |
495 | - } catch(PDOException $e) { |
|
495 | + } catch (PDOException $e) { |
|
496 | 496 | echo "error : ".$e->getMessage(); |
497 | 497 | } |
498 | 498 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
499 | 499 | if (empty($all)) { |
500 | 500 | $filters = array('airlines' => array($stats_airline)); |
501 | 501 | if ($filter_name != '') { |
502 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
502 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
503 | 503 | } |
504 | 504 | $Spotter = new Spotter($this->db); |
505 | 505 | $all = $Spotter->countAllDatesLastMonth($filters); |
506 | 506 | } |
507 | 507 | return $all; |
508 | 508 | } |
509 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
509 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
510 | 510 | global $globalDBdriver, $globalStatsFilters; |
511 | 511 | if ($filter_name == '') $filter_name = $this->filter_name; |
512 | 512 | if ($globalDBdriver == 'mysql') { |
@@ -514,40 +514,40 @@ discard block |
||
514 | 514 | } else { |
515 | 515 | $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"; |
516 | 516 | } |
517 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
517 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
518 | 518 | try { |
519 | 519 | $sth = $this->db->prepare($query); |
520 | 520 | $sth->execute($query_data); |
521 | - } catch(PDOException $e) { |
|
521 | + } catch (PDOException $e) { |
|
522 | 522 | echo "error : ".$e->getMessage(); |
523 | 523 | } |
524 | 524 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
525 | 525 | if (empty($all)) { |
526 | 526 | $filters = array('airlines' => array($stats_airline)); |
527 | 527 | if ($filter_name != '') { |
528 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
528 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
529 | 529 | } |
530 | 530 | $Spotter = new Spotter($this->db); |
531 | 531 | $all = $Spotter->countAllDatesLast7Days($filters); |
532 | 532 | } |
533 | 533 | return $all; |
534 | 534 | } |
535 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
535 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
536 | 536 | global $globalStatsFilters; |
537 | 537 | if ($filter_name == '') $filter_name = $this->filter_name; |
538 | 538 | $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"; |
539 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
539 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
540 | 540 | try { |
541 | 541 | $sth = $this->db->prepare($query); |
542 | 542 | $sth->execute($query_data); |
543 | - } catch(PDOException $e) { |
|
543 | + } catch (PDOException $e) { |
|
544 | 544 | echo "error : ".$e->getMessage(); |
545 | 545 | } |
546 | 546 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
547 | 547 | if (empty($all)) { |
548 | 548 | $filters = array('airlines' => array($stats_airline)); |
549 | 549 | if ($filter_name != '') { |
550 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
550 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
551 | 551 | } |
552 | 552 | $Spotter = new Spotter($this->db); |
553 | 553 | $all = $Spotter->countAllDates($filters); |
@@ -562,35 +562,35 @@ discard block |
||
562 | 562 | try { |
563 | 563 | $sth = $this->db->prepare($query); |
564 | 564 | $sth->execute($query_data); |
565 | - } catch(PDOException $e) { |
|
565 | + } catch (PDOException $e) { |
|
566 | 566 | echo "error : ".$e->getMessage(); |
567 | 567 | } |
568 | 568 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
569 | 569 | if (empty($all)) { |
570 | 570 | $filters = array(); |
571 | 571 | if ($filter_name != '') { |
572 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
572 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
573 | 573 | } |
574 | 574 | $Spotter = new Spotter($this->db); |
575 | 575 | $all = $Spotter->countAllDatesByAirlines($filters); |
576 | 576 | } |
577 | 577 | return $all; |
578 | 578 | } |
579 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
579 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
580 | 580 | global $globalStatsFilters; |
581 | 581 | if ($filter_name == '') $filter_name = $this->filter_name; |
582 | 582 | $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"; |
583 | 583 | try { |
584 | 584 | $sth = $this->db->prepare($query); |
585 | 585 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
586 | - } catch(PDOException $e) { |
|
586 | + } catch (PDOException $e) { |
|
587 | 587 | echo "error : ".$e->getMessage(); |
588 | 588 | } |
589 | 589 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
590 | 590 | if (empty($all)) { |
591 | 591 | $filters = array('airlines' => array($stats_airline)); |
592 | 592 | if ($filter_name != '') { |
593 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
593 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
594 | 594 | } |
595 | 595 | $Spotter = new Spotter($this->db); |
596 | 596 | $all = $Spotter->countAllMonths($filters); |
@@ -604,21 +604,21 @@ discard block |
||
604 | 604 | try { |
605 | 605 | $sth = $this->db->prepare($query); |
606 | 606 | $sth->execute(array(':filter_name' => $filter_name)); |
607 | - } catch(PDOException $e) { |
|
607 | + } catch (PDOException $e) { |
|
608 | 608 | echo "error : ".$e->getMessage(); |
609 | 609 | } |
610 | 610 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
611 | 611 | if (empty($all)) { |
612 | 612 | $filters = array(); |
613 | 613 | if ($filter_name != '') { |
614 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
614 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
615 | 615 | } |
616 | 616 | $Spotter = new Spotter($this->db); |
617 | 617 | $all = $Spotter->countAllMilitaryMonths($filters); |
618 | 618 | } |
619 | 619 | return $all; |
620 | 620 | } |
621 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
621 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
622 | 622 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
623 | 623 | if ($filter_name == '') $filter_name = $this->filter_name; |
624 | 624 | 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"; |
@@ -635,17 +635,17 @@ discard block |
||
635 | 635 | try { |
636 | 636 | $sth = $this->db->prepare($query); |
637 | 637 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
638 | - } catch(PDOException $e) { |
|
638 | + } catch (PDOException $e) { |
|
639 | 639 | echo "error : ".$e->getMessage(); |
640 | 640 | } |
641 | 641 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
642 | 642 | if (empty($all)) { |
643 | 643 | $filters = array('airlines' => array($stats_airline)); |
644 | 644 | if ($filter_name != '') { |
645 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
645 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
646 | 646 | } |
647 | 647 | $Spotter = new Spotter($this->db); |
648 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
648 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
649 | 649 | } |
650 | 650 | return $all; |
651 | 651 | } |
@@ -653,11 +653,11 @@ discard block |
||
653 | 653 | public function countOverallFlights($stats_airline = '', $filter_name = '') { |
654 | 654 | global $globalStatsFilters; |
655 | 655 | if ($filter_name == '') $filter_name = $this->filter_name; |
656 | - $all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name); |
|
656 | + $all = $this->getSumStats('flights_bymonth', date('Y'), $stats_airline, $filter_name); |
|
657 | 657 | if (empty($all)) { |
658 | 658 | $filters = array('airlines' => array($stats_airline)); |
659 | 659 | if ($filter_name != '') { |
660 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
660 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
661 | 661 | } |
662 | 662 | $Spotter = new Spotter($this->db); |
663 | 663 | $all = $Spotter->countOverallFlights($filters); |
@@ -667,39 +667,39 @@ discard block |
||
667 | 667 | public function countOverallMilitaryFlights($filter_name = '') { |
668 | 668 | global $globalStatsFilters; |
669 | 669 | if ($filter_name == '') $filter_name = $this->filter_name; |
670 | - $all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name); |
|
670 | + $all = $this->getSumStats('military_flights_bymonth', date('Y'), '', $filter_name); |
|
671 | 671 | if (empty($all)) { |
672 | 672 | $filters = array(); |
673 | 673 | if ($filter_name != '') { |
674 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
674 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
675 | 675 | } |
676 | 676 | $Spotter = new Spotter($this->db); |
677 | 677 | $all = $Spotter->countOverallMilitaryFlights($filters); |
678 | 678 | } |
679 | 679 | return $all; |
680 | 680 | } |
681 | - public function countOverallArrival($stats_airline = '',$filter_name = '') { |
|
681 | + public function countOverallArrival($stats_airline = '', $filter_name = '') { |
|
682 | 682 | global $globalStatsFilters; |
683 | 683 | if ($filter_name == '') $filter_name = $this->filter_name; |
684 | - $all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name); |
|
684 | + $all = $this->getSumStats('realarrivals_bymonth', date('Y'), $stats_airline, $filter_name); |
|
685 | 685 | if (empty($all)) { |
686 | 686 | $filters = array('airlines' => array($stats_airline)); |
687 | 687 | if ($filter_name != '') { |
688 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
688 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
689 | 689 | } |
690 | 690 | $Spotter = new Spotter($this->db); |
691 | 691 | $all = $Spotter->countOverallArrival($filters); |
692 | 692 | } |
693 | 693 | return $all; |
694 | 694 | } |
695 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '') { |
|
695 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '') { |
|
696 | 696 | global $globalStatsFilters; |
697 | 697 | if ($filter_name == '') $filter_name = $this->filter_name; |
698 | - $all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name); |
|
698 | + $all = $this->getSumStats('aircrafts_bymonth', date('Y'), $stats_airline, $filter_name); |
|
699 | 699 | if (empty($all)) { |
700 | 700 | $filters = array('airlines' => array($stats_airline)); |
701 | 701 | if ($filter_name != '') { |
702 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
702 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
703 | 703 | } |
704 | 704 | $Spotter = new Spotter($this->db); |
705 | 705 | $all = $Spotter->countOverallAircrafts($filters); |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | try { |
714 | 714 | $sth = $this->db->prepare($query); |
715 | 715 | $sth->execute(array(':filter_name' => $filter_name)); |
716 | - } catch(PDOException $e) { |
|
716 | + } catch (PDOException $e) { |
|
717 | 717 | echo "error : ".$e->getMessage(); |
718 | 718 | } |
719 | 719 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -722,14 +722,14 @@ discard block |
||
722 | 722 | if (empty($all)) { |
723 | 723 | $filters = array(); |
724 | 724 | if ($filter_name != '') { |
725 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
725 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
726 | 726 | } |
727 | 727 | $Spotter = new Spotter($this->db); |
728 | 728 | $all = $Spotter->countOverallAirlines($filters); |
729 | 729 | } |
730 | 730 | return $all; |
731 | 731 | } |
732 | - public function countOverallOwners($stats_airline = '',$filter_name = '') { |
|
732 | + public function countOverallOwners($stats_airline = '', $filter_name = '') { |
|
733 | 733 | global $globalStatsFilters; |
734 | 734 | if ($filter_name == '') $filter_name = $this->filter_name; |
735 | 735 | /* |
@@ -743,25 +743,25 @@ discard block |
||
743 | 743 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
744 | 744 | $all = $result[0]['nb_owner']; |
745 | 745 | */ |
746 | - $all = $this->getSumStats('owners_bymonth',date('Y'),$stats_airline,$filter_name); |
|
746 | + $all = $this->getSumStats('owners_bymonth', date('Y'), $stats_airline, $filter_name); |
|
747 | 747 | if (empty($all)) { |
748 | 748 | $filters = array('airlines' => array($stats_airline)); |
749 | 749 | if ($filter_name != '') { |
750 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
750 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
751 | 751 | } |
752 | 752 | $Spotter = new Spotter($this->db); |
753 | 753 | $all = $Spotter->countOverallOwners($filters); |
754 | 754 | } |
755 | 755 | return $all; |
756 | 756 | } |
757 | - public function countOverallPilots($stats_airline = '',$filter_name = '') { |
|
757 | + public function countOverallPilots($stats_airline = '', $filter_name = '') { |
|
758 | 758 | global $globalStatsFilters; |
759 | 759 | if ($filter_name == '') $filter_name = $this->filter_name; |
760 | - $all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name); |
|
760 | + $all = $this->getSumStats('pilots_bymonth', date('Y'), $stats_airline, $filter_name); |
|
761 | 761 | if (empty($all)) { |
762 | 762 | $filters = array('airlines' => array($stats_airline)); |
763 | 763 | if ($filter_name != '') { |
764 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
764 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
765 | 765 | } |
766 | 766 | $Spotter = new Spotter($this->db); |
767 | 767 | $all = $Spotter->countOverallPilots($filters); |
@@ -769,33 +769,33 @@ discard block |
||
769 | 769 | return $all; |
770 | 770 | } |
771 | 771 | |
772 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
772 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
773 | 773 | if ($filter_name == '') $filter_name = $this->filter_name; |
774 | 774 | $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"; |
775 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
775 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
776 | 776 | try { |
777 | 777 | $sth = $this->db->prepare($query); |
778 | 778 | $sth->execute($query_values); |
779 | - } catch(PDOException $e) { |
|
779 | + } catch (PDOException $e) { |
|
780 | 780 | echo "error : ".$e->getMessage(); |
781 | 781 | } |
782 | 782 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
783 | 783 | return $all; |
784 | 784 | } |
785 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
785 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
786 | 786 | if ($filter_name == '') $filter_name = $this->filter_name; |
787 | 787 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
788 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
788 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
789 | 789 | try { |
790 | 790 | $sth = $this->db->prepare($query); |
791 | 791 | $sth->execute($query_values); |
792 | - } catch(PDOException $e) { |
|
792 | + } catch (PDOException $e) { |
|
793 | 793 | echo "error : ".$e->getMessage(); |
794 | 794 | } |
795 | 795 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
796 | 796 | return $all; |
797 | 797 | } |
798 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') { |
|
798 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '') { |
|
799 | 799 | if ($filter_name == '') $filter_name = $this->filter_name; |
800 | 800 | global $globalArchiveMonths, $globalDBdriver; |
801 | 801 | if ($globalDBdriver == 'mysql') { |
@@ -803,11 +803,11 @@ discard block |
||
803 | 803 | } else { |
804 | 804 | $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"; |
805 | 805 | } |
806 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
806 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
807 | 807 | try { |
808 | 808 | $sth = $this->db->prepare($query); |
809 | 809 | $sth->execute($query_values); |
810 | - } catch(PDOException $e) { |
|
810 | + } catch (PDOException $e) { |
|
811 | 811 | echo "error : ".$e->getMessage(); |
812 | 812 | } |
813 | 813 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | try { |
826 | 826 | $sth = $this->db->prepare($query); |
827 | 827 | $sth->execute($query_values); |
828 | - } catch(PDOException $e) { |
|
828 | + } catch (PDOException $e) { |
|
829 | 829 | echo "error : ".$e->getMessage(); |
830 | 830 | } |
831 | 831 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | try { |
843 | 843 | $sth = $this->db->prepare($query); |
844 | 844 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
845 | - } catch(PDOException $e) { |
|
845 | + } catch (PDOException $e) { |
|
846 | 846 | echo "error : ".$e->getMessage(); |
847 | 847 | } |
848 | 848 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | try { |
860 | 860 | $sth = $this->db->prepare($query); |
861 | 861 | $sth->execute(array(':filter_name' => $filter_name)); |
862 | - } catch(PDOException $e) { |
|
862 | + } catch (PDOException $e) { |
|
863 | 863 | echo "error : ".$e->getMessage(); |
864 | 864 | } |
865 | 865 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | try { |
877 | 877 | $sth = $this->db->prepare($query); |
878 | 878 | $sth->execute(array(':filter_name' => $filter_name)); |
879 | - } catch(PDOException $e) { |
|
879 | + } catch (PDOException $e) { |
|
880 | 880 | echo "error : ".$e->getMessage(); |
881 | 881 | } |
882 | 882 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -893,14 +893,14 @@ discard block |
||
893 | 893 | try { |
894 | 894 | $sth = $this->db->prepare($query); |
895 | 895 | $sth->execute(array(':filter_name' => $filter_name)); |
896 | - } catch(PDOException $e) { |
|
896 | + } catch (PDOException $e) { |
|
897 | 897 | echo "error : ".$e->getMessage(); |
898 | 898 | } |
899 | 899 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
900 | 900 | return $all[0]['total']; |
901 | 901 | } |
902 | 902 | |
903 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
903 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
904 | 904 | global $globalDBdriver; |
905 | 905 | if ($filter_name == '') $filter_name = $this->filter_name; |
906 | 906 | if ($globalDBdriver == 'mysql') { |
@@ -908,15 +908,15 @@ discard block |
||
908 | 908 | } else { |
909 | 909 | $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);"; |
910 | 910 | } |
911 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
911 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
912 | 912 | try { |
913 | 913 | $sth = $this->db->prepare($query); |
914 | 914 | $sth->execute($query_values); |
915 | - } catch(PDOException $e) { |
|
915 | + } catch (PDOException $e) { |
|
916 | 916 | return "error : ".$e->getMessage(); |
917 | 917 | } |
918 | 918 | } |
919 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
919 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
920 | 920 | global $globalDBdriver; |
921 | 921 | if ($filter_name == '') $filter_name = $this->filter_name; |
922 | 922 | if ($globalDBdriver == 'mysql') { |
@@ -925,219 +925,219 @@ discard block |
||
925 | 925 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
926 | 926 | $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);"; |
927 | 927 | } |
928 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
928 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
929 | 929 | try { |
930 | 930 | $sth = $this->db->prepare($query); |
931 | 931 | $sth->execute($query_values); |
932 | - } catch(PDOException $e) { |
|
932 | + } catch (PDOException $e) { |
|
933 | 933 | return "error : ".$e->getMessage(); |
934 | 934 | } |
935 | 935 | } |
936 | - public function getStatsSource($date,$stats_type = '') { |
|
936 | + public function getStatsSource($date, $stats_type = '') { |
|
937 | 937 | if ($stats_type == '') { |
938 | 938 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
939 | 939 | $query_values = array(':date' => $date); |
940 | 940 | } else { |
941 | 941 | $query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name"; |
942 | - $query_values = array(':date' => $date,':stats_type' => $stats_type); |
|
942 | + $query_values = array(':date' => $date, ':stats_type' => $stats_type); |
|
943 | 943 | } |
944 | 944 | try { |
945 | 945 | $sth = $this->db->prepare($query); |
946 | 946 | $sth->execute($query_values); |
947 | - } catch(PDOException $e) { |
|
947 | + } catch (PDOException $e) { |
|
948 | 948 | echo "error : ".$e->getMessage(); |
949 | 949 | } |
950 | 950 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
951 | 951 | return $all; |
952 | 952 | } |
953 | 953 | |
954 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
954 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
955 | 955 | global $globalDBdriver; |
956 | 956 | if ($globalDBdriver == 'mysql') { |
957 | 957 | $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"; |
958 | 958 | } else { |
959 | 959 | $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);"; |
960 | 960 | } |
961 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
961 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
962 | 962 | try { |
963 | 963 | $sth = $this->db->prepare($query); |
964 | 964 | $sth->execute($query_values); |
965 | - } catch(PDOException $e) { |
|
965 | + } catch (PDOException $e) { |
|
966 | 966 | return "error : ".$e->getMessage(); |
967 | 967 | } |
968 | 968 | } |
969 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
969 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
970 | 970 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
971 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
971 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
972 | 972 | try { |
973 | 973 | $sth = $this->db->prepare($query); |
974 | 974 | $sth->execute($query_values); |
975 | - } catch(PDOException $e) { |
|
975 | + } catch (PDOException $e) { |
|
976 | 976 | return "error : ".$e->getMessage(); |
977 | 977 | } |
978 | 978 | } |
979 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') { |
|
979 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '') { |
|
980 | 980 | global $globalDBdriver; |
981 | 981 | if ($globalDBdriver == 'mysql') { |
982 | 982 | $query = "INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) VALUES (:aircraft_icao,:registration,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
983 | 983 | } else { |
984 | 984 | $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);"; |
985 | 985 | } |
986 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
986 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
987 | 987 | try { |
988 | 988 | $sth = $this->db->prepare($query); |
989 | 989 | $sth->execute($query_values); |
990 | - } catch(PDOException $e) { |
|
990 | + } catch (PDOException $e) { |
|
991 | 991 | return "error : ".$e->getMessage(); |
992 | 992 | } |
993 | 993 | } |
994 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') { |
|
994 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '') { |
|
995 | 995 | global $globalDBdriver; |
996 | 996 | if ($globalDBdriver == 'mysql') { |
997 | 997 | $query = "INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) VALUES (:callsign_icao,:airline_icao,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
998 | 998 | } else { |
999 | 999 | $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);"; |
1000 | 1000 | } |
1001 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1001 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1002 | 1002 | try { |
1003 | 1003 | $sth = $this->db->prepare($query); |
1004 | 1004 | $sth->execute($query_values); |
1005 | - } catch(PDOException $e) { |
|
1005 | + } catch (PDOException $e) { |
|
1006 | 1006 | return "error : ".$e->getMessage(); |
1007 | 1007 | } |
1008 | 1008 | } |
1009 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') { |
|
1009 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '') { |
|
1010 | 1010 | global $globalDBdriver; |
1011 | 1011 | if ($globalDBdriver == 'mysql') { |
1012 | 1012 | $query = "INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) VALUES (:iso2,:iso3,:name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
1013 | 1013 | } else { |
1014 | 1014 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; |
1015 | 1015 | } |
1016 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1016 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1017 | 1017 | try { |
1018 | 1018 | $sth = $this->db->prepare($query); |
1019 | 1019 | $sth->execute($query_values); |
1020 | - } catch(PDOException $e) { |
|
1020 | + } catch (PDOException $e) { |
|
1021 | 1021 | return "error : ".$e->getMessage(); |
1022 | 1022 | } |
1023 | 1023 | } |
1024 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
|
1024 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
|
1025 | 1025 | global $globalDBdriver; |
1026 | 1026 | if ($globalDBdriver == 'mysql') { |
1027 | 1027 | $query = "INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline, filter_name) VALUES (:aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, stats_airline = :stats_airline"; |
1028 | 1028 | } else { |
1029 | 1029 | $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);"; |
1030 | 1030 | } |
1031 | - $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); |
|
1031 | + $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); |
|
1032 | 1032 | try { |
1033 | 1033 | $sth = $this->db->prepare($query); |
1034 | 1034 | $sth->execute($query_values); |
1035 | - } catch(PDOException $e) { |
|
1035 | + } catch (PDOException $e) { |
|
1036 | 1036 | return "error : ".$e->getMessage(); |
1037 | 1037 | } |
1038 | 1038 | } |
1039 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') { |
|
1039 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '') { |
|
1040 | 1040 | global $globalDBdriver; |
1041 | 1041 | if ($globalDBdriver == 'mysql') { |
1042 | 1042 | $query = "INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) VALUES (:airline_icao,:airline_name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt,airline_name = :airline_name"; |
1043 | 1043 | } else { |
1044 | 1044 | $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);"; |
1045 | 1045 | } |
1046 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1046 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1047 | 1047 | try { |
1048 | 1048 | $sth = $this->db->prepare($query); |
1049 | 1049 | $sth->execute($query_values); |
1050 | - } catch(PDOException $e) { |
|
1050 | + } catch (PDOException $e) { |
|
1051 | 1051 | return "error : ".$e->getMessage(); |
1052 | 1052 | } |
1053 | 1053 | } |
1054 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') { |
|
1054 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
1055 | 1055 | global $globalDBdriver; |
1056 | 1056 | if ($globalDBdriver == 'mysql') { |
1057 | 1057 | $query = "INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) VALUES (:owner_name,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
1058 | 1058 | } else { |
1059 | 1059 | $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);"; |
1060 | 1060 | } |
1061 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1061 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1062 | 1062 | try { |
1063 | 1063 | $sth = $this->db->prepare($query); |
1064 | 1064 | $sth->execute($query_values); |
1065 | - } catch(PDOException $e) { |
|
1065 | + } catch (PDOException $e) { |
|
1066 | 1066 | return "error : ".$e->getMessage(); |
1067 | 1067 | } |
1068 | 1068 | } |
1069 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '') { |
|
1069 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '') { |
|
1070 | 1070 | global $globalDBdriver; |
1071 | 1071 | if ($globalDBdriver == 'mysql') { |
1072 | 1072 | $query = "INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) VALUES (:pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, pilot_name = :pilot_name"; |
1073 | 1073 | } else { |
1074 | 1074 | $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);"; |
1075 | 1075 | } |
1076 | - $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); |
|
1076 | + $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); |
|
1077 | 1077 | try { |
1078 | 1078 | $sth = $this->db->prepare($query); |
1079 | 1079 | $sth->execute($query_values); |
1080 | - } catch(PDOException $e) { |
|
1080 | + } catch (PDOException $e) { |
|
1081 | 1081 | return "error : ".$e->getMessage(); |
1082 | 1082 | } |
1083 | 1083 | } |
1084 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1084 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1085 | 1085 | global $globalDBdriver; |
1086 | 1086 | if ($globalDBdriver == 'mysql') { |
1087 | 1087 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = departure+:departure"; |
1088 | 1088 | } else { |
1089 | 1089 | $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);"; |
1090 | 1090 | } |
1091 | - $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); |
|
1091 | + $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); |
|
1092 | 1092 | try { |
1093 | 1093 | $sth = $this->db->prepare($query); |
1094 | 1094 | $sth->execute($query_values); |
1095 | - } catch(PDOException $e) { |
|
1095 | + } catch (PDOException $e) { |
|
1096 | 1096 | return "error : ".$e->getMessage(); |
1097 | 1097 | } |
1098 | 1098 | } |
1099 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1099 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1100 | 1100 | global $globalDBdriver; |
1101 | 1101 | if ($globalDBdriver == 'mysql') { |
1102 | 1102 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = :departure"; |
1103 | 1103 | } else { |
1104 | 1104 | $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);"; |
1105 | 1105 | } |
1106 | - $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); |
|
1106 | + $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); |
|
1107 | 1107 | try { |
1108 | 1108 | $sth = $this->db->prepare($query); |
1109 | 1109 | $sth->execute($query_values); |
1110 | - } catch(PDOException $e) { |
|
1110 | + } catch (PDOException $e) { |
|
1111 | 1111 | return "error : ".$e->getMessage(); |
1112 | 1112 | } |
1113 | 1113 | } |
1114 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1114 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1115 | 1115 | global $globalDBdriver; |
1116 | 1116 | if ($globalDBdriver == 'mysql') { |
1117 | 1117 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = arrival+:arrival"; |
1118 | 1118 | } else { |
1119 | 1119 | $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);"; |
1120 | 1120 | } |
1121 | - $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); |
|
1121 | + $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); |
|
1122 | 1122 | try { |
1123 | 1123 | $sth = $this->db->prepare($query); |
1124 | 1124 | $sth->execute($query_values); |
1125 | - } catch(PDOException $e) { |
|
1125 | + } catch (PDOException $e) { |
|
1126 | 1126 | return "error : ".$e->getMessage(); |
1127 | 1127 | } |
1128 | 1128 | } |
1129 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1129 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1130 | 1130 | global $globalDBdriver; |
1131 | 1131 | if ($globalDBdriver == 'mysql') { |
1132 | 1132 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = :arrival"; |
1133 | 1133 | } else { |
1134 | 1134 | $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);"; |
1135 | 1135 | } |
1136 | - $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); |
|
1136 | + $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); |
|
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 | } |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | try { |
1149 | 1149 | $sth = $this->db->prepare($query); |
1150 | 1150 | $sth->execute($query_values); |
1151 | - } catch(PDOException $e) { |
|
1151 | + } catch (PDOException $e) { |
|
1152 | 1152 | return "error : ".$e->getMessage(); |
1153 | 1153 | } |
1154 | 1154 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | try { |
1159 | 1159 | $sth = $this->db->prepare($query); |
1160 | 1160 | $sth->execute($query_values); |
1161 | - } catch(PDOException $e) { |
|
1161 | + } catch (PDOException $e) { |
|
1162 | 1162 | return "error : ".$e->getMessage(); |
1163 | 1163 | } |
1164 | 1164 | } |
@@ -1168,13 +1168,13 @@ discard block |
||
1168 | 1168 | try { |
1169 | 1169 | $sth = $this->db->prepare($query); |
1170 | 1170 | $sth->execute($query_values); |
1171 | - } catch(PDOException $e) { |
|
1171 | + } catch (PDOException $e) { |
|
1172 | 1172 | return "error : ".$e->getMessage(); |
1173 | 1173 | } |
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | public function addOldStats() { |
1177 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats; |
|
1177 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats; |
|
1178 | 1178 | $Common = new Common(); |
1179 | 1179 | $Connection = new Connection(); |
1180 | 1180 | date_default_timezone_set('UTC'); |
@@ -1407,40 +1407,40 @@ discard block |
||
1407 | 1407 | $last_update_day = $last_update[0]['value']; |
1408 | 1408 | } else $last_update_day = '2012-12-12 12:12:12'; |
1409 | 1409 | $Spotter = new Spotter($this->db); |
1410 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1410 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
1411 | 1411 | foreach ($alldata as $number) { |
1412 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']); |
|
1412 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']); |
|
1413 | 1413 | } |
1414 | 1414 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
1415 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
1415 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
1416 | 1416 | foreach ($alldata as $number) { |
1417 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']); |
|
1417 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']); |
|
1418 | 1418 | } |
1419 | 1419 | if ($globalDebug) echo 'Count all registrations...'."\n"; |
1420 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
1420 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
1421 | 1421 | foreach ($alldata as $number) { |
1422 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']); |
|
1422 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']); |
|
1423 | 1423 | } |
1424 | 1424 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
1425 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
1425 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
1426 | 1426 | foreach ($alldata as $number) { |
1427 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
1427 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
1428 | 1428 | } |
1429 | 1429 | if ($globalDebug) echo 'Count all owners...'."\n"; |
1430 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
1430 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
1431 | 1431 | foreach ($alldata as $number) { |
1432 | - $this->addStatOwner($number['owner_name'],$number['owner_count']); |
|
1432 | + $this->addStatOwner($number['owner_name'], $number['owner_count']); |
|
1433 | 1433 | } |
1434 | 1434 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
1435 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
1435 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
1436 | 1436 | foreach ($alldata as $number) { |
1437 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source']); |
|
1437 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source']); |
|
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
1441 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
1441 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
1442 | 1442 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
1443 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1443 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
1444 | 1444 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
1445 | 1445 | $alldata = array(); |
1446 | 1446 | |
@@ -1458,14 +1458,14 @@ discard block |
||
1458 | 1458 | foreach ($alldata as $key => $row) { |
1459 | 1459 | $count[$key] = $row['airport_departure_icao_count']; |
1460 | 1460 | } |
1461 | - array_multisort($count,SORT_DESC,$alldata); |
|
1461 | + array_multisort($count, SORT_DESC, $alldata); |
|
1462 | 1462 | foreach ($alldata as $number) { |
1463 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']); |
|
1463 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count']); |
|
1464 | 1464 | } |
1465 | 1465 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
1466 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
1466 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
1467 | 1467 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
1468 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1468 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
1469 | 1469 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
1470 | 1470 | $alldata = array(); |
1471 | 1471 | foreach ($pall as $value) { |
@@ -1482,16 +1482,16 @@ discard block |
||
1482 | 1482 | foreach ($alldata as $key => $row) { |
1483 | 1483 | $count[$key] = $row['airport_arrival_icao_count']; |
1484 | 1484 | } |
1485 | - array_multisort($count,SORT_DESC,$alldata); |
|
1485 | + array_multisort($count, SORT_DESC, $alldata); |
|
1486 | 1486 | foreach ($alldata as $number) { |
1487 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']); |
|
1487 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count']); |
|
1488 | 1488 | } |
1489 | 1489 | if ($Connection->tableExists('countries')) { |
1490 | 1490 | if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
1491 | 1491 | $SpotterArchive = new SpotterArchive(); |
1492 | - $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
1492 | + $alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day); |
|
1493 | 1493 | foreach ($alldata as $number) { |
1494 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']); |
|
1494 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']); |
|
1495 | 1495 | } |
1496 | 1496 | } |
1497 | 1497 | |
@@ -1505,37 +1505,37 @@ discard block |
||
1505 | 1505 | $lastyear = false; |
1506 | 1506 | foreach ($alldata as $number) { |
1507 | 1507 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1508 | - $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']))); |
|
1508 | + $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']))); |
|
1509 | 1509 | } |
1510 | 1510 | if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
1511 | 1511 | $alldata = $Spotter->countAllMilitaryMonths(); |
1512 | 1512 | foreach ($alldata as $number) { |
1513 | - $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']))); |
|
1513 | + $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']))); |
|
1514 | 1514 | } |
1515 | 1515 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
1516 | 1516 | $alldata = $Spotter->countAllMonthsOwners(); |
1517 | 1517 | foreach ($alldata as $number) { |
1518 | - $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']))); |
|
1518 | + $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']))); |
|
1519 | 1519 | } |
1520 | 1520 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
1521 | 1521 | $alldata = $Spotter->countAllMonthsPilots(); |
1522 | 1522 | foreach ($alldata as $number) { |
1523 | - $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']))); |
|
1523 | + $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']))); |
|
1524 | 1524 | } |
1525 | 1525 | if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
1526 | 1526 | $alldata = $Spotter->countAllMonthsAirlines(); |
1527 | 1527 | foreach ($alldata as $number) { |
1528 | - $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']))); |
|
1528 | + $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']))); |
|
1529 | 1529 | } |
1530 | 1530 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
1531 | 1531 | $alldata = $Spotter->countAllMonthsAircrafts(); |
1532 | 1532 | foreach ($alldata as $number) { |
1533 | - $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']))); |
|
1533 | + $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']))); |
|
1534 | 1534 | } |
1535 | 1535 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
1536 | 1536 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
1537 | 1537 | foreach ($alldata as $number) { |
1538 | - $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']))); |
|
1538 | + $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']))); |
|
1539 | 1539 | } |
1540 | 1540 | if ($globalDebug) echo 'Airports data...'."\n"; |
1541 | 1541 | if ($globalDebug) echo '...Departure'."\n"; |
@@ -1580,7 +1580,7 @@ discard block |
||
1580 | 1580 | } |
1581 | 1581 | $alldata = $pall; |
1582 | 1582 | foreach ($alldata as $number) { |
1583 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
1583 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
1584 | 1584 | } |
1585 | 1585 | echo '...Arrival'."\n"; |
1586 | 1586 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | } |
1623 | 1623 | $alldata = $pall; |
1624 | 1624 | foreach ($alldata as $number) { |
1625 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
1625 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
1626 | 1626 | } |
1627 | 1627 | |
1628 | 1628 | echo 'Flights data...'."\n"; |
@@ -1630,28 +1630,28 @@ discard block |
||
1630 | 1630 | echo '-> countAllDatesLastMonth...'."\n"; |
1631 | 1631 | $alldata = $Spotter->countAllDatesLastMonth(); |
1632 | 1632 | foreach ($alldata as $number) { |
1633 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
1633 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
1634 | 1634 | } |
1635 | 1635 | echo '-> countAllDates...'."\n"; |
1636 | 1636 | $previousdata = $this->countAllDates(); |
1637 | 1637 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
1638 | 1638 | $this->deleteStatFlight('date'); |
1639 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates()); |
|
1639 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates()); |
|
1640 | 1640 | $values = array(); |
1641 | 1641 | foreach ($alldata as $cnt) { |
1642 | 1642 | $values[] = $cnt['date_count']; |
1643 | 1643 | } |
1644 | - array_multisort($values,SORT_DESC,$alldata); |
|
1645 | - array_splice($alldata,11); |
|
1644 | + array_multisort($values, SORT_DESC, $alldata); |
|
1645 | + array_splice($alldata, 11); |
|
1646 | 1646 | foreach ($alldata as $number) { |
1647 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
1647 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
1648 | 1648 | } |
1649 | 1649 | |
1650 | 1650 | $this->deleteStatFlight('hour'); |
1651 | 1651 | echo '-> countAllHours...'."\n"; |
1652 | 1652 | $alldata = $Spotter->countAllHours('hour'); |
1653 | 1653 | foreach ($alldata as $number) { |
1654 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
1654 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
1655 | 1655 | } |
1656 | 1656 | |
1657 | 1657 | |
@@ -1660,34 +1660,34 @@ discard block |
||
1660 | 1660 | echo '--- Stats by airlines ---'."\n"; |
1661 | 1661 | if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
1662 | 1662 | $Spotter = new Spotter($this->db); |
1663 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
1663 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
1664 | 1664 | foreach ($alldata as $number) { |
1665 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']); |
|
1665 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']); |
|
1666 | 1666 | } |
1667 | 1667 | if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
1668 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
1668 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
1669 | 1669 | foreach ($alldata as $number) { |
1670 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']); |
|
1670 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']); |
|
1671 | 1671 | } |
1672 | 1672 | if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
1673 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
1673 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
1674 | 1674 | foreach ($alldata as $number) { |
1675 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
1675 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
1676 | 1676 | } |
1677 | 1677 | if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
1678 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
1678 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
1679 | 1679 | foreach ($alldata as $number) { |
1680 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']); |
|
1680 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']); |
|
1681 | 1681 | } |
1682 | 1682 | if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
1683 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
1683 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
1684 | 1684 | foreach ($alldata as $number) { |
1685 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source']); |
|
1685 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source']); |
|
1686 | 1686 | } |
1687 | 1687 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
1688 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1688 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1689 | 1689 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
1690 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1690 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1691 | 1691 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
1692 | 1692 | //$alldata = array(); |
1693 | 1693 | foreach ($dall as $value) { |
@@ -1707,12 +1707,12 @@ discard block |
||
1707 | 1707 | } |
1708 | 1708 | $alldata = $pall; |
1709 | 1709 | foreach ($alldata as $number) { |
1710 | - 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']); |
|
1710 | + 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']); |
|
1711 | 1711 | } |
1712 | 1712 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
1713 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1713 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1714 | 1714 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
1715 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1715 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1716 | 1716 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
1717 | 1717 | //$alldata = array(); |
1718 | 1718 | foreach ($dall as $value) { |
@@ -1732,7 +1732,7 @@ discard block |
||
1732 | 1732 | } |
1733 | 1733 | $alldata = $pall; |
1734 | 1734 | foreach ($alldata as $number) { |
1735 | - 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']); |
|
1735 | + 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']); |
|
1736 | 1736 | } |
1737 | 1737 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
1738 | 1738 | $Spotter = new Spotter($this->db); |
@@ -1740,27 +1740,27 @@ discard block |
||
1740 | 1740 | $lastyear = false; |
1741 | 1741 | foreach ($alldata as $number) { |
1742 | 1742 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1743 | - $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']); |
|
1743 | + $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']); |
|
1744 | 1744 | } |
1745 | 1745 | if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
1746 | 1746 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
1747 | 1747 | foreach ($alldata as $number) { |
1748 | - $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']); |
|
1748 | + $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']); |
|
1749 | 1749 | } |
1750 | 1750 | if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
1751 | 1751 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
1752 | 1752 | foreach ($alldata as $number) { |
1753 | - $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']); |
|
1753 | + $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']); |
|
1754 | 1754 | } |
1755 | 1755 | if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
1756 | 1756 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
1757 | 1757 | foreach ($alldata as $number) { |
1758 | - $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']); |
|
1758 | + $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']); |
|
1759 | 1759 | } |
1760 | 1760 | if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
1761 | 1761 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
1762 | 1762 | foreach ($alldata as $number) { |
1763 | - $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']); |
|
1763 | + $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']); |
|
1764 | 1764 | } |
1765 | 1765 | if ($globalDebug) echo '...Departure'."\n"; |
1766 | 1766 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -1783,7 +1783,7 @@ discard block |
||
1783 | 1783 | } |
1784 | 1784 | $alldata = $pall; |
1785 | 1785 | foreach ($alldata as $number) { |
1786 | - $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']); |
|
1786 | + $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']); |
|
1787 | 1787 | } |
1788 | 1788 | if ($globalDebug) echo '...Arrival'."\n"; |
1789 | 1789 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -1806,32 +1806,32 @@ discard block |
||
1806 | 1806 | } |
1807 | 1807 | $alldata = $pall; |
1808 | 1808 | foreach ($alldata as $number) { |
1809 | - $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']); |
|
1809 | + $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']); |
|
1810 | 1810 | } |
1811 | 1811 | |
1812 | 1812 | if ($globalDebug) echo 'Flights data...'."\n"; |
1813 | 1813 | if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
1814 | 1814 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
1815 | 1815 | foreach ($alldata as $number) { |
1816 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
1816 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1817 | 1817 | } |
1818 | 1818 | if ($globalDebug) echo '-> countAllDates...'."\n"; |
1819 | 1819 | //$previousdata = $this->countAllDatesByAirlines(); |
1820 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
|
1820 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines()); |
|
1821 | 1821 | $values = array(); |
1822 | 1822 | foreach ($alldata as $cnt) { |
1823 | 1823 | $values[] = $cnt['date_count']; |
1824 | 1824 | } |
1825 | - array_multisort($values,SORT_DESC,$alldata); |
|
1826 | - array_splice($alldata,11); |
|
1825 | + array_multisort($values, SORT_DESC, $alldata); |
|
1826 | + array_splice($alldata, 11); |
|
1827 | 1827 | foreach ($alldata as $number) { |
1828 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
1828 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1829 | 1829 | } |
1830 | 1830 | |
1831 | 1831 | if ($globalDebug) echo '-> countAllHours...'."\n"; |
1832 | 1832 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
1833 | 1833 | foreach ($alldata as $number) { |
1834 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
1834 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
1835 | 1835 | } |
1836 | 1836 | |
1837 | 1837 | |
@@ -1848,32 +1848,32 @@ discard block |
||
1848 | 1848 | // Count by filter |
1849 | 1849 | if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
1850 | 1850 | $Spotter = new Spotter($this->db); |
1851 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
1851 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
1852 | 1852 | foreach ($alldata as $number) { |
1853 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name); |
|
1853 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name); |
|
1854 | 1854 | } |
1855 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
1855 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
1856 | 1856 | foreach ($alldata as $number) { |
1857 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name); |
|
1857 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name); |
|
1858 | 1858 | } |
1859 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
1859 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
1860 | 1860 | foreach ($alldata as $number) { |
1861 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name); |
|
1861 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name); |
|
1862 | 1862 | } |
1863 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
1863 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
1864 | 1864 | foreach ($alldata as $number) { |
1865 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name); |
|
1865 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name); |
|
1866 | 1866 | } |
1867 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
1867 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
1868 | 1868 | foreach ($alldata as $number) { |
1869 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name); |
|
1869 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name); |
|
1870 | 1870 | } |
1871 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
1871 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
1872 | 1872 | foreach ($alldata as $number) { |
1873 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source']); |
|
1873 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source']); |
|
1874 | 1874 | } |
1875 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
1876 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
1875 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
1876 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
1877 | 1877 | $alldata = array(); |
1878 | 1878 | foreach ($pall as $value) { |
1879 | 1879 | $icao = $value['airport_departure_icao']; |
@@ -1889,12 +1889,12 @@ discard block |
||
1889 | 1889 | foreach ($alldata as $key => $row) { |
1890 | 1890 | $count[$key] = $row['airport_departure_icao_count']; |
1891 | 1891 | } |
1892 | - array_multisort($count,SORT_DESC,$alldata); |
|
1892 | + array_multisort($count, SORT_DESC, $alldata); |
|
1893 | 1893 | foreach ($alldata as $number) { |
1894 | - 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); |
|
1894 | + 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); |
|
1895 | 1895 | } |
1896 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
|
1897 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
1896 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
1897 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
1898 | 1898 | $alldata = array(); |
1899 | 1899 | foreach ($pall as $value) { |
1900 | 1900 | $icao = $value['airport_arrival_icao']; |
@@ -1910,40 +1910,40 @@ discard block |
||
1910 | 1910 | foreach ($alldata as $key => $row) { |
1911 | 1911 | $count[$key] = $row['airport_arrival_icao_count']; |
1912 | 1912 | } |
1913 | - array_multisort($count,SORT_DESC,$alldata); |
|
1913 | + array_multisort($count, SORT_DESC, $alldata); |
|
1914 | 1914 | foreach ($alldata as $number) { |
1915 | - 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); |
|
1915 | + 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); |
|
1916 | 1916 | } |
1917 | 1917 | $Spotter = new Spotter($this->db); |
1918 | 1918 | $alldata = $Spotter->countAllMonths($filter); |
1919 | 1919 | $lastyear = false; |
1920 | 1920 | foreach ($alldata as $number) { |
1921 | 1921 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1922 | - $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); |
|
1922 | + $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); |
|
1923 | 1923 | } |
1924 | 1924 | $alldata = $Spotter->countAllMonthsOwners($filter); |
1925 | 1925 | foreach ($alldata as $number) { |
1926 | - $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); |
|
1926 | + $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); |
|
1927 | 1927 | } |
1928 | 1928 | $alldata = $Spotter->countAllMonthsPilots($filter); |
1929 | 1929 | foreach ($alldata as $number) { |
1930 | - $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); |
|
1930 | + $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); |
|
1931 | 1931 | } |
1932 | 1932 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
1933 | 1933 | foreach ($alldata as $number) { |
1934 | - $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); |
|
1934 | + $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); |
|
1935 | 1935 | } |
1936 | 1936 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
1937 | 1937 | foreach ($alldata as $number) { |
1938 | - $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); |
|
1938 | + $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); |
|
1939 | 1939 | } |
1940 | 1940 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
1941 | 1941 | foreach ($alldata as $number) { |
1942 | - $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); |
|
1942 | + $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); |
|
1943 | 1943 | } |
1944 | 1944 | echo '...Departure'."\n"; |
1945 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
1946 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
1945 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
1946 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
1947 | 1947 | foreach ($dall as $value) { |
1948 | 1948 | $icao = $value['departure_airport_icao']; |
1949 | 1949 | $ddate = $value['date']; |
@@ -1961,11 +1961,11 @@ discard block |
||
1961 | 1961 | } |
1962 | 1962 | $alldata = $pall; |
1963 | 1963 | foreach ($alldata as $number) { |
1964 | - $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); |
|
1964 | + $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); |
|
1965 | 1965 | } |
1966 | 1966 | echo '...Arrival'."\n"; |
1967 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
1968 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
1967 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
1968 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
1969 | 1969 | foreach ($dall as $value) { |
1970 | 1970 | $icao = $value['arrival_airport_icao']; |
1971 | 1971 | $ddate = $value['date']; |
@@ -1983,40 +1983,40 @@ discard block |
||
1983 | 1983 | } |
1984 | 1984 | $alldata = $pall; |
1985 | 1985 | foreach ($alldata as $number) { |
1986 | - $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); |
|
1986 | + $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); |
|
1987 | 1987 | } |
1988 | 1988 | |
1989 | 1989 | echo 'Flights data...'."\n"; |
1990 | 1990 | echo '-> countAllDatesLastMonth...'."\n"; |
1991 | 1991 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
1992 | 1992 | foreach ($alldata as $number) { |
1993 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
1993 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
1994 | 1994 | } |
1995 | 1995 | echo '-> countAllDates...'."\n"; |
1996 | - $previousdata = $this->countAllDates('',$filter_name); |
|
1997 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
1996 | + $previousdata = $this->countAllDates('', $filter_name); |
|
1997 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
1998 | 1998 | $values = array(); |
1999 | 1999 | foreach ($alldata as $cnt) { |
2000 | 2000 | $values[] = $cnt['date_count']; |
2001 | 2001 | } |
2002 | - array_multisort($values,SORT_DESC,$alldata); |
|
2003 | - array_splice($alldata,11); |
|
2002 | + array_multisort($values, SORT_DESC, $alldata); |
|
2003 | + array_splice($alldata, 11); |
|
2004 | 2004 | foreach ($alldata as $number) { |
2005 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
2005 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2006 | 2006 | } |
2007 | 2007 | |
2008 | 2008 | echo '-> countAllHours...'."\n"; |
2009 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
2009 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
2010 | 2010 | foreach ($alldata as $number) { |
2011 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
2011 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
2012 | 2012 | } |
2013 | 2013 | echo 'Insert last stats update date...'."\n"; |
2014 | 2014 | date_default_timezone_set('UTC'); |
2015 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
2015 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
|
2016 | 2016 | if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
2017 | - if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2017 | + if (date('Y', strtotime($last_update_day)) != date('Y')) { |
|
2018 | 2018 | $this->deleteOldStats($filter_name); |
2019 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
2019 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
|
2020 | 2020 | } |
2021 | 2021 | } |
2022 | 2022 | |
@@ -2029,16 +2029,16 @@ discard block |
||
2029 | 2029 | // SUM all previous month to put as year |
2030 | 2030 | $previous_year = date('Y'); |
2031 | 2031 | $previous_year--; |
2032 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2033 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2034 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2035 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2032 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2033 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2034 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2035 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2036 | 2036 | $allairlines = $this->getAllAirlineNames(); |
2037 | 2037 | foreach ($allairlines as $data) { |
2038 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2039 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2040 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2041 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2038 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2039 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2040 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2041 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2042 | 2042 | } |
2043 | 2043 | |
2044 | 2044 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -2047,7 +2047,7 @@ discard block |
||
2047 | 2047 | try { |
2048 | 2048 | $sth = $this->db->prepare($query); |
2049 | 2049 | $sth->execute(); |
2050 | - } catch(PDOException $e) { |
|
2050 | + } catch (PDOException $e) { |
|
2051 | 2051 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2052 | 2052 | } |
2053 | 2053 | } |
@@ -2056,15 +2056,15 @@ discard block |
||
2056 | 2056 | try { |
2057 | 2057 | $sth = $this->db->prepare($query); |
2058 | 2058 | $sth->execute(); |
2059 | - } catch(PDOException $e) { |
|
2059 | + } catch (PDOException $e) { |
|
2060 | 2060 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2061 | 2061 | } |
2062 | 2062 | } |
2063 | 2063 | if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
2064 | 2064 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
2065 | - if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
2065 | + if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
|
2066 | 2066 | $this->deleteOldStats(); |
2067 | - $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
2067 | + $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
|
2068 | 2068 | $lastyearupdate = true; |
2069 | 2069 | } |
2070 | 2070 | } |
@@ -2086,7 +2086,7 @@ discard block |
||
2086 | 2086 | try { |
2087 | 2087 | $sth = $this->db->prepare($query); |
2088 | 2088 | $sth->execute(); |
2089 | - } catch(PDOException $e) { |
|
2089 | + } catch (PDOException $e) { |
|
2090 | 2090 | return "error : ".$e->getMessage(); |
2091 | 2091 | } |
2092 | 2092 | } |
@@ -2100,14 +2100,14 @@ discard block |
||
2100 | 2100 | try { |
2101 | 2101 | $sth = $this->db->prepare($query); |
2102 | 2102 | $sth->execute(); |
2103 | - } catch(PDOException $e) { |
|
2103 | + } catch (PDOException $e) { |
|
2104 | 2104 | return "error : ".$e->getMessage(); |
2105 | 2105 | } |
2106 | 2106 | } |
2107 | 2107 | if (!isset($lastyearupdate)) { |
2108 | 2108 | echo 'Insert last stats update date...'."\n"; |
2109 | 2109 | date_default_timezone_set('UTC'); |
2110 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
2110 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
2111 | 2111 | } |
2112 | 2112 | //} |
2113 | 2113 | } |