@@ -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); |
@@ -46,43 +46,43 @@ discard block |
||
46 | 46 | try { |
47 | 47 | $sth = $this->db->prepare($query); |
48 | 48 | $sth->execute(array(':filter_name' => $filter_name)); |
49 | - } catch(PDOException $e) { |
|
49 | + } catch (PDOException $e) { |
|
50 | 50 | echo "error : ".$e->getMessage(); |
51 | 51 | } |
52 | 52 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
53 | 53 | return $all; |
54 | 54 | } |
55 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
55 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
56 | 56 | if ($filter_name == '') $filter_name = $this->filter_name; |
57 | 57 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
58 | 58 | try { |
59 | 59 | $sth = $this->db->prepare($query); |
60 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
61 | - } catch(PDOException $e) { |
|
60 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
61 | + } catch (PDOException $e) { |
|
62 | 62 | echo "error : ".$e->getMessage(); |
63 | 63 | } |
64 | 64 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
65 | 65 | return $all; |
66 | 66 | } |
67 | - public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
67 | + public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
|
68 | 68 | if ($filter_name == '') $filter_name = $this->filter_name; |
69 | 69 | $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"; |
70 | 70 | try { |
71 | 71 | $sth = $this->db->prepare($query); |
72 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
73 | - } catch(PDOException $e) { |
|
72 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
73 | + } catch (PDOException $e) { |
|
74 | 74 | echo "error : ".$e->getMessage(); |
75 | 75 | } |
76 | 76 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
77 | 77 | return $all; |
78 | 78 | } |
79 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
79 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
80 | 80 | if ($filter_name == '') $filter_name = $this->filter_name; |
81 | 81 | $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"; |
82 | 82 | try { |
83 | 83 | $sth = $this->db->prepare($query); |
84 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
85 | - } catch(PDOException $e) { |
|
84 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
85 | + } catch (PDOException $e) { |
|
86 | 86 | echo "error : ".$e->getMessage(); |
87 | 87 | } |
88 | 88 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -97,22 +97,22 @@ discard block |
||
97 | 97 | 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"; |
98 | 98 | try { |
99 | 99 | $sth = $this->db->prepare($query); |
100 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
101 | - } catch(PDOException $e) { |
|
100 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
101 | + } catch (PDOException $e) { |
|
102 | 102 | echo "error : ".$e->getMessage(); |
103 | 103 | } |
104 | 104 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
105 | 105 | if (empty($all)) { |
106 | 106 | $filters = array('airlines' => array($stats_airline)); |
107 | 107 | if ($filter_name != '') { |
108 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
108 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
109 | 109 | } |
110 | 110 | $Spotter = new Spotter($this->db); |
111 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
111 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
112 | 112 | } |
113 | 113 | return $all; |
114 | 114 | } |
115 | - public function countAllAirlineCountries($limit = true,$filter_name = '') { |
|
115 | + public function countAllAirlineCountries($limit = true, $filter_name = '') { |
|
116 | 116 | global $globalStatsFilters; |
117 | 117 | if ($filter_name == '') $filter_name = $this->filter_name; |
118 | 118 | 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"; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | try { |
121 | 121 | $sth = $this->db->prepare($query); |
122 | 122 | $sth->execute(array(':filter_name' => $filter_name)); |
123 | - } catch(PDOException $e) { |
|
123 | + } catch (PDOException $e) { |
|
124 | 124 | echo "error : ".$e->getMessage(); |
125 | 125 | } |
126 | 126 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -128,28 +128,28 @@ discard block |
||
128 | 128 | $Spotter = new Spotter($this->db); |
129 | 129 | $filters = array(); |
130 | 130 | if ($filter_name != '') { |
131 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
131 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
132 | 132 | } |
133 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
133 | + $all = $Spotter->countAllAirlineCountries($limit, $filters); |
|
134 | 134 | } |
135 | 135 | return $all; |
136 | 136 | } |
137 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') { |
|
137 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '') { |
|
138 | 138 | global $globalStatsFilters; |
139 | 139 | if ($filter_name == '') $filter_name = $this->filter_name; |
140 | 140 | 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"; |
141 | 141 | 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"; |
142 | 142 | try { |
143 | 143 | $sth = $this->db->prepare($query); |
144 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
145 | - } catch(PDOException $e) { |
|
144 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
145 | + } catch (PDOException $e) { |
|
146 | 146 | echo "error : ".$e->getMessage(); |
147 | 147 | } |
148 | 148 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
149 | 149 | if (empty($all)) { |
150 | 150 | $filters = array('airlines' => array($stats_airline)); |
151 | 151 | if ($filter_name != '') { |
152 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
152 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
153 | 153 | } |
154 | 154 | $Spotter = new Spotter($this->db); |
155 | 155 | $all = $Spotter->countAllAircraftManufacturers($filters); |
@@ -164,18 +164,18 @@ discard block |
||
164 | 164 | 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"; |
165 | 165 | try { |
166 | 166 | $sth = $this->db->prepare($query); |
167 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
168 | - } catch(PDOException $e) { |
|
167 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
168 | + } catch (PDOException $e) { |
|
169 | 169 | echo "error : ".$e->getMessage(); |
170 | 170 | } |
171 | 171 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
172 | 172 | if (empty($all)) { |
173 | 173 | $filters = array('airlines' => array($stats_airline)); |
174 | 174 | if ($filter_name != '') { |
175 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
175 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
176 | 176 | } |
177 | 177 | $Spotter = new Spotter($this->db); |
178 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
178 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
179 | 179 | } |
180 | 180 | return $all; |
181 | 181 | } |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | 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"; |
187 | 187 | try { |
188 | 188 | $sth = $this->db->prepare($query); |
189 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
190 | - } catch(PDOException $e) { |
|
189 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
190 | + } catch (PDOException $e) { |
|
191 | 191 | echo "error : ".$e->getMessage(); |
192 | 192 | } |
193 | 193 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
194 | 194 | if (empty($all)) { |
195 | 195 | $filters = array('airlines' => array($stats_airline)); |
196 | 196 | if ($filter_name != '') { |
197 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
197 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
198 | 198 | } |
199 | 199 | $Spotter = new Spotter($this->db); |
200 | 200 | $all = $Spotter->countAllDepartureCountries($filters); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | return $all; |
203 | 203 | } |
204 | 204 | |
205 | - public function countAllAirlines($limit = true,$filter_name = '') { |
|
205 | + public function countAllAirlines($limit = true, $filter_name = '') { |
|
206 | 206 | global $globalStatsFilters; |
207 | 207 | if ($filter_name == '') $filter_name = $this->filter_name; |
208 | 208 | 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"; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | try { |
211 | 211 | $sth = $this->db->prepare($query); |
212 | 212 | $sth->execute(array(':filter_name' => $filter_name)); |
213 | - } catch(PDOException $e) { |
|
213 | + } catch (PDOException $e) { |
|
214 | 214 | echo "error : ".$e->getMessage(); |
215 | 215 | } |
216 | 216 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -218,58 +218,58 @@ discard block |
||
218 | 218 | $Spotter = new Spotter($this->db); |
219 | 219 | $filters = array(); |
220 | 220 | if ($filter_name != '') { |
221 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
221 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
222 | 222 | } |
223 | 223 | |
224 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
224 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
|
225 | 225 | } |
226 | 226 | return $all; |
227 | 227 | } |
228 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') { |
|
228 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '') { |
|
229 | 229 | global $globalStatsFilters; |
230 | 230 | if ($filter_name == '') $filter_name = $this->filter_name; |
231 | 231 | 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"; |
232 | 232 | 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"; |
233 | 233 | try { |
234 | 234 | $sth = $this->db->prepare($query); |
235 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
236 | - } catch(PDOException $e) { |
|
235 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
236 | + } catch (PDOException $e) { |
|
237 | 237 | echo "error : ".$e->getMessage(); |
238 | 238 | } |
239 | 239 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
240 | 240 | if (empty($all)) { |
241 | 241 | $filters = array('airlines' => array($stats_airline)); |
242 | 242 | if ($filter_name != '') { |
243 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
243 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
244 | 244 | } |
245 | 245 | $Spotter = new Spotter($this->db); |
246 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
246 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
247 | 247 | } |
248 | 248 | return $all; |
249 | 249 | } |
250 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') { |
|
250 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '') { |
|
251 | 251 | global $globalStatsFilters; |
252 | 252 | if ($filter_name == '') $filter_name = $this->filter_name; |
253 | 253 | 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"; |
254 | 254 | 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"; |
255 | 255 | try { |
256 | 256 | $sth = $this->db->prepare($query); |
257 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
258 | - } catch(PDOException $e) { |
|
257 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
258 | + } catch (PDOException $e) { |
|
259 | 259 | echo "error : ".$e->getMessage(); |
260 | 260 | } |
261 | 261 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
262 | 262 | if (empty($all)) { |
263 | 263 | $filters = array('airlines' => array($stats_airline)); |
264 | 264 | if ($filter_name != '') { |
265 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
265 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
266 | 266 | } |
267 | 267 | $Spotter = new Spotter($this->db); |
268 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
268 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
269 | 269 | } |
270 | 270 | return $all; |
271 | 271 | } |
272 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') { |
|
272 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '') { |
|
273 | 273 | $Connection = new Connection(); |
274 | 274 | if ($filter_name == '') $filter_name = $this->filter_name; |
275 | 275 | if ($Connection->tableExists('countries')) { |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | 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"; |
278 | 278 | try { |
279 | 279 | $sth = $this->db->prepare($query); |
280 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
281 | - } catch(PDOException $e) { |
|
280 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
281 | + } catch (PDOException $e) { |
|
282 | 282 | echo "error : ".$e->getMessage(); |
283 | 283 | } |
284 | 284 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -293,70 +293,70 @@ discard block |
||
293 | 293 | return array(); |
294 | 294 | } |
295 | 295 | } |
296 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') { |
|
296 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '') { |
|
297 | 297 | global $globalStatsFilters; |
298 | 298 | if ($filter_name == '') $filter_name = $this->filter_name; |
299 | 299 | if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
300 | 300 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
301 | 301 | try { |
302 | 302 | $sth = $this->db->prepare($query); |
303 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
304 | - } catch(PDOException $e) { |
|
303 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
304 | + } catch (PDOException $e) { |
|
305 | 305 | echo "error : ".$e->getMessage(); |
306 | 306 | } |
307 | 307 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
308 | 308 | if (empty($all)) { |
309 | 309 | $filters = array('airlines' => array($stats_airline)); |
310 | 310 | if ($filter_name != '') { |
311 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
311 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
312 | 312 | } |
313 | 313 | $Spotter = new Spotter($this->db); |
314 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
314 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
315 | 315 | } |
316 | 316 | return $all; |
317 | 317 | } |
318 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') { |
|
318 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '') { |
|
319 | 319 | global $globalStatsFilters; |
320 | 320 | if ($filter_name == '') $filter_name = $this->filter_name; |
321 | 321 | 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"; |
322 | 322 | 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"; |
323 | 323 | try { |
324 | 324 | $sth = $this->db->prepare($query); |
325 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
326 | - } catch(PDOException $e) { |
|
325 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
326 | + } catch (PDOException $e) { |
|
327 | 327 | echo "error : ".$e->getMessage(); |
328 | 328 | } |
329 | 329 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
330 | 330 | if (empty($all)) { |
331 | 331 | $filters = array('airlines' => array($stats_airline)); |
332 | 332 | if ($filter_name != '') { |
333 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
333 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
334 | 334 | } |
335 | 335 | $Spotter = new Spotter($this->db); |
336 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
336 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
337 | 337 | } |
338 | 338 | return $all; |
339 | 339 | } |
340 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') { |
|
340 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '') { |
|
341 | 341 | global $globalStatsFilters; |
342 | 342 | if ($filter_name == '') $filter_name = $this->filter_name; |
343 | 343 | 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"; |
344 | 344 | 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"; |
345 | 345 | try { |
346 | 346 | $sth = $this->db->prepare($query); |
347 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
348 | - } catch(PDOException $e) { |
|
347 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
348 | + } catch (PDOException $e) { |
|
349 | 349 | echo "error : ".$e->getMessage(); |
350 | 350 | } |
351 | 351 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
352 | 352 | if (empty($all)) { |
353 | 353 | $filters = array('airlines' => array($stats_airline)); |
354 | 354 | if ($filter_name != '') { |
355 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
355 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
356 | 356 | } |
357 | 357 | $Spotter = new Spotter($this->db); |
358 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
359 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
358 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
359 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
360 | 360 | $all = array(); |
361 | 361 | foreach ($pall as $value) { |
362 | 362 | $icao = $value['airport_departure_icao']; |
@@ -373,30 +373,30 @@ discard block |
||
373 | 373 | foreach ($all as $key => $row) { |
374 | 374 | $count[$key] = $row['airport_departure_icao_count']; |
375 | 375 | } |
376 | - array_multisort($count,SORT_DESC,$all); |
|
376 | + array_multisort($count, SORT_DESC, $all); |
|
377 | 377 | } |
378 | 378 | return $all; |
379 | 379 | } |
380 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') { |
|
380 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '') { |
|
381 | 381 | global $globalStatsFilters; |
382 | 382 | if ($filter_name == '') $filter_name = $this->filter_name; |
383 | 383 | 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"; |
384 | 384 | 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"; |
385 | 385 | try { |
386 | 386 | $sth = $this->db->prepare($query); |
387 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
388 | - } catch(PDOException $e) { |
|
387 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
388 | + } catch (PDOException $e) { |
|
389 | 389 | echo "error : ".$e->getMessage(); |
390 | 390 | } |
391 | 391 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
392 | 392 | if (empty($all)) { |
393 | 393 | $filters = array('airlines' => array($stats_airline)); |
394 | 394 | if ($filter_name != '') { |
395 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
395 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
396 | 396 | } |
397 | 397 | $Spotter = new Spotter($this->db); |
398 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
399 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
398 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
399 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
400 | 400 | $all = array(); |
401 | 401 | foreach ($pall as $value) { |
402 | 402 | $icao = $value['airport_arrival_icao']; |
@@ -413,12 +413,12 @@ discard block |
||
413 | 413 | foreach ($all as $key => $row) { |
414 | 414 | $count[$key] = $row['airport_arrival_icao_count']; |
415 | 415 | } |
416 | - array_multisort($count,SORT_DESC,$all); |
|
416 | + array_multisort($count, SORT_DESC, $all); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | return $all; |
420 | 420 | } |
421 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
421 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
422 | 422 | global $globalDBdriver, $globalStatsFilters; |
423 | 423 | if ($filter_name == '') $filter_name = $this->filter_name; |
424 | 424 | if ($globalDBdriver == 'mysql') { |
@@ -428,18 +428,18 @@ discard block |
||
428 | 428 | 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"; |
429 | 429 | 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"; |
430 | 430 | } |
431 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
431 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
432 | 432 | try { |
433 | 433 | $sth = $this->db->prepare($query); |
434 | 434 | $sth->execute($query_data); |
435 | - } catch(PDOException $e) { |
|
435 | + } catch (PDOException $e) { |
|
436 | 436 | echo "error : ".$e->getMessage(); |
437 | 437 | } |
438 | 438 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
439 | 439 | if (empty($all)) { |
440 | 440 | $filters = array('airlines' => array($stats_airline)); |
441 | 441 | if ($filter_name != '') { |
442 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
442 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
443 | 443 | } |
444 | 444 | $Spotter = new Spotter($this->db); |
445 | 445 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -448,29 +448,29 @@ discard block |
||
448 | 448 | return $all; |
449 | 449 | } |
450 | 450 | |
451 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
451 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
452 | 452 | global $globalStatsFilters; |
453 | 453 | if ($filter_name == '') $filter_name = $this->filter_name; |
454 | 454 | $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"; |
455 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
455 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
456 | 456 | try { |
457 | 457 | $sth = $this->db->prepare($query); |
458 | 458 | $sth->execute($query_data); |
459 | - } catch(PDOException $e) { |
|
459 | + } catch (PDOException $e) { |
|
460 | 460 | echo "error : ".$e->getMessage(); |
461 | 461 | } |
462 | 462 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
463 | 463 | if (empty($all)) { |
464 | 464 | $filters = array('airlines' => array($stats_airline)); |
465 | 465 | if ($filter_name != '') { |
466 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
466 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
467 | 467 | } |
468 | 468 | $Spotter = new Spotter($this->db); |
469 | 469 | $all = $Spotter->countAllDatesLastMonth($filters); |
470 | 470 | } |
471 | 471 | return $all; |
472 | 472 | } |
473 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
473 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
474 | 474 | global $globalDBdriver, $globalStatsFilters; |
475 | 475 | if ($filter_name == '') $filter_name = $this->filter_name; |
476 | 476 | if ($globalDBdriver == 'mysql') { |
@@ -478,40 +478,40 @@ discard block |
||
478 | 478 | } else { |
479 | 479 | $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"; |
480 | 480 | } |
481 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
481 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
482 | 482 | try { |
483 | 483 | $sth = $this->db->prepare($query); |
484 | 484 | $sth->execute($query_data); |
485 | - } catch(PDOException $e) { |
|
485 | + } catch (PDOException $e) { |
|
486 | 486 | echo "error : ".$e->getMessage(); |
487 | 487 | } |
488 | 488 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
489 | 489 | if (empty($all)) { |
490 | 490 | $filters = array('airlines' => array($stats_airline)); |
491 | 491 | if ($filter_name != '') { |
492 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
492 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
493 | 493 | } |
494 | 494 | $Spotter = new Spotter($this->db); |
495 | 495 | $all = $Spotter->countAllDatesLast7Days($filters); |
496 | 496 | } |
497 | 497 | return $all; |
498 | 498 | } |
499 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
499 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
500 | 500 | global $globalStatsFilters; |
501 | 501 | if ($filter_name == '') $filter_name = $this->filter_name; |
502 | 502 | $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"; |
503 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
503 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
504 | 504 | try { |
505 | 505 | $sth = $this->db->prepare($query); |
506 | 506 | $sth->execute($query_data); |
507 | - } catch(PDOException $e) { |
|
507 | + } catch (PDOException $e) { |
|
508 | 508 | echo "error : ".$e->getMessage(); |
509 | 509 | } |
510 | 510 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
511 | 511 | if (empty($all)) { |
512 | 512 | $filters = array('airlines' => array($stats_airline)); |
513 | 513 | if ($filter_name != '') { |
514 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
514 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
515 | 515 | } |
516 | 516 | $Spotter = new Spotter($this->db); |
517 | 517 | $all = $Spotter->countAllDates($filters); |
@@ -526,35 +526,35 @@ discard block |
||
526 | 526 | try { |
527 | 527 | $sth = $this->db->prepare($query); |
528 | 528 | $sth->execute($query_data); |
529 | - } catch(PDOException $e) { |
|
529 | + } catch (PDOException $e) { |
|
530 | 530 | echo "error : ".$e->getMessage(); |
531 | 531 | } |
532 | 532 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
533 | 533 | if (empty($all)) { |
534 | 534 | $filters = array(); |
535 | 535 | if ($filter_name != '') { |
536 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
536 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
537 | 537 | } |
538 | 538 | $Spotter = new Spotter($this->db); |
539 | 539 | $all = $Spotter->countAllDatesByAirlines($filters); |
540 | 540 | } |
541 | 541 | return $all; |
542 | 542 | } |
543 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
543 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
544 | 544 | global $globalStatsFilters; |
545 | 545 | if ($filter_name == '') $filter_name = $this->filter_name; |
546 | 546 | $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"; |
547 | 547 | try { |
548 | 548 | $sth = $this->db->prepare($query); |
549 | 549 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
550 | - } catch(PDOException $e) { |
|
550 | + } catch (PDOException $e) { |
|
551 | 551 | echo "error : ".$e->getMessage(); |
552 | 552 | } |
553 | 553 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
554 | 554 | if (empty($all)) { |
555 | 555 | $filters = array('airlines' => array($stats_airline)); |
556 | 556 | if ($filter_name != '') { |
557 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
557 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
558 | 558 | } |
559 | 559 | $Spotter = new Spotter($this->db); |
560 | 560 | $all = $Spotter->countAllMonths($filters); |
@@ -568,21 +568,21 @@ discard block |
||
568 | 568 | try { |
569 | 569 | $sth = $this->db->prepare($query); |
570 | 570 | $sth->execute(array(':filter_name' => $filter_name)); |
571 | - } catch(PDOException $e) { |
|
571 | + } catch (PDOException $e) { |
|
572 | 572 | echo "error : ".$e->getMessage(); |
573 | 573 | } |
574 | 574 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
575 | 575 | if (empty($all)) { |
576 | 576 | $filters = array(); |
577 | 577 | if ($filter_name != '') { |
578 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
578 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
579 | 579 | } |
580 | 580 | $Spotter = new Spotter($this->db); |
581 | 581 | $all = $Spotter->countAllMilitaryMonths($filters); |
582 | 582 | } |
583 | 583 | return $all; |
584 | 584 | } |
585 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
585 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
586 | 586 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
587 | 587 | if ($filter_name == '') $filter_name = $this->filter_name; |
588 | 588 | 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"; |
@@ -599,17 +599,17 @@ discard block |
||
599 | 599 | try { |
600 | 600 | $sth = $this->db->prepare($query); |
601 | 601 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
602 | - } catch(PDOException $e) { |
|
602 | + } catch (PDOException $e) { |
|
603 | 603 | echo "error : ".$e->getMessage(); |
604 | 604 | } |
605 | 605 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
606 | 606 | if (empty($all)) { |
607 | 607 | $filters = array('airlines' => array($stats_airline)); |
608 | 608 | if ($filter_name != '') { |
609 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
609 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
610 | 610 | } |
611 | 611 | $Spotter = new Spotter($this->db); |
612 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
612 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
613 | 613 | } |
614 | 614 | return $all; |
615 | 615 | } |
@@ -617,11 +617,11 @@ discard block |
||
617 | 617 | public function countOverallFlights($stats_airline = '', $filter_name = '') { |
618 | 618 | global $globalStatsFilters; |
619 | 619 | if ($filter_name == '') $filter_name = $this->filter_name; |
620 | - $all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name); |
|
620 | + $all = $this->getSumStats('flights_bymonth', date('Y'), $stats_airline, $filter_name); |
|
621 | 621 | if (empty($all)) { |
622 | 622 | $filters = array('airlines' => array($stats_airline)); |
623 | 623 | if ($filter_name != '') { |
624 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
624 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
625 | 625 | } |
626 | 626 | $Spotter = new Spotter($this->db); |
627 | 627 | $all = $Spotter->countOverallFlights($filters); |
@@ -631,39 +631,39 @@ discard block |
||
631 | 631 | public function countOverallMilitaryFlights($filter_name = '') { |
632 | 632 | global $globalStatsFilters; |
633 | 633 | if ($filter_name == '') $filter_name = $this->filter_name; |
634 | - $all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name); |
|
634 | + $all = $this->getSumStats('military_flights_bymonth', date('Y'), '', $filter_name); |
|
635 | 635 | if (empty($all)) { |
636 | 636 | $filters = array(); |
637 | 637 | if ($filter_name != '') { |
638 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
638 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
639 | 639 | } |
640 | 640 | $Spotter = new Spotter($this->db); |
641 | 641 | $all = $Spotter->countOverallMilitaryFlights($filters); |
642 | 642 | } |
643 | 643 | return $all; |
644 | 644 | } |
645 | - public function countOverallArrival($stats_airline = '',$filter_name = '') { |
|
645 | + public function countOverallArrival($stats_airline = '', $filter_name = '') { |
|
646 | 646 | global $globalStatsFilters; |
647 | 647 | if ($filter_name == '') $filter_name = $this->filter_name; |
648 | - $all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name); |
|
648 | + $all = $this->getSumStats('realarrivals_bymonth', date('Y'), $stats_airline, $filter_name); |
|
649 | 649 | if (empty($all)) { |
650 | 650 | $filters = array('airlines' => array($stats_airline)); |
651 | 651 | if ($filter_name != '') { |
652 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
652 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
653 | 653 | } |
654 | 654 | $Spotter = new Spotter($this->db); |
655 | 655 | $all = $Spotter->countOverallArrival($filters); |
656 | 656 | } |
657 | 657 | return $all; |
658 | 658 | } |
659 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '') { |
|
659 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '') { |
|
660 | 660 | global $globalStatsFilters; |
661 | 661 | if ($filter_name == '') $filter_name = $this->filter_name; |
662 | - $all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name); |
|
662 | + $all = $this->getSumStats('aircrafts_bymonth', date('Y'), $stats_airline, $filter_name); |
|
663 | 663 | if (empty($all)) { |
664 | 664 | $filters = array('airlines' => array($stats_airline)); |
665 | 665 | if ($filter_name != '') { |
666 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
666 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
667 | 667 | } |
668 | 668 | $Spotter = new Spotter($this->db); |
669 | 669 | $all = $Spotter->countOverallAircrafts($filters); |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | try { |
678 | 678 | $sth = $this->db->prepare($query); |
679 | 679 | $sth->execute(array(':filter_name' => $filter_name)); |
680 | - } catch(PDOException $e) { |
|
680 | + } catch (PDOException $e) { |
|
681 | 681 | echo "error : ".$e->getMessage(); |
682 | 682 | } |
683 | 683 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -686,14 +686,14 @@ discard block |
||
686 | 686 | if (empty($all)) { |
687 | 687 | $filters = array(); |
688 | 688 | if ($filter_name != '') { |
689 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
689 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
690 | 690 | } |
691 | 691 | $Spotter = new Spotter($this->db); |
692 | 692 | $all = $Spotter->countOverallAirlines($filters); |
693 | 693 | } |
694 | 694 | return $all; |
695 | 695 | } |
696 | - public function countOverallOwners($stats_airline = '',$filter_name = '') { |
|
696 | + public function countOverallOwners($stats_airline = '', $filter_name = '') { |
|
697 | 697 | global $globalStatsFilters; |
698 | 698 | if ($filter_name == '') $filter_name = $this->filter_name; |
699 | 699 | /* |
@@ -707,25 +707,25 @@ discard block |
||
707 | 707 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
708 | 708 | $all = $result[0]['nb_owner']; |
709 | 709 | */ |
710 | - $all = $this->getSumStats('owners_bymonth',date('Y'),$stats_airline,$filter_name); |
|
710 | + $all = $this->getSumStats('owners_bymonth', date('Y'), $stats_airline, $filter_name); |
|
711 | 711 | if (empty($all)) { |
712 | 712 | $filters = array('airlines' => array($stats_airline)); |
713 | 713 | if ($filter_name != '') { |
714 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
714 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
715 | 715 | } |
716 | 716 | $Spotter = new Spotter($this->db); |
717 | 717 | $all = $Spotter->countOverallOwners($filters); |
718 | 718 | } |
719 | 719 | return $all; |
720 | 720 | } |
721 | - public function countOverallPilots($stats_airline = '',$filter_name = '') { |
|
721 | + public function countOverallPilots($stats_airline = '', $filter_name = '') { |
|
722 | 722 | global $globalStatsFilters; |
723 | 723 | if ($filter_name == '') $filter_name = $this->filter_name; |
724 | - $all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name); |
|
724 | + $all = $this->getSumStats('pilots_bymonth', date('Y'), $stats_airline, $filter_name); |
|
725 | 725 | if (empty($all)) { |
726 | 726 | $filters = array('airlines' => array($stats_airline)); |
727 | 727 | if ($filter_name != '') { |
728 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
728 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
729 | 729 | } |
730 | 730 | $Spotter = new Spotter($this->db); |
731 | 731 | $all = $Spotter->countOverallPilots($filters); |
@@ -733,33 +733,33 @@ discard block |
||
733 | 733 | return $all; |
734 | 734 | } |
735 | 735 | |
736 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
736 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
737 | 737 | if ($filter_name == '') $filter_name = $this->filter_name; |
738 | 738 | $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"; |
739 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
739 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
740 | 740 | try { |
741 | 741 | $sth = $this->db->prepare($query); |
742 | 742 | $sth->execute($query_values); |
743 | - } catch(PDOException $e) { |
|
743 | + } catch (PDOException $e) { |
|
744 | 744 | echo "error : ".$e->getMessage(); |
745 | 745 | } |
746 | 746 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
747 | 747 | return $all; |
748 | 748 | } |
749 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
749 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
750 | 750 | if ($filter_name == '') $filter_name = $this->filter_name; |
751 | 751 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
752 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
752 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
753 | 753 | try { |
754 | 754 | $sth = $this->db->prepare($query); |
755 | 755 | $sth->execute($query_values); |
756 | - } catch(PDOException $e) { |
|
756 | + } catch (PDOException $e) { |
|
757 | 757 | echo "error : ".$e->getMessage(); |
758 | 758 | } |
759 | 759 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
760 | 760 | return $all; |
761 | 761 | } |
762 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') { |
|
762 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '') { |
|
763 | 763 | if ($filter_name == '') $filter_name = $this->filter_name; |
764 | 764 | global $globalArchiveMonths, $globalDBdriver; |
765 | 765 | if ($globalDBdriver == 'mysql') { |
@@ -767,11 +767,11 @@ discard block |
||
767 | 767 | } else { |
768 | 768 | $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"; |
769 | 769 | } |
770 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
770 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
771 | 771 | try { |
772 | 772 | $sth = $this->db->prepare($query); |
773 | 773 | $sth->execute($query_values); |
774 | - } catch(PDOException $e) { |
|
774 | + } catch (PDOException $e) { |
|
775 | 775 | echo "error : ".$e->getMessage(); |
776 | 776 | } |
777 | 777 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -789,7 +789,7 @@ discard block |
||
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); |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | try { |
807 | 807 | $sth = $this->db->prepare($query); |
808 | 808 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
809 | - } catch(PDOException $e) { |
|
809 | + } catch (PDOException $e) { |
|
810 | 810 | echo "error : ".$e->getMessage(); |
811 | 811 | } |
812 | 812 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | try { |
824 | 824 | $sth = $this->db->prepare($query); |
825 | 825 | $sth->execute(array(':filter_name' => $filter_name)); |
826 | - } catch(PDOException $e) { |
|
826 | + } catch (PDOException $e) { |
|
827 | 827 | echo "error : ".$e->getMessage(); |
828 | 828 | } |
829 | 829 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | try { |
841 | 841 | $sth = $this->db->prepare($query); |
842 | 842 | $sth->execute(array(':filter_name' => $filter_name)); |
843 | - } catch(PDOException $e) { |
|
843 | + } catch (PDOException $e) { |
|
844 | 844 | echo "error : ".$e->getMessage(); |
845 | 845 | } |
846 | 846 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -857,14 +857,14 @@ discard block |
||
857 | 857 | try { |
858 | 858 | $sth = $this->db->prepare($query); |
859 | 859 | $sth->execute(array(':filter_name' => $filter_name)); |
860 | - } catch(PDOException $e) { |
|
860 | + } catch (PDOException $e) { |
|
861 | 861 | echo "error : ".$e->getMessage(); |
862 | 862 | } |
863 | 863 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
864 | 864 | return $all[0]['total']; |
865 | 865 | } |
866 | 866 | |
867 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
867 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
868 | 868 | global $globalDBdriver; |
869 | 869 | if ($filter_name == '') $filter_name = $this->filter_name; |
870 | 870 | if ($globalDBdriver == 'mysql') { |
@@ -872,15 +872,15 @@ discard block |
||
872 | 872 | } else { |
873 | 873 | $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);"; |
874 | 874 | } |
875 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
875 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
876 | 876 | try { |
877 | 877 | $sth = $this->db->prepare($query); |
878 | 878 | $sth->execute($query_values); |
879 | - } catch(PDOException $e) { |
|
879 | + } catch (PDOException $e) { |
|
880 | 880 | return "error : ".$e->getMessage(); |
881 | 881 | } |
882 | 882 | } |
883 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
883 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
884 | 884 | global $globalDBdriver; |
885 | 885 | if ($filter_name == '') $filter_name = $this->filter_name; |
886 | 886 | if ($globalDBdriver == 'mysql') { |
@@ -889,219 +889,219 @@ discard block |
||
889 | 889 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
890 | 890 | $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);"; |
891 | 891 | } |
892 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
892 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
893 | 893 | try { |
894 | 894 | $sth = $this->db->prepare($query); |
895 | 895 | $sth->execute($query_values); |
896 | - } catch(PDOException $e) { |
|
896 | + } catch (PDOException $e) { |
|
897 | 897 | return "error : ".$e->getMessage(); |
898 | 898 | } |
899 | 899 | } |
900 | - public function getStatsSource($date,$stats_type = '') { |
|
900 | + public function getStatsSource($date, $stats_type = '') { |
|
901 | 901 | if ($stats_type == '') { |
902 | 902 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
903 | 903 | $query_values = array(':date' => $date); |
904 | 904 | } else { |
905 | 905 | $query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name"; |
906 | - $query_values = array(':date' => $date,':stats_type' => $stats_type); |
|
906 | + $query_values = array(':date' => $date, ':stats_type' => $stats_type); |
|
907 | 907 | } |
908 | 908 | try { |
909 | 909 | $sth = $this->db->prepare($query); |
910 | 910 | $sth->execute($query_values); |
911 | - } catch(PDOException $e) { |
|
911 | + } catch (PDOException $e) { |
|
912 | 912 | echo "error : ".$e->getMessage(); |
913 | 913 | } |
914 | 914 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
915 | 915 | return $all; |
916 | 916 | } |
917 | 917 | |
918 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
918 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
919 | 919 | global $globalDBdriver; |
920 | 920 | if ($globalDBdriver == 'mysql') { |
921 | 921 | $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"; |
922 | 922 | } else { |
923 | 923 | $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);"; |
924 | 924 | } |
925 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
925 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
926 | 926 | try { |
927 | 927 | $sth = $this->db->prepare($query); |
928 | 928 | $sth->execute($query_values); |
929 | - } catch(PDOException $e) { |
|
929 | + } catch (PDOException $e) { |
|
930 | 930 | return "error : ".$e->getMessage(); |
931 | 931 | } |
932 | 932 | } |
933 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
933 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
934 | 934 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
935 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
935 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
936 | 936 | try { |
937 | 937 | $sth = $this->db->prepare($query); |
938 | 938 | $sth->execute($query_values); |
939 | - } catch(PDOException $e) { |
|
939 | + } catch (PDOException $e) { |
|
940 | 940 | return "error : ".$e->getMessage(); |
941 | 941 | } |
942 | 942 | } |
943 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') { |
|
943 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '') { |
|
944 | 944 | global $globalDBdriver; |
945 | 945 | if ($globalDBdriver == 'mysql') { |
946 | 946 | $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"; |
947 | 947 | } else { |
948 | 948 | $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);"; |
949 | 949 | } |
950 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
950 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
951 | 951 | try { |
952 | 952 | $sth = $this->db->prepare($query); |
953 | 953 | $sth->execute($query_values); |
954 | - } catch(PDOException $e) { |
|
954 | + } catch (PDOException $e) { |
|
955 | 955 | return "error : ".$e->getMessage(); |
956 | 956 | } |
957 | 957 | } |
958 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') { |
|
958 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '') { |
|
959 | 959 | global $globalDBdriver; |
960 | 960 | if ($globalDBdriver == 'mysql') { |
961 | 961 | $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"; |
962 | 962 | } else { |
963 | 963 | $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);"; |
964 | 964 | } |
965 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
965 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
966 | 966 | try { |
967 | 967 | $sth = $this->db->prepare($query); |
968 | 968 | $sth->execute($query_values); |
969 | - } catch(PDOException $e) { |
|
969 | + } catch (PDOException $e) { |
|
970 | 970 | return "error : ".$e->getMessage(); |
971 | 971 | } |
972 | 972 | } |
973 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') { |
|
973 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '') { |
|
974 | 974 | global $globalDBdriver; |
975 | 975 | if ($globalDBdriver == 'mysql') { |
976 | 976 | $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"; |
977 | 977 | } else { |
978 | 978 | $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);"; |
979 | 979 | } |
980 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
980 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
981 | 981 | try { |
982 | 982 | $sth = $this->db->prepare($query); |
983 | 983 | $sth->execute($query_values); |
984 | - } catch(PDOException $e) { |
|
984 | + } catch (PDOException $e) { |
|
985 | 985 | return "error : ".$e->getMessage(); |
986 | 986 | } |
987 | 987 | } |
988 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
|
988 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
|
989 | 989 | global $globalDBdriver; |
990 | 990 | if ($globalDBdriver == 'mysql') { |
991 | 991 | $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"; |
992 | 992 | } else { |
993 | 993 | $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);"; |
994 | 994 | } |
995 | - $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); |
|
995 | + $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); |
|
996 | 996 | try { |
997 | 997 | $sth = $this->db->prepare($query); |
998 | 998 | $sth->execute($query_values); |
999 | - } catch(PDOException $e) { |
|
999 | + } catch (PDOException $e) { |
|
1000 | 1000 | return "error : ".$e->getMessage(); |
1001 | 1001 | } |
1002 | 1002 | } |
1003 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') { |
|
1003 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '') { |
|
1004 | 1004 | global $globalDBdriver; |
1005 | 1005 | if ($globalDBdriver == 'mysql') { |
1006 | 1006 | $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"; |
1007 | 1007 | } else { |
1008 | 1008 | $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);"; |
1009 | 1009 | } |
1010 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1010 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1011 | 1011 | try { |
1012 | 1012 | $sth = $this->db->prepare($query); |
1013 | 1013 | $sth->execute($query_values); |
1014 | - } catch(PDOException $e) { |
|
1014 | + } catch (PDOException $e) { |
|
1015 | 1015 | return "error : ".$e->getMessage(); |
1016 | 1016 | } |
1017 | 1017 | } |
1018 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') { |
|
1018 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
1019 | 1019 | global $globalDBdriver; |
1020 | 1020 | if ($globalDBdriver == 'mysql') { |
1021 | 1021 | $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"; |
1022 | 1022 | } else { |
1023 | 1023 | $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);"; |
1024 | 1024 | } |
1025 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1025 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1026 | 1026 | try { |
1027 | 1027 | $sth = $this->db->prepare($query); |
1028 | 1028 | $sth->execute($query_values); |
1029 | - } catch(PDOException $e) { |
|
1029 | + } catch (PDOException $e) { |
|
1030 | 1030 | return "error : ".$e->getMessage(); |
1031 | 1031 | } |
1032 | 1032 | } |
1033 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '') { |
|
1033 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '') { |
|
1034 | 1034 | global $globalDBdriver; |
1035 | 1035 | if ($globalDBdriver == 'mysql') { |
1036 | 1036 | $query = "INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) VALUES (:pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, pilot_name = :pilot_name"; |
1037 | 1037 | } else { |
1038 | 1038 | $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; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1039 | 1039 | } |
1040 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1040 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1041 | 1041 | try { |
1042 | 1042 | $sth = $this->db->prepare($query); |
1043 | 1043 | $sth->execute($query_values); |
1044 | - } catch(PDOException $e) { |
|
1044 | + } catch (PDOException $e) { |
|
1045 | 1045 | return "error : ".$e->getMessage(); |
1046 | 1046 | } |
1047 | 1047 | } |
1048 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1048 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1049 | 1049 | global $globalDBdriver; |
1050 | 1050 | if ($globalDBdriver == 'mysql') { |
1051 | 1051 | $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"; |
1052 | 1052 | } else { |
1053 | 1053 | $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);"; |
1054 | 1054 | } |
1055 | - $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); |
|
1055 | + $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); |
|
1056 | 1056 | try { |
1057 | 1057 | $sth = $this->db->prepare($query); |
1058 | 1058 | $sth->execute($query_values); |
1059 | - } catch(PDOException $e) { |
|
1059 | + } catch (PDOException $e) { |
|
1060 | 1060 | return "error : ".$e->getMessage(); |
1061 | 1061 | } |
1062 | 1062 | } |
1063 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1063 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1064 | 1064 | global $globalDBdriver; |
1065 | 1065 | if ($globalDBdriver == 'mysql') { |
1066 | 1066 | $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"; |
1067 | 1067 | } else { |
1068 | 1068 | $query = "UPDATE stats_airport SET departure = 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);"; |
1069 | 1069 | } |
1070 | - $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); |
|
1070 | + $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); |
|
1071 | 1071 | try { |
1072 | 1072 | $sth = $this->db->prepare($query); |
1073 | 1073 | $sth->execute($query_values); |
1074 | - } catch(PDOException $e) { |
|
1074 | + } catch (PDOException $e) { |
|
1075 | 1075 | return "error : ".$e->getMessage(); |
1076 | 1076 | } |
1077 | 1077 | } |
1078 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1078 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1079 | 1079 | global $globalDBdriver; |
1080 | 1080 | if ($globalDBdriver == 'mysql') { |
1081 | 1081 | $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"; |
1082 | 1082 | } else { |
1083 | 1083 | $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);"; |
1084 | 1084 | } |
1085 | - $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); |
|
1085 | + $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); |
|
1086 | 1086 | try { |
1087 | 1087 | $sth = $this->db->prepare($query); |
1088 | 1088 | $sth->execute($query_values); |
1089 | - } catch(PDOException $e) { |
|
1089 | + } catch (PDOException $e) { |
|
1090 | 1090 | return "error : ".$e->getMessage(); |
1091 | 1091 | } |
1092 | 1092 | } |
1093 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1093 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1094 | 1094 | global $globalDBdriver; |
1095 | 1095 | if ($globalDBdriver == 'mysql') { |
1096 | 1096 | $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"; |
1097 | 1097 | } else { |
1098 | 1098 | $query = "UPDATE stats_airport SET arrival = 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);"; |
1099 | 1099 | } |
1100 | - $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); |
|
1100 | + $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); |
|
1101 | 1101 | try { |
1102 | 1102 | $sth = $this->db->prepare($query); |
1103 | 1103 | $sth->execute($query_values); |
1104 | - } catch(PDOException $e) { |
|
1104 | + } catch (PDOException $e) { |
|
1105 | 1105 | return "error : ".$e->getMessage(); |
1106 | 1106 | } |
1107 | 1107 | } |
@@ -1112,7 +1112,7 @@ discard block |
||
1112 | 1112 | try { |
1113 | 1113 | $sth = $this->db->prepare($query); |
1114 | 1114 | $sth->execute($query_values); |
1115 | - } catch(PDOException $e) { |
|
1115 | + } catch (PDOException $e) { |
|
1116 | 1116 | return "error : ".$e->getMessage(); |
1117 | 1117 | } |
1118 | 1118 | } |
@@ -1122,7 +1122,7 @@ discard block |
||
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 | } |
@@ -1132,7 +1132,7 @@ discard block |
||
1132 | 1132 | try { |
1133 | 1133 | $sth = $this->db->prepare($query); |
1134 | 1134 | $sth->execute($query_values); |
1135 | - } catch(PDOException $e) { |
|
1135 | + } catch (PDOException $e) { |
|
1136 | 1136 | return "error : ".$e->getMessage(); |
1137 | 1137 | } |
1138 | 1138 | } |
@@ -1371,40 +1371,40 @@ discard block |
||
1371 | 1371 | $last_update_day = $last_update[0]['value']; |
1372 | 1372 | } else $last_update_day = '2012-12-12 12:12:12'; |
1373 | 1373 | $Spotter = new Spotter($this->db); |
1374 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1374 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
1375 | 1375 | foreach ($alldata as $number) { |
1376 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']); |
|
1376 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']); |
|
1377 | 1377 | } |
1378 | 1378 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
1379 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
1379 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
1380 | 1380 | foreach ($alldata as $number) { |
1381 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']); |
|
1381 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']); |
|
1382 | 1382 | } |
1383 | 1383 | if ($globalDebug) echo 'Count all registrations...'."\n"; |
1384 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
1384 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
1385 | 1385 | foreach ($alldata as $number) { |
1386 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']); |
|
1386 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']); |
|
1387 | 1387 | } |
1388 | 1388 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
1389 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
1389 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
1390 | 1390 | foreach ($alldata as $number) { |
1391 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
1391 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
1392 | 1392 | } |
1393 | 1393 | if ($globalDebug) echo 'Count all owners...'."\n"; |
1394 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
1394 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
1395 | 1395 | foreach ($alldata as $number) { |
1396 | - $this->addStatOwner($number['owner_name'],$number['owner_count']); |
|
1396 | + $this->addStatOwner($number['owner_name'], $number['owner_count']); |
|
1397 | 1397 | } |
1398 | 1398 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
1399 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
1399 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
1400 | 1400 | foreach ($alldata as $number) { |
1401 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name']); |
|
1401 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name']); |
|
1402 | 1402 | } |
1403 | 1403 | |
1404 | 1404 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
1405 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
1405 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
1406 | 1406 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
1407 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1407 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
1408 | 1408 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
1409 | 1409 | $alldata = array(); |
1410 | 1410 | |
@@ -1422,14 +1422,14 @@ discard block |
||
1422 | 1422 | foreach ($alldata as $key => $row) { |
1423 | 1423 | $count[$key] = $row['airport_departure_icao_count']; |
1424 | 1424 | } |
1425 | - array_multisort($count,SORT_DESC,$alldata); |
|
1425 | + array_multisort($count, SORT_DESC, $alldata); |
|
1426 | 1426 | foreach ($alldata as $number) { |
1427 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']); |
|
1427 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count']); |
|
1428 | 1428 | } |
1429 | 1429 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
1430 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
1430 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
1431 | 1431 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
1432 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1432 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
1433 | 1433 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
1434 | 1434 | $alldata = array(); |
1435 | 1435 | foreach ($pall as $value) { |
@@ -1446,16 +1446,16 @@ discard block |
||
1446 | 1446 | foreach ($alldata as $key => $row) { |
1447 | 1447 | $count[$key] = $row['airport_arrival_icao_count']; |
1448 | 1448 | } |
1449 | - array_multisort($count,SORT_DESC,$alldata); |
|
1449 | + array_multisort($count, SORT_DESC, $alldata); |
|
1450 | 1450 | foreach ($alldata as $number) { |
1451 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']); |
|
1451 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count']); |
|
1452 | 1452 | } |
1453 | 1453 | if ($Connection->tableExists('countries')) { |
1454 | 1454 | if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
1455 | 1455 | $SpotterArchive = new SpotterArchive(); |
1456 | - $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
1456 | + $alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day); |
|
1457 | 1457 | foreach ($alldata as $number) { |
1458 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']); |
|
1458 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']); |
|
1459 | 1459 | } |
1460 | 1460 | } |
1461 | 1461 | |
@@ -1469,37 +1469,37 @@ discard block |
||
1469 | 1469 | $lastyear = false; |
1470 | 1470 | foreach ($alldata as $number) { |
1471 | 1471 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1472 | - $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']))); |
|
1472 | + $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']))); |
|
1473 | 1473 | } |
1474 | 1474 | if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
1475 | 1475 | $alldata = $Spotter->countAllMilitaryMonths(); |
1476 | 1476 | foreach ($alldata as $number) { |
1477 | - $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']))); |
|
1477 | + $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']))); |
|
1478 | 1478 | } |
1479 | 1479 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
1480 | 1480 | $alldata = $Spotter->countAllMonthsOwners(); |
1481 | 1481 | foreach ($alldata as $number) { |
1482 | - $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']))); |
|
1482 | + $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']))); |
|
1483 | 1483 | } |
1484 | 1484 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
1485 | 1485 | $alldata = $Spotter->countAllMonthsPilots(); |
1486 | 1486 | foreach ($alldata as $number) { |
1487 | - $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']))); |
|
1487 | + $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']))); |
|
1488 | 1488 | } |
1489 | 1489 | if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
1490 | 1490 | $alldata = $Spotter->countAllMonthsAirlines(); |
1491 | 1491 | foreach ($alldata as $number) { |
1492 | - $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']))); |
|
1492 | + $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']))); |
|
1493 | 1493 | } |
1494 | 1494 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
1495 | 1495 | $alldata = $Spotter->countAllMonthsAircrafts(); |
1496 | 1496 | foreach ($alldata as $number) { |
1497 | - $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']))); |
|
1497 | + $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']))); |
|
1498 | 1498 | } |
1499 | 1499 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
1500 | 1500 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
1501 | 1501 | foreach ($alldata as $number) { |
1502 | - $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']))); |
|
1502 | + $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']))); |
|
1503 | 1503 | } |
1504 | 1504 | if ($globalDebug) echo 'Airports data...'."\n"; |
1505 | 1505 | if ($globalDebug) echo '...Departure'."\n"; |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | } |
1545 | 1545 | $alldata = $pall; |
1546 | 1546 | foreach ($alldata as $number) { |
1547 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
1547 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
1548 | 1548 | } |
1549 | 1549 | echo '...Arrival'."\n"; |
1550 | 1550 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -1586,7 +1586,7 @@ discard block |
||
1586 | 1586 | } |
1587 | 1587 | $alldata = $pall; |
1588 | 1588 | foreach ($alldata as $number) { |
1589 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
1589 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
1590 | 1590 | } |
1591 | 1591 | |
1592 | 1592 | echo 'Flights data...'."\n"; |
@@ -1594,28 +1594,28 @@ discard block |
||
1594 | 1594 | echo '-> countAllDatesLastMonth...'."\n"; |
1595 | 1595 | $alldata = $Spotter->countAllDatesLastMonth(); |
1596 | 1596 | foreach ($alldata as $number) { |
1597 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
1597 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
1598 | 1598 | } |
1599 | 1599 | echo '-> countAllDates...'."\n"; |
1600 | 1600 | $previousdata = $this->countAllDates(); |
1601 | 1601 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
1602 | 1602 | $this->deleteStatFlight('date'); |
1603 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates()); |
|
1603 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates()); |
|
1604 | 1604 | $values = array(); |
1605 | 1605 | foreach ($alldata as $cnt) { |
1606 | 1606 | $values[] = $cnt['date_count']; |
1607 | 1607 | } |
1608 | - array_multisort($values,SORT_DESC,$alldata); |
|
1609 | - array_splice($alldata,11); |
|
1608 | + array_multisort($values, SORT_DESC, $alldata); |
|
1609 | + array_splice($alldata, 11); |
|
1610 | 1610 | foreach ($alldata as $number) { |
1611 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
1611 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
1612 | 1612 | } |
1613 | 1613 | |
1614 | 1614 | $this->deleteStatFlight('hour'); |
1615 | 1615 | echo '-> countAllHours...'."\n"; |
1616 | 1616 | $alldata = $Spotter->countAllHours('hour'); |
1617 | 1617 | foreach ($alldata as $number) { |
1618 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
1618 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
1619 | 1619 | } |
1620 | 1620 | |
1621 | 1621 | |
@@ -1624,34 +1624,34 @@ discard block |
||
1624 | 1624 | echo '--- Stats by airlines ---'."\n"; |
1625 | 1625 | if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
1626 | 1626 | $Spotter = new Spotter($this->db); |
1627 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
1627 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
1628 | 1628 | foreach ($alldata as $number) { |
1629 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']); |
|
1629 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']); |
|
1630 | 1630 | } |
1631 | 1631 | if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
1632 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
1632 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
1633 | 1633 | foreach ($alldata as $number) { |
1634 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']); |
|
1634 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']); |
|
1635 | 1635 | } |
1636 | 1636 | if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
1637 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
1637 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
1638 | 1638 | foreach ($alldata as $number) { |
1639 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
1639 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
1640 | 1640 | } |
1641 | 1641 | if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
1642 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
1642 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
1643 | 1643 | foreach ($alldata as $number) { |
1644 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']); |
|
1644 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']); |
|
1645 | 1645 | } |
1646 | 1646 | if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
1647 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
1647 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
1648 | 1648 | foreach ($alldata as $number) { |
1649 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao']); |
|
1649 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao']); |
|
1650 | 1650 | } |
1651 | 1651 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
1652 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1652 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1653 | 1653 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
1654 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1654 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1655 | 1655 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
1656 | 1656 | //$alldata = array(); |
1657 | 1657 | foreach ($dall as $value) { |
@@ -1671,12 +1671,12 @@ discard block |
||
1671 | 1671 | } |
1672 | 1672 | $alldata = $pall; |
1673 | 1673 | foreach ($alldata as $number) { |
1674 | - 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']); |
|
1674 | + 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']); |
|
1675 | 1675 | } |
1676 | 1676 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
1677 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1677 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1678 | 1678 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
1679 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1679 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1680 | 1680 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
1681 | 1681 | //$alldata = array(); |
1682 | 1682 | foreach ($dall as $value) { |
@@ -1696,7 +1696,7 @@ discard block |
||
1696 | 1696 | } |
1697 | 1697 | $alldata = $pall; |
1698 | 1698 | foreach ($alldata as $number) { |
1699 | - 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']); |
|
1699 | + 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']); |
|
1700 | 1700 | } |
1701 | 1701 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
1702 | 1702 | $Spotter = new Spotter($this->db); |
@@ -1704,27 +1704,27 @@ discard block |
||
1704 | 1704 | $lastyear = false; |
1705 | 1705 | foreach ($alldata as $number) { |
1706 | 1706 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1707 | - $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']); |
|
1707 | + $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']); |
|
1708 | 1708 | } |
1709 | 1709 | if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
1710 | 1710 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
1711 | 1711 | foreach ($alldata as $number) { |
1712 | - $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']); |
|
1712 | + $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']); |
|
1713 | 1713 | } |
1714 | 1714 | if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
1715 | 1715 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
1716 | 1716 | foreach ($alldata as $number) { |
1717 | - $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']); |
|
1717 | + $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']); |
|
1718 | 1718 | } |
1719 | 1719 | if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
1720 | 1720 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
1721 | 1721 | foreach ($alldata as $number) { |
1722 | - $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']); |
|
1722 | + $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']); |
|
1723 | 1723 | } |
1724 | 1724 | if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
1725 | 1725 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
1726 | 1726 | foreach ($alldata as $number) { |
1727 | - $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']); |
|
1727 | + $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']); |
|
1728 | 1728 | } |
1729 | 1729 | if ($globalDebug) echo '...Departure'."\n"; |
1730 | 1730 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -1747,7 +1747,7 @@ discard block |
||
1747 | 1747 | } |
1748 | 1748 | $alldata = $pall; |
1749 | 1749 | foreach ($alldata as $number) { |
1750 | - $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']); |
|
1750 | + $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']); |
|
1751 | 1751 | } |
1752 | 1752 | if ($globalDebug) echo '...Arrival'."\n"; |
1753 | 1753 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -1770,32 +1770,32 @@ discard block |
||
1770 | 1770 | } |
1771 | 1771 | $alldata = $pall; |
1772 | 1772 | foreach ($alldata as $number) { |
1773 | - $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']); |
|
1773 | + $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']); |
|
1774 | 1774 | } |
1775 | 1775 | |
1776 | 1776 | if ($globalDebug) echo 'Flights data...'."\n"; |
1777 | 1777 | if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
1778 | 1778 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
1779 | 1779 | foreach ($alldata as $number) { |
1780 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
1780 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1781 | 1781 | } |
1782 | 1782 | if ($globalDebug) echo '-> countAllDates...'."\n"; |
1783 | 1783 | //$previousdata = $this->countAllDatesByAirlines(); |
1784 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
|
1784 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines()); |
|
1785 | 1785 | $values = array(); |
1786 | 1786 | foreach ($alldata as $cnt) { |
1787 | 1787 | $values[] = $cnt['date_count']; |
1788 | 1788 | } |
1789 | - array_multisort($values,SORT_DESC,$alldata); |
|
1790 | - array_splice($alldata,11); |
|
1789 | + array_multisort($values, SORT_DESC, $alldata); |
|
1790 | + array_splice($alldata, 11); |
|
1791 | 1791 | foreach ($alldata as $number) { |
1792 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
1792 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1793 | 1793 | } |
1794 | 1794 | |
1795 | 1795 | if ($globalDebug) echo '-> countAllHours...'."\n"; |
1796 | 1796 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
1797 | 1797 | foreach ($alldata as $number) { |
1798 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
1798 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | |
@@ -1806,33 +1806,33 @@ discard block |
||
1806 | 1806 | // Count by filter |
1807 | 1807 | if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
1808 | 1808 | $Spotter = new Spotter($this->db); |
1809 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
1809 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
1810 | 1810 | foreach ($alldata as $number) { |
1811 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name); |
|
1811 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name); |
|
1812 | 1812 | } |
1813 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
1813 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
1814 | 1814 | foreach ($alldata as $number) { |
1815 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name); |
|
1815 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name); |
|
1816 | 1816 | } |
1817 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
1817 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
1818 | 1818 | foreach ($alldata as $number) { |
1819 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name); |
|
1819 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name); |
|
1820 | 1820 | } |
1821 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
1821 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
1822 | 1822 | foreach ($alldata as $number) { |
1823 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name); |
|
1823 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name); |
|
1824 | 1824 | } |
1825 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
1825 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
1826 | 1826 | foreach ($alldata as $number) { |
1827 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name); |
|
1827 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name); |
|
1828 | 1828 | } |
1829 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
1829 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
1830 | 1830 | foreach ($alldata as $number) { |
1831 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name); |
|
1831 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name); |
|
1832 | 1832 | } |
1833 | 1833 | |
1834 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
1835 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
1834 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
1835 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
1836 | 1836 | $alldata = array(); |
1837 | 1837 | foreach ($pall as $value) { |
1838 | 1838 | $icao = $value['airport_departure_icao']; |
@@ -1848,12 +1848,12 @@ discard block |
||
1848 | 1848 | foreach ($alldata as $key => $row) { |
1849 | 1849 | $count[$key] = $row['airport_departure_icao_count']; |
1850 | 1850 | } |
1851 | - array_multisort($count,SORT_DESC,$alldata); |
|
1851 | + array_multisort($count, SORT_DESC, $alldata); |
|
1852 | 1852 | foreach ($alldata as $number) { |
1853 | - 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); |
|
1853 | + 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); |
|
1854 | 1854 | } |
1855 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter); |
|
1856 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter); |
|
1855 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, $filter); |
|
1856 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, $filter); |
|
1857 | 1857 | $alldata = array(); |
1858 | 1858 | foreach ($pall as $value) { |
1859 | 1859 | $icao = $value['airport_arrival_icao']; |
@@ -1869,36 +1869,36 @@ discard block |
||
1869 | 1869 | foreach ($alldata as $key => $row) { |
1870 | 1870 | $count[$key] = $row['airport_arrival_icao_count']; |
1871 | 1871 | } |
1872 | - array_multisort($count,SORT_DESC,$alldata); |
|
1872 | + array_multisort($count, SORT_DESC, $alldata); |
|
1873 | 1873 | foreach ($alldata as $number) { |
1874 | - 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); |
|
1874 | + 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); |
|
1875 | 1875 | } |
1876 | 1876 | $Spotter = new Spotter($this->db); |
1877 | 1877 | $alldata = $Spotter->countAllMonths($filter); |
1878 | 1878 | $lastyear = false; |
1879 | 1879 | foreach ($alldata as $number) { |
1880 | 1880 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1881 | - $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); |
|
1881 | + $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); |
|
1882 | 1882 | } |
1883 | 1883 | $alldata = $Spotter->countAllMonthsOwners($filter); |
1884 | 1884 | foreach ($alldata as $number) { |
1885 | - $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); |
|
1885 | + $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); |
|
1886 | 1886 | } |
1887 | 1887 | $alldata = $Spotter->countAllMonthsPilots($filter); |
1888 | 1888 | foreach ($alldata as $number) { |
1889 | - $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); |
|
1889 | + $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); |
|
1890 | 1890 | } |
1891 | 1891 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
1892 | 1892 | foreach ($alldata as $number) { |
1893 | - $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); |
|
1893 | + $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); |
|
1894 | 1894 | } |
1895 | 1895 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
1896 | 1896 | foreach ($alldata as $number) { |
1897 | - $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); |
|
1897 | + $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); |
|
1898 | 1898 | } |
1899 | 1899 | echo '...Departure'."\n"; |
1900 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
1901 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
1900 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
1901 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
1902 | 1902 | foreach ($dall as $value) { |
1903 | 1903 | $icao = $value['departure_airport_icao']; |
1904 | 1904 | $ddate = $value['date']; |
@@ -1916,11 +1916,11 @@ discard block |
||
1916 | 1916 | } |
1917 | 1917 | $alldata = $pall; |
1918 | 1918 | foreach ($alldata as $number) { |
1919 | - $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); |
|
1919 | + $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); |
|
1920 | 1920 | } |
1921 | 1921 | echo '...Arrival'."\n"; |
1922 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
1923 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
1922 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
1923 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
1924 | 1924 | foreach ($dall as $value) { |
1925 | 1925 | $icao = $value['arrival_airport_icao']; |
1926 | 1926 | $ddate = $value['date']; |
@@ -1938,32 +1938,32 @@ discard block |
||
1938 | 1938 | } |
1939 | 1939 | $alldata = $pall; |
1940 | 1940 | foreach ($alldata as $number) { |
1941 | - $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); |
|
1941 | + $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); |
|
1942 | 1942 | } |
1943 | 1943 | |
1944 | 1944 | echo 'Flights data...'."\n"; |
1945 | 1945 | echo '-> countAllDatesLastMonth...'."\n"; |
1946 | 1946 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
1947 | 1947 | foreach ($alldata as $number) { |
1948 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
1948 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
1949 | 1949 | } |
1950 | 1950 | echo '-> countAllDates...'."\n"; |
1951 | - $previousdata = $this->countAllDates('',$filter_name); |
|
1952 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
1951 | + $previousdata = $this->countAllDates('', $filter_name); |
|
1952 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
1953 | 1953 | $values = array(); |
1954 | 1954 | foreach ($alldata as $cnt) { |
1955 | 1955 | $values[] = $cnt['date_count']; |
1956 | 1956 | } |
1957 | - array_multisort($values,SORT_DESC,$alldata); |
|
1958 | - array_splice($alldata,11); |
|
1957 | + array_multisort($values, SORT_DESC, $alldata); |
|
1958 | + array_splice($alldata, 11); |
|
1959 | 1959 | foreach ($alldata as $number) { |
1960 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
1960 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
1961 | 1961 | } |
1962 | 1962 | |
1963 | 1963 | echo '-> countAllHours...'."\n"; |
1964 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
1964 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
1965 | 1965 | foreach ($alldata as $number) { |
1966 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
1966 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
1967 | 1967 | } |
1968 | 1968 | } |
1969 | 1969 | |
@@ -1974,16 +1974,16 @@ discard block |
||
1974 | 1974 | // SUM all previous month to put as year |
1975 | 1975 | $previous_year = date('Y'); |
1976 | 1976 | $previous_year--; |
1977 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1978 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1979 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1980 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1977 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1978 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1979 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1980 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1981 | 1981 | $allairlines = $this->getAllAirlineNames(); |
1982 | 1982 | foreach ($allairlines as $data) { |
1983 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1984 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1985 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1986 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1983 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1984 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1985 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1986 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1987 | 1987 | } |
1988 | 1988 | |
1989 | 1989 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -1992,7 +1992,7 @@ discard block |
||
1992 | 1992 | try { |
1993 | 1993 | $sth = $this->db->prepare($query); |
1994 | 1994 | $sth->execute(); |
1995 | - } catch(PDOException $e) { |
|
1995 | + } catch (PDOException $e) { |
|
1996 | 1996 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
1997 | 1997 | } |
1998 | 1998 | } |
@@ -2001,7 +2001,7 @@ discard block |
||
2001 | 2001 | try { |
2002 | 2002 | $sth = $this->db->prepare($query); |
2003 | 2003 | $sth->execute(); |
2004 | - } catch(PDOException $e) { |
|
2004 | + } catch (PDOException $e) { |
|
2005 | 2005 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2006 | 2006 | } |
2007 | 2007 | } |
@@ -2023,7 +2023,7 @@ discard block |
||
2023 | 2023 | try { |
2024 | 2024 | $sth = $this->db->prepare($query); |
2025 | 2025 | $sth->execute(); |
2026 | - } catch(PDOException $e) { |
|
2026 | + } catch (PDOException $e) { |
|
2027 | 2027 | return "error : ".$e->getMessage(); |
2028 | 2028 | } |
2029 | 2029 | } |
@@ -2037,13 +2037,13 @@ discard block |
||
2037 | 2037 | try { |
2038 | 2038 | $sth = $this->db->prepare($query); |
2039 | 2039 | $sth->execute(); |
2040 | - } catch(PDOException $e) { |
|
2040 | + } catch (PDOException $e) { |
|
2041 | 2041 | return "error : ".$e->getMessage(); |
2042 | 2042 | } |
2043 | 2043 | } |
2044 | 2044 | echo 'Insert last stats update date...'."\n"; |
2045 | 2045 | date_default_timezone_set('UTC'); |
2046 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
2046 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
2047 | 2047 | //} |
2048 | 2048 | } |
2049 | 2049 | } |