@@ -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,31 +46,31 @@ 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 getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
67 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
68 | 68 | if ($filter_name == '') $filter_name = $this->filter_name; |
69 | 69 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city 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); |
@@ -85,22 +85,22 @@ discard block |
||
85 | 85 | 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"; |
86 | 86 | try { |
87 | 87 | $sth = $this->db->prepare($query); |
88 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
89 | - } catch(PDOException $e) { |
|
88 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
89 | + } catch (PDOException $e) { |
|
90 | 90 | echo "error : ".$e->getMessage(); |
91 | 91 | } |
92 | 92 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
93 | 93 | if (empty($all)) { |
94 | 94 | $filters = array('airlines' => array($stats_airline)); |
95 | 95 | if ($filter_name != '') { |
96 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
96 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
97 | 97 | } |
98 | 98 | $Spotter = new Spotter($this->db); |
99 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
99 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
100 | 100 | } |
101 | 101 | return $all; |
102 | 102 | } |
103 | - public function countAllAirlineCountries($limit = true,$filter_name = '') { |
|
103 | + public function countAllAirlineCountries($limit = true, $filter_name = '') { |
|
104 | 104 | global $globalStatsFilters; |
105 | 105 | if ($filter_name == '') $filter_name = $this->filter_name; |
106 | 106 | 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"; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | try { |
109 | 109 | $sth = $this->db->prepare($query); |
110 | 110 | $sth->execute(array(':filter_name' => $filter_name)); |
111 | - } catch(PDOException $e) { |
|
111 | + } catch (PDOException $e) { |
|
112 | 112 | echo "error : ".$e->getMessage(); |
113 | 113 | } |
114 | 114 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -116,28 +116,28 @@ discard block |
||
116 | 116 | $Spotter = new Spotter($this->db); |
117 | 117 | $filters = array(); |
118 | 118 | if ($filter_name != '') { |
119 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
119 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
120 | 120 | } |
121 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
121 | + $all = $Spotter->countAllAirlineCountries($limit, $filters); |
|
122 | 122 | } |
123 | 123 | return $all; |
124 | 124 | } |
125 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') { |
|
125 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '') { |
|
126 | 126 | global $globalStatsFilters; |
127 | 127 | if ($filter_name == '') $filter_name = $this->filter_name; |
128 | 128 | 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"; |
129 | 129 | 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"; |
130 | 130 | try { |
131 | 131 | $sth = $this->db->prepare($query); |
132 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
133 | - } catch(PDOException $e) { |
|
132 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
133 | + } catch (PDOException $e) { |
|
134 | 134 | echo "error : ".$e->getMessage(); |
135 | 135 | } |
136 | 136 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
137 | 137 | if (empty($all)) { |
138 | 138 | $filters = array('airlines' => array($stats_airline)); |
139 | 139 | if ($filter_name != '') { |
140 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
140 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
141 | 141 | } |
142 | 142 | $Spotter = new Spotter($this->db); |
143 | 143 | $all = $Spotter->countAllAircraftManufacturers($filters); |
@@ -152,18 +152,18 @@ discard block |
||
152 | 152 | 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"; |
153 | 153 | try { |
154 | 154 | $sth = $this->db->prepare($query); |
155 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
156 | - } catch(PDOException $e) { |
|
155 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
156 | + } catch (PDOException $e) { |
|
157 | 157 | echo "error : ".$e->getMessage(); |
158 | 158 | } |
159 | 159 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
160 | 160 | if (empty($all)) { |
161 | 161 | $filters = array('airlines' => array($stats_airline)); |
162 | 162 | if ($filter_name != '') { |
163 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
163 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
164 | 164 | } |
165 | 165 | $Spotter = new Spotter($this->db); |
166 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
166 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
167 | 167 | } |
168 | 168 | return $all; |
169 | 169 | } |
@@ -174,15 +174,15 @@ discard block |
||
174 | 174 | 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"; |
175 | 175 | try { |
176 | 176 | $sth = $this->db->prepare($query); |
177 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
178 | - } catch(PDOException $e) { |
|
177 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
178 | + } catch (PDOException $e) { |
|
179 | 179 | echo "error : ".$e->getMessage(); |
180 | 180 | } |
181 | 181 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
182 | 182 | if (empty($all)) { |
183 | 183 | $filters = array('airlines' => array($stats_airline)); |
184 | 184 | if ($filter_name != '') { |
185 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
185 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
186 | 186 | } |
187 | 187 | $Spotter = new Spotter($this->db); |
188 | 188 | $all = $Spotter->countAllDepartureCountries($filters); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | return $all; |
191 | 191 | } |
192 | 192 | |
193 | - public function countAllAirlines($limit = true,$filter_name = '') { |
|
193 | + public function countAllAirlines($limit = true, $filter_name = '') { |
|
194 | 194 | global $globalStatsFilters; |
195 | 195 | if ($filter_name == '') $filter_name = $this->filter_name; |
196 | 196 | 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"; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | try { |
199 | 199 | $sth = $this->db->prepare($query); |
200 | 200 | $sth->execute(array(':filter_name' => $filter_name)); |
201 | - } catch(PDOException $e) { |
|
201 | + } catch (PDOException $e) { |
|
202 | 202 | echo "error : ".$e->getMessage(); |
203 | 203 | } |
204 | 204 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -206,58 +206,58 @@ discard block |
||
206 | 206 | $Spotter = new Spotter($this->db); |
207 | 207 | $filters = array(); |
208 | 208 | if ($filter_name != '') { |
209 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
209 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
210 | 210 | } |
211 | 211 | |
212 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
212 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
|
213 | 213 | } |
214 | 214 | return $all; |
215 | 215 | } |
216 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') { |
|
216 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '') { |
|
217 | 217 | global $globalStatsFilters; |
218 | 218 | if ($filter_name == '') $filter_name = $this->filter_name; |
219 | 219 | 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"; |
220 | 220 | 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"; |
221 | 221 | try { |
222 | 222 | $sth = $this->db->prepare($query); |
223 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
224 | - } catch(PDOException $e) { |
|
223 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
224 | + } catch (PDOException $e) { |
|
225 | 225 | echo "error : ".$e->getMessage(); |
226 | 226 | } |
227 | 227 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
228 | 228 | if (empty($all)) { |
229 | 229 | $filters = array('airlines' => array($stats_airline)); |
230 | 230 | if ($filter_name != '') { |
231 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
231 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
232 | 232 | } |
233 | 233 | $Spotter = new Spotter($this->db); |
234 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
234 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
235 | 235 | } |
236 | 236 | return $all; |
237 | 237 | } |
238 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') { |
|
238 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '') { |
|
239 | 239 | global $globalStatsFilters; |
240 | 240 | if ($filter_name == '') $filter_name = $this->filter_name; |
241 | 241 | 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"; |
242 | 242 | 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"; |
243 | 243 | try { |
244 | 244 | $sth = $this->db->prepare($query); |
245 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
246 | - } catch(PDOException $e) { |
|
245 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
246 | + } catch (PDOException $e) { |
|
247 | 247 | echo "error : ".$e->getMessage(); |
248 | 248 | } |
249 | 249 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
250 | 250 | if (empty($all)) { |
251 | 251 | $filters = array('airlines' => array($stats_airline)); |
252 | 252 | if ($filter_name != '') { |
253 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
253 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
254 | 254 | } |
255 | 255 | $Spotter = new Spotter($this->db); |
256 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
256 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
257 | 257 | } |
258 | 258 | return $all; |
259 | 259 | } |
260 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') { |
|
260 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '') { |
|
261 | 261 | $Connection = new Connection(); |
262 | 262 | if ($filter_name == '') $filter_name = $this->filter_name; |
263 | 263 | if ($Connection->tableExists('countries')) { |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | 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"; |
266 | 266 | try { |
267 | 267 | $sth = $this->db->prepare($query); |
268 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
269 | - } catch(PDOException $e) { |
|
268 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
269 | + } catch (PDOException $e) { |
|
270 | 270 | echo "error : ".$e->getMessage(); |
271 | 271 | } |
272 | 272 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -281,70 +281,70 @@ discard block |
||
281 | 281 | return array(); |
282 | 282 | } |
283 | 283 | } |
284 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') { |
|
284 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '') { |
|
285 | 285 | global $globalStatsFilters; |
286 | 286 | if ($filter_name == '') $filter_name = $this->filter_name; |
287 | 287 | 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"; |
288 | 288 | 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"; |
289 | 289 | try { |
290 | 290 | $sth = $this->db->prepare($query); |
291 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
292 | - } catch(PDOException $e) { |
|
291 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
292 | + } catch (PDOException $e) { |
|
293 | 293 | echo "error : ".$e->getMessage(); |
294 | 294 | } |
295 | 295 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
296 | 296 | if (empty($all)) { |
297 | 297 | $filters = array('airlines' => array($stats_airline)); |
298 | 298 | if ($filter_name != '') { |
299 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
299 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
300 | 300 | } |
301 | 301 | $Spotter = new Spotter($this->db); |
302 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
302 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
303 | 303 | } |
304 | 304 | return $all; |
305 | 305 | } |
306 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') { |
|
306 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '') { |
|
307 | 307 | global $globalStatsFilters; |
308 | 308 | if ($filter_name == '') $filter_name = $this->filter_name; |
309 | 309 | 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"; |
310 | 310 | 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"; |
311 | 311 | try { |
312 | 312 | $sth = $this->db->prepare($query); |
313 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
314 | - } catch(PDOException $e) { |
|
313 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
314 | + } catch (PDOException $e) { |
|
315 | 315 | echo "error : ".$e->getMessage(); |
316 | 316 | } |
317 | 317 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
318 | 318 | if (empty($all)) { |
319 | 319 | $filters = array('airlines' => array($stats_airline)); |
320 | 320 | if ($filter_name != '') { |
321 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
321 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
322 | 322 | } |
323 | 323 | $Spotter = new Spotter($this->db); |
324 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
324 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
325 | 325 | } |
326 | 326 | return $all; |
327 | 327 | } |
328 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') { |
|
328 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '') { |
|
329 | 329 | global $globalStatsFilters; |
330 | 330 | if ($filter_name == '') $filter_name = $this->filter_name; |
331 | 331 | 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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
332 | 332 | 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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
333 | 333 | try { |
334 | 334 | $sth = $this->db->prepare($query); |
335 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
336 | - } catch(PDOException $e) { |
|
335 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
336 | + } catch (PDOException $e) { |
|
337 | 337 | echo "error : ".$e->getMessage(); |
338 | 338 | } |
339 | 339 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
340 | 340 | if (empty($all)) { |
341 | 341 | $filters = array('airlines' => array($stats_airline)); |
342 | 342 | if ($filter_name != '') { |
343 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
343 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
344 | 344 | } |
345 | 345 | $Spotter = new Spotter($this->db); |
346 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
347 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
346 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
347 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
348 | 348 | $all = array(); |
349 | 349 | foreach ($pall as $value) { |
350 | 350 | $icao = $value['airport_departure_icao']; |
@@ -361,30 +361,30 @@ discard block |
||
361 | 361 | foreach ($all as $key => $row) { |
362 | 362 | $count[$key] = $row['airport_departure_icao_count']; |
363 | 363 | } |
364 | - array_multisort($count,SORT_DESC,$all); |
|
364 | + array_multisort($count, SORT_DESC, $all); |
|
365 | 365 | } |
366 | 366 | return $all; |
367 | 367 | } |
368 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') { |
|
368 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '') { |
|
369 | 369 | global $globalStatsFilters; |
370 | 370 | if ($filter_name == '') $filter_name = $this->filter_name; |
371 | 371 | 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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
372 | 372 | 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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
373 | 373 | try { |
374 | 374 | $sth = $this->db->prepare($query); |
375 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
376 | - } catch(PDOException $e) { |
|
375 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
376 | + } catch (PDOException $e) { |
|
377 | 377 | echo "error : ".$e->getMessage(); |
378 | 378 | } |
379 | 379 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
380 | 380 | if (empty($all)) { |
381 | 381 | $filters = array('airlines' => array($stats_airline)); |
382 | 382 | if ($filter_name != '') { |
383 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
383 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
384 | 384 | } |
385 | 385 | $Spotter = new Spotter($this->db); |
386 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
387 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
386 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
387 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
388 | 388 | $all = array(); |
389 | 389 | foreach ($pall as $value) { |
390 | 390 | $icao = $value['airport_arrival_icao']; |
@@ -401,12 +401,12 @@ discard block |
||
401 | 401 | foreach ($all as $key => $row) { |
402 | 402 | $count[$key] = $row['airport_arrival_icao_count']; |
403 | 403 | } |
404 | - array_multisort($count,SORT_DESC,$all); |
|
404 | + array_multisort($count, SORT_DESC, $all); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | return $all; |
408 | 408 | } |
409 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
409 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
410 | 410 | global $globalDBdriver, $globalStatsFilters; |
411 | 411 | if ($filter_name == '') $filter_name = $this->filter_name; |
412 | 412 | if ($globalDBdriver == 'mysql') { |
@@ -416,18 +416,18 @@ discard block |
||
416 | 416 | 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"; |
417 | 417 | 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"; |
418 | 418 | } |
419 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
419 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
420 | 420 | try { |
421 | 421 | $sth = $this->db->prepare($query); |
422 | 422 | $sth->execute($query_data); |
423 | - } catch(PDOException $e) { |
|
423 | + } catch (PDOException $e) { |
|
424 | 424 | echo "error : ".$e->getMessage(); |
425 | 425 | } |
426 | 426 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
427 | 427 | if (empty($all)) { |
428 | 428 | $filters = array('airlines' => array($stats_airline)); |
429 | 429 | if ($filter_name != '') { |
430 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
430 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
431 | 431 | } |
432 | 432 | $Spotter = new Spotter($this->db); |
433 | 433 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -436,29 +436,29 @@ discard block |
||
436 | 436 | return $all; |
437 | 437 | } |
438 | 438 | |
439 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
439 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
440 | 440 | global $globalStatsFilters; |
441 | 441 | if ($filter_name == '') $filter_name = $this->filter_name; |
442 | 442 | $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"; |
443 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
443 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
444 | 444 | try { |
445 | 445 | $sth = $this->db->prepare($query); |
446 | 446 | $sth->execute($query_data); |
447 | - } catch(PDOException $e) { |
|
447 | + } catch (PDOException $e) { |
|
448 | 448 | echo "error : ".$e->getMessage(); |
449 | 449 | } |
450 | 450 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
451 | 451 | if (empty($all)) { |
452 | 452 | $filters = array('airlines' => array($stats_airline)); |
453 | 453 | if ($filter_name != '') { |
454 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
454 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
455 | 455 | } |
456 | 456 | $Spotter = new Spotter($this->db); |
457 | 457 | $all = $Spotter->countAllDatesLastMonth($filters); |
458 | 458 | } |
459 | 459 | return $all; |
460 | 460 | } |
461 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
461 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
462 | 462 | global $globalDBdriver, $globalStatsFilters; |
463 | 463 | if ($filter_name == '') $filter_name = $this->filter_name; |
464 | 464 | if ($globalDBdriver == 'mysql') { |
@@ -466,40 +466,40 @@ discard block |
||
466 | 466 | } else { |
467 | 467 | $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"; |
468 | 468 | } |
469 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
469 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
470 | 470 | try { |
471 | 471 | $sth = $this->db->prepare($query); |
472 | 472 | $sth->execute($query_data); |
473 | - } catch(PDOException $e) { |
|
473 | + } catch (PDOException $e) { |
|
474 | 474 | echo "error : ".$e->getMessage(); |
475 | 475 | } |
476 | 476 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
477 | 477 | if (empty($all)) { |
478 | 478 | $filters = array('airlines' => array($stats_airline)); |
479 | 479 | if ($filter_name != '') { |
480 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
480 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
481 | 481 | } |
482 | 482 | $Spotter = new Spotter($this->db); |
483 | 483 | $all = $Spotter->countAllDatesLast7Days($filters); |
484 | 484 | } |
485 | 485 | return $all; |
486 | 486 | } |
487 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
487 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
488 | 488 | global $globalStatsFilters; |
489 | 489 | if ($filter_name == '') $filter_name = $this->filter_name; |
490 | 490 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
491 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
491 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
492 | 492 | try { |
493 | 493 | $sth = $this->db->prepare($query); |
494 | 494 | $sth->execute($query_data); |
495 | - } catch(PDOException $e) { |
|
495 | + } catch (PDOException $e) { |
|
496 | 496 | echo "error : ".$e->getMessage(); |
497 | 497 | } |
498 | 498 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
499 | 499 | if (empty($all)) { |
500 | 500 | $filters = array('airlines' => array($stats_airline)); |
501 | 501 | if ($filter_name != '') { |
502 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
502 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
503 | 503 | } |
504 | 504 | $Spotter = new Spotter($this->db); |
505 | 505 | $all = $Spotter->countAllDates($filters); |
@@ -514,35 +514,35 @@ discard block |
||
514 | 514 | try { |
515 | 515 | $sth = $this->db->prepare($query); |
516 | 516 | $sth->execute($query_data); |
517 | - } catch(PDOException $e) { |
|
517 | + } catch (PDOException $e) { |
|
518 | 518 | echo "error : ".$e->getMessage(); |
519 | 519 | } |
520 | 520 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
521 | 521 | if (empty($all)) { |
522 | 522 | $filters = array(); |
523 | 523 | if ($filter_name != '') { |
524 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
524 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
525 | 525 | } |
526 | 526 | $Spotter = new Spotter($this->db); |
527 | 527 | $all = $Spotter->countAllDatesByAirlines($filters); |
528 | 528 | } |
529 | 529 | return $all; |
530 | 530 | } |
531 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
531 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
532 | 532 | global $globalStatsFilters; |
533 | 533 | if ($filter_name == '') $filter_name = $this->filter_name; |
534 | 534 | $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"; |
535 | 535 | try { |
536 | 536 | $sth = $this->db->prepare($query); |
537 | 537 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
538 | - } catch(PDOException $e) { |
|
538 | + } catch (PDOException $e) { |
|
539 | 539 | echo "error : ".$e->getMessage(); |
540 | 540 | } |
541 | 541 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
542 | 542 | if (empty($all)) { |
543 | 543 | $filters = array('airlines' => array($stats_airline)); |
544 | 544 | if ($filter_name != '') { |
545 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
545 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
546 | 546 | } |
547 | 547 | $Spotter = new Spotter($this->db); |
548 | 548 | $all = $Spotter->countAllMonths($filters); |
@@ -556,21 +556,21 @@ discard block |
||
556 | 556 | try { |
557 | 557 | $sth = $this->db->prepare($query); |
558 | 558 | $sth->execute(array(':filter_name' => $filter_name)); |
559 | - } catch(PDOException $e) { |
|
559 | + } catch (PDOException $e) { |
|
560 | 560 | echo "error : ".$e->getMessage(); |
561 | 561 | } |
562 | 562 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
563 | 563 | if (empty($all)) { |
564 | 564 | $filters = array(); |
565 | 565 | if ($filter_name != '') { |
566 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
566 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
567 | 567 | } |
568 | 568 | $Spotter = new Spotter($this->db); |
569 | 569 | $all = $Spotter->countAllMilitaryMonths($filters); |
570 | 570 | } |
571 | 571 | return $all; |
572 | 572 | } |
573 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
573 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
574 | 574 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
575 | 575 | if ($filter_name == '') $filter_name = $this->filter_name; |
576 | 576 | 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"; |
@@ -587,17 +587,17 @@ discard block |
||
587 | 587 | try { |
588 | 588 | $sth = $this->db->prepare($query); |
589 | 589 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
590 | - } catch(PDOException $e) { |
|
590 | + } catch (PDOException $e) { |
|
591 | 591 | echo "error : ".$e->getMessage(); |
592 | 592 | } |
593 | 593 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
594 | 594 | if (empty($all)) { |
595 | 595 | $filters = array('airlines' => array($stats_airline)); |
596 | 596 | if ($filter_name != '') { |
597 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
597 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
598 | 598 | } |
599 | 599 | $Spotter = new Spotter($this->db); |
600 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
600 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
601 | 601 | } |
602 | 602 | return $all; |
603 | 603 | } |
@@ -605,11 +605,11 @@ discard block |
||
605 | 605 | public function countOverallFlights($stats_airline = '', $filter_name = '') { |
606 | 606 | global $globalStatsFilters; |
607 | 607 | if ($filter_name == '') $filter_name = $this->filter_name; |
608 | - $all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name); |
|
608 | + $all = $this->getSumStats('flights_bymonth', date('Y'), $stats_airline, $filter_name); |
|
609 | 609 | if (empty($all)) { |
610 | 610 | $filters = array('airlines' => array($stats_airline)); |
611 | 611 | if ($filter_name != '') { |
612 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
612 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
613 | 613 | } |
614 | 614 | $Spotter = new Spotter($this->db); |
615 | 615 | $all = $Spotter->countOverallFlights($filters); |
@@ -619,39 +619,39 @@ discard block |
||
619 | 619 | public function countOverallMilitaryFlights($filter_name = '') { |
620 | 620 | global $globalStatsFilters; |
621 | 621 | if ($filter_name == '') $filter_name = $this->filter_name; |
622 | - $all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name); |
|
622 | + $all = $this->getSumStats('military_flights_bymonth', date('Y'), '', $filter_name); |
|
623 | 623 | if (empty($all)) { |
624 | 624 | $filters = array(); |
625 | 625 | if ($filter_name != '') { |
626 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
626 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
627 | 627 | } |
628 | 628 | $Spotter = new Spotter($this->db); |
629 | 629 | $all = $Spotter->countOverallMilitaryFlights($filters); |
630 | 630 | } |
631 | 631 | return $all; |
632 | 632 | } |
633 | - public function countOverallArrival($stats_airline = '',$filter_name = '') { |
|
633 | + public function countOverallArrival($stats_airline = '', $filter_name = '') { |
|
634 | 634 | global $globalStatsFilters; |
635 | 635 | if ($filter_name == '') $filter_name = $this->filter_name; |
636 | - $all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name); |
|
636 | + $all = $this->getSumStats('realarrivals_bymonth', date('Y'), $stats_airline, $filter_name); |
|
637 | 637 | if (empty($all)) { |
638 | 638 | $filters = array('airlines' => array($stats_airline)); |
639 | 639 | if ($filter_name != '') { |
640 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
640 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
641 | 641 | } |
642 | 642 | $Spotter = new Spotter($this->db); |
643 | 643 | $all = $Spotter->countOverallArrival($filters); |
644 | 644 | } |
645 | 645 | return $all; |
646 | 646 | } |
647 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '') { |
|
647 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '') { |
|
648 | 648 | global $globalStatsFilters; |
649 | 649 | if ($filter_name == '') $filter_name = $this->filter_name; |
650 | - $all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name); |
|
650 | + $all = $this->getSumStats('aircrafts_bymonth', date('Y'), $stats_airline, $filter_name); |
|
651 | 651 | if (empty($all)) { |
652 | 652 | $filters = array('airlines' => array($stats_airline)); |
653 | 653 | if ($filter_name != '') { |
654 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
654 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
655 | 655 | } |
656 | 656 | $Spotter = new Spotter($this->db); |
657 | 657 | $all = $Spotter->countOverallAircrafts($filters); |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | try { |
666 | 666 | $sth = $this->db->prepare($query); |
667 | 667 | $sth->execute(array(':filter_name' => $filter_name)); |
668 | - } catch(PDOException $e) { |
|
668 | + } catch (PDOException $e) { |
|
669 | 669 | echo "error : ".$e->getMessage(); |
670 | 670 | } |
671 | 671 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -674,14 +674,14 @@ discard block |
||
674 | 674 | if (empty($all)) { |
675 | 675 | $filters = array(); |
676 | 676 | if ($filter_name != '') { |
677 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
677 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
678 | 678 | } |
679 | 679 | $Spotter = new Spotter($this->db); |
680 | 680 | $all = $Spotter->countOverallAirlines($filters); |
681 | 681 | } |
682 | 682 | return $all; |
683 | 683 | } |
684 | - public function countOverallOwners($stats_airline = '',$filter_name = '') { |
|
684 | + public function countOverallOwners($stats_airline = '', $filter_name = '') { |
|
685 | 685 | global $globalStatsFilters; |
686 | 686 | if ($filter_name == '') $filter_name = $this->filter_name; |
687 | 687 | /* |
@@ -695,25 +695,25 @@ discard block |
||
695 | 695 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
696 | 696 | $all = $result[0]['nb_owner']; |
697 | 697 | */ |
698 | - $all = $this->getSumStats('owners_bymonth',date('Y'),$stats_airline,$filter_name); |
|
698 | + $all = $this->getSumStats('owners_bymonth', date('Y'), $stats_airline, $filter_name); |
|
699 | 699 | if (empty($all)) { |
700 | 700 | $filters = array('airlines' => array($stats_airline)); |
701 | 701 | if ($filter_name != '') { |
702 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
702 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
703 | 703 | } |
704 | 704 | $Spotter = new Spotter($this->db); |
705 | 705 | $all = $Spotter->countOverallOwners($filters); |
706 | 706 | } |
707 | 707 | return $all; |
708 | 708 | } |
709 | - public function countOverallPilots($stats_airline = '',$filter_name = '') { |
|
709 | + public function countOverallPilots($stats_airline = '', $filter_name = '') { |
|
710 | 710 | global $globalStatsFilters; |
711 | 711 | if ($filter_name == '') $filter_name = $this->filter_name; |
712 | - $all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name); |
|
712 | + $all = $this->getSumStats('pilots_bymonth', date('Y'), $stats_airline, $filter_name); |
|
713 | 713 | if (empty($all)) { |
714 | 714 | $filters = array('airlines' => array($stats_airline)); |
715 | 715 | if ($filter_name != '') { |
716 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
716 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
717 | 717 | } |
718 | 718 | $Spotter = new Spotter($this->db); |
719 | 719 | $all = $Spotter->countOverallPilots($filters); |
@@ -721,33 +721,33 @@ discard block |
||
721 | 721 | return $all; |
722 | 722 | } |
723 | 723 | |
724 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
724 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
725 | 725 | if ($filter_name == '') $filter_name = $this->filter_name; |
726 | 726 | $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"; |
727 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
727 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
728 | 728 | try { |
729 | 729 | $sth = $this->db->prepare($query); |
730 | 730 | $sth->execute($query_values); |
731 | - } catch(PDOException $e) { |
|
731 | + } catch (PDOException $e) { |
|
732 | 732 | echo "error : ".$e->getMessage(); |
733 | 733 | } |
734 | 734 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
735 | 735 | return $all; |
736 | 736 | } |
737 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
737 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
738 | 738 | if ($filter_name == '') $filter_name = $this->filter_name; |
739 | 739 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
740 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
740 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
741 | 741 | try { |
742 | 742 | $sth = $this->db->prepare($query); |
743 | 743 | $sth->execute($query_values); |
744 | - } catch(PDOException $e) { |
|
744 | + } catch (PDOException $e) { |
|
745 | 745 | echo "error : ".$e->getMessage(); |
746 | 746 | } |
747 | 747 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
748 | 748 | return $all; |
749 | 749 | } |
750 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') { |
|
750 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '') { |
|
751 | 751 | if ($filter_name == '') $filter_name = $this->filter_name; |
752 | 752 | global $globalArchiveMonths, $globalDBdriver; |
753 | 753 | if ($globalDBdriver == 'mysql') { |
@@ -755,11 +755,11 @@ discard block |
||
755 | 755 | } else { |
756 | 756 | $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"; |
757 | 757 | } |
758 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
758 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
759 | 759 | try { |
760 | 760 | $sth = $this->db->prepare($query); |
761 | 761 | $sth->execute($query_values); |
762 | - } catch(PDOException $e) { |
|
762 | + } catch (PDOException $e) { |
|
763 | 763 | echo "error : ".$e->getMessage(); |
764 | 764 | } |
765 | 765 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | try { |
778 | 778 | $sth = $this->db->prepare($query); |
779 | 779 | $sth->execute($query_values); |
780 | - } catch(PDOException $e) { |
|
780 | + } catch (PDOException $e) { |
|
781 | 781 | echo "error : ".$e->getMessage(); |
782 | 782 | } |
783 | 783 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | try { |
795 | 795 | $sth = $this->db->prepare($query); |
796 | 796 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
797 | - } catch(PDOException $e) { |
|
797 | + } catch (PDOException $e) { |
|
798 | 798 | echo "error : ".$e->getMessage(); |
799 | 799 | } |
800 | 800 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | try { |
812 | 812 | $sth = $this->db->prepare($query); |
813 | 813 | $sth->execute(array(':filter_name' => $filter_name)); |
814 | - } catch(PDOException $e) { |
|
814 | + } catch (PDOException $e) { |
|
815 | 815 | echo "error : ".$e->getMessage(); |
816 | 816 | } |
817 | 817 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | try { |
829 | 829 | $sth = $this->db->prepare($query); |
830 | 830 | $sth->execute(array(':filter_name' => $filter_name)); |
831 | - } catch(PDOException $e) { |
|
831 | + } catch (PDOException $e) { |
|
832 | 832 | echo "error : ".$e->getMessage(); |
833 | 833 | } |
834 | 834 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -845,14 +845,14 @@ discard block |
||
845 | 845 | try { |
846 | 846 | $sth = $this->db->prepare($query); |
847 | 847 | $sth->execute(array(':filter_name' => $filter_name)); |
848 | - } catch(PDOException $e) { |
|
848 | + } catch (PDOException $e) { |
|
849 | 849 | echo "error : ".$e->getMessage(); |
850 | 850 | } |
851 | 851 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
852 | 852 | return $all[0]['total']; |
853 | 853 | } |
854 | 854 | |
855 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
855 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
856 | 856 | global $globalDBdriver; |
857 | 857 | if ($filter_name == '') $filter_name = $this->filter_name; |
858 | 858 | if ($globalDBdriver == 'mysql') { |
@@ -860,15 +860,15 @@ discard block |
||
860 | 860 | } else { |
861 | 861 | $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);"; |
862 | 862 | } |
863 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
863 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
864 | 864 | try { |
865 | 865 | $sth = $this->db->prepare($query); |
866 | 866 | $sth->execute($query_values); |
867 | - } catch(PDOException $e) { |
|
867 | + } catch (PDOException $e) { |
|
868 | 868 | return "error : ".$e->getMessage(); |
869 | 869 | } |
870 | 870 | } |
871 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
871 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
872 | 872 | global $globalDBdriver; |
873 | 873 | if ($filter_name == '') $filter_name = $this->filter_name; |
874 | 874 | if ($globalDBdriver == 'mysql') { |
@@ -877,219 +877,219 @@ discard block |
||
877 | 877 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
878 | 878 | $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);"; |
879 | 879 | } |
880 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
880 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
881 | 881 | try { |
882 | 882 | $sth = $this->db->prepare($query); |
883 | 883 | $sth->execute($query_values); |
884 | - } catch(PDOException $e) { |
|
884 | + } catch (PDOException $e) { |
|
885 | 885 | return "error : ".$e->getMessage(); |
886 | 886 | } |
887 | 887 | } |
888 | - public function getStatsSource($date,$stats_type = '') { |
|
888 | + public function getStatsSource($date, $stats_type = '') { |
|
889 | 889 | if ($stats_type == '') { |
890 | 890 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
891 | 891 | $query_values = array(':date' => $date); |
892 | 892 | } else { |
893 | 893 | $query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name"; |
894 | - $query_values = array(':date' => $date,':stats_type' => $stats_type); |
|
894 | + $query_values = array(':date' => $date, ':stats_type' => $stats_type); |
|
895 | 895 | } |
896 | 896 | try { |
897 | 897 | $sth = $this->db->prepare($query); |
898 | 898 | $sth->execute($query_values); |
899 | - } catch(PDOException $e) { |
|
899 | + } catch (PDOException $e) { |
|
900 | 900 | echo "error : ".$e->getMessage(); |
901 | 901 | } |
902 | 902 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
903 | 903 | return $all; |
904 | 904 | } |
905 | 905 | |
906 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
906 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
907 | 907 | global $globalDBdriver; |
908 | 908 | if ($globalDBdriver == 'mysql') { |
909 | 909 | $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"; |
910 | 910 | } else { |
911 | 911 | $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);"; |
912 | 912 | } |
913 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
913 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
914 | 914 | try { |
915 | 915 | $sth = $this->db->prepare($query); |
916 | 916 | $sth->execute($query_values); |
917 | - } catch(PDOException $e) { |
|
917 | + } catch (PDOException $e) { |
|
918 | 918 | return "error : ".$e->getMessage(); |
919 | 919 | } |
920 | 920 | } |
921 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
921 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
922 | 922 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
923 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
923 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
924 | 924 | try { |
925 | 925 | $sth = $this->db->prepare($query); |
926 | 926 | $sth->execute($query_values); |
927 | - } catch(PDOException $e) { |
|
927 | + } catch (PDOException $e) { |
|
928 | 928 | return "error : ".$e->getMessage(); |
929 | 929 | } |
930 | 930 | } |
931 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') { |
|
931 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '') { |
|
932 | 932 | global $globalDBdriver; |
933 | 933 | if ($globalDBdriver == 'mysql') { |
934 | 934 | $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"; |
935 | 935 | } else { |
936 | 936 | $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);"; |
937 | 937 | } |
938 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
938 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
939 | 939 | try { |
940 | 940 | $sth = $this->db->prepare($query); |
941 | 941 | $sth->execute($query_values); |
942 | - } catch(PDOException $e) { |
|
942 | + } catch (PDOException $e) { |
|
943 | 943 | return "error : ".$e->getMessage(); |
944 | 944 | } |
945 | 945 | } |
946 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') { |
|
946 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '') { |
|
947 | 947 | global $globalDBdriver; |
948 | 948 | if ($globalDBdriver == 'mysql') { |
949 | 949 | $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"; |
950 | 950 | } else { |
951 | 951 | $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);"; |
952 | 952 | } |
953 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
953 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
954 | 954 | try { |
955 | 955 | $sth = $this->db->prepare($query); |
956 | 956 | $sth->execute($query_values); |
957 | - } catch(PDOException $e) { |
|
957 | + } catch (PDOException $e) { |
|
958 | 958 | return "error : ".$e->getMessage(); |
959 | 959 | } |
960 | 960 | } |
961 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') { |
|
961 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '') { |
|
962 | 962 | global $globalDBdriver; |
963 | 963 | if ($globalDBdriver == 'mysql') { |
964 | 964 | $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"; |
965 | 965 | } else { |
966 | 966 | $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);"; |
967 | 967 | } |
968 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
968 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
969 | 969 | try { |
970 | 970 | $sth = $this->db->prepare($query); |
971 | 971 | $sth->execute($query_values); |
972 | - } catch(PDOException $e) { |
|
972 | + } catch (PDOException $e) { |
|
973 | 973 | return "error : ".$e->getMessage(); |
974 | 974 | } |
975 | 975 | } |
976 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
|
976 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
|
977 | 977 | global $globalDBdriver; |
978 | 978 | if ($globalDBdriver == 'mysql') { |
979 | 979 | $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"; |
980 | 980 | } else { |
981 | 981 | $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);"; |
982 | 982 | } |
983 | - $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); |
|
983 | + $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); |
|
984 | 984 | try { |
985 | 985 | $sth = $this->db->prepare($query); |
986 | 986 | $sth->execute($query_values); |
987 | - } catch(PDOException $e) { |
|
987 | + } catch (PDOException $e) { |
|
988 | 988 | return "error : ".$e->getMessage(); |
989 | 989 | } |
990 | 990 | } |
991 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') { |
|
991 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '') { |
|
992 | 992 | global $globalDBdriver; |
993 | 993 | if ($globalDBdriver == 'mysql') { |
994 | 994 | $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"; |
995 | 995 | } else { |
996 | 996 | $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);"; |
997 | 997 | } |
998 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
998 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
999 | 999 | try { |
1000 | 1000 | $sth = $this->db->prepare($query); |
1001 | 1001 | $sth->execute($query_values); |
1002 | - } catch(PDOException $e) { |
|
1002 | + } catch (PDOException $e) { |
|
1003 | 1003 | return "error : ".$e->getMessage(); |
1004 | 1004 | } |
1005 | 1005 | } |
1006 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') { |
|
1006 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
1007 | 1007 | global $globalDBdriver; |
1008 | 1008 | if ($globalDBdriver == 'mysql') { |
1009 | 1009 | $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"; |
1010 | 1010 | } else { |
1011 | 1011 | $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);"; |
1012 | 1012 | } |
1013 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1013 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1014 | 1014 | try { |
1015 | 1015 | $sth = $this->db->prepare($query); |
1016 | 1016 | $sth->execute($query_values); |
1017 | - } catch(PDOException $e) { |
|
1017 | + } catch (PDOException $e) { |
|
1018 | 1018 | return "error : ".$e->getMessage(); |
1019 | 1019 | } |
1020 | 1020 | } |
1021 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '') { |
|
1021 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '') { |
|
1022 | 1022 | global $globalDBdriver; |
1023 | 1023 | if ($globalDBdriver == 'mysql') { |
1024 | 1024 | $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"; |
1025 | 1025 | } else { |
1026 | 1026 | $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);"; |
1027 | 1027 | } |
1028 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1028 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1029 | 1029 | try { |
1030 | 1030 | $sth = $this->db->prepare($query); |
1031 | 1031 | $sth->execute($query_values); |
1032 | - } catch(PDOException $e) { |
|
1032 | + } catch (PDOException $e) { |
|
1033 | 1033 | return "error : ".$e->getMessage(); |
1034 | 1034 | } |
1035 | 1035 | } |
1036 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1036 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1037 | 1037 | global $globalDBdriver; |
1038 | 1038 | if ($globalDBdriver == 'mysql') { |
1039 | 1039 | $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"; |
1040 | 1040 | } else { |
1041 | 1041 | $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);"; |
1042 | 1042 | } |
1043 | - $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); |
|
1043 | + $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); |
|
1044 | 1044 | try { |
1045 | 1045 | $sth = $this->db->prepare($query); |
1046 | 1046 | $sth->execute($query_values); |
1047 | - } catch(PDOException $e) { |
|
1047 | + } catch (PDOException $e) { |
|
1048 | 1048 | return "error : ".$e->getMessage(); |
1049 | 1049 | } |
1050 | 1050 | } |
1051 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1051 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1052 | 1052 | global $globalDBdriver; |
1053 | 1053 | if ($globalDBdriver == 'mysql') { |
1054 | 1054 | $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"; |
1055 | 1055 | } else { |
1056 | 1056 | $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);"; |
1057 | 1057 | } |
1058 | - $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); |
|
1058 | + $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); |
|
1059 | 1059 | try { |
1060 | 1060 | $sth = $this->db->prepare($query); |
1061 | 1061 | $sth->execute($query_values); |
1062 | - } catch(PDOException $e) { |
|
1062 | + } catch (PDOException $e) { |
|
1063 | 1063 | return "error : ".$e->getMessage(); |
1064 | 1064 | } |
1065 | 1065 | } |
1066 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1066 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1067 | 1067 | global $globalDBdriver; |
1068 | 1068 | if ($globalDBdriver == 'mysql') { |
1069 | 1069 | $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"; |
1070 | 1070 | } else { |
1071 | 1071 | $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);"; |
1072 | 1072 | } |
1073 | - $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); |
|
1073 | + $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); |
|
1074 | 1074 | try { |
1075 | 1075 | $sth = $this->db->prepare($query); |
1076 | 1076 | $sth->execute($query_values); |
1077 | - } catch(PDOException $e) { |
|
1077 | + } catch (PDOException $e) { |
|
1078 | 1078 | return "error : ".$e->getMessage(); |
1079 | 1079 | } |
1080 | 1080 | } |
1081 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1081 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1082 | 1082 | global $globalDBdriver; |
1083 | 1083 | if ($globalDBdriver == 'mysql') { |
1084 | 1084 | $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"; |
1085 | 1085 | } else { |
1086 | 1086 | $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);"; |
1087 | 1087 | } |
1088 | - $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); |
|
1088 | + $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); |
|
1089 | 1089 | try { |
1090 | 1090 | $sth = $this->db->prepare($query); |
1091 | 1091 | $sth->execute($query_values); |
1092 | - } catch(PDOException $e) { |
|
1092 | + } catch (PDOException $e) { |
|
1093 | 1093 | return "error : ".$e->getMessage(); |
1094 | 1094 | } |
1095 | 1095 | } |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | try { |
1101 | 1101 | $sth = $this->db->prepare($query); |
1102 | 1102 | $sth->execute($query_values); |
1103 | - } catch(PDOException $e) { |
|
1103 | + } catch (PDOException $e) { |
|
1104 | 1104 | return "error : ".$e->getMessage(); |
1105 | 1105 | } |
1106 | 1106 | } |
@@ -1110,7 +1110,7 @@ discard block |
||
1110 | 1110 | try { |
1111 | 1111 | $sth = $this->db->prepare($query); |
1112 | 1112 | $sth->execute($query_values); |
1113 | - } catch(PDOException $e) { |
|
1113 | + } catch (PDOException $e) { |
|
1114 | 1114 | return "error : ".$e->getMessage(); |
1115 | 1115 | } |
1116 | 1116 | } |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | try { |
1121 | 1121 | $sth = $this->db->prepare($query); |
1122 | 1122 | $sth->execute($query_values); |
1123 | - } catch(PDOException $e) { |
|
1123 | + } catch (PDOException $e) { |
|
1124 | 1124 | return "error : ".$e->getMessage(); |
1125 | 1125 | } |
1126 | 1126 | } |
@@ -1358,33 +1358,33 @@ discard block |
||
1358 | 1358 | $last_update_day = $last_update[0]['value']; |
1359 | 1359 | } else $last_update_day = '2012-12-12 12:12:12'; |
1360 | 1360 | $Spotter = new Spotter($this->db); |
1361 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1361 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
1362 | 1362 | foreach ($alldata as $number) { |
1363 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']); |
|
1363 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']); |
|
1364 | 1364 | } |
1365 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
1365 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
1366 | 1366 | foreach ($alldata as $number) { |
1367 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']); |
|
1367 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']); |
|
1368 | 1368 | } |
1369 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
1369 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
1370 | 1370 | foreach ($alldata as $number) { |
1371 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']); |
|
1371 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']); |
|
1372 | 1372 | } |
1373 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
1373 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
1374 | 1374 | foreach ($alldata as $number) { |
1375 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
1375 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
1376 | 1376 | } |
1377 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
1377 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
1378 | 1378 | foreach ($alldata as $number) { |
1379 | - $this->addStatOwner($number['owner_name'],$number['owner_count']); |
|
1379 | + $this->addStatOwner($number['owner_name'], $number['owner_count']); |
|
1380 | 1380 | } |
1381 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
1381 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
1382 | 1382 | foreach ($alldata as $number) { |
1383 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name']); |
|
1383 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name']); |
|
1384 | 1384 | } |
1385 | 1385 | |
1386 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
1387 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1386 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
1387 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
1388 | 1388 | $alldata = array(); |
1389 | 1389 | |
1390 | 1390 | foreach ($pall as $value) { |
@@ -1401,12 +1401,12 @@ discard block |
||
1401 | 1401 | foreach ($alldata as $key => $row) { |
1402 | 1402 | $count[$key] = $row['airport_departure_icao_count']; |
1403 | 1403 | } |
1404 | - array_multisort($count,SORT_DESC,$alldata); |
|
1404 | + array_multisort($count, SORT_DESC, $alldata); |
|
1405 | 1405 | foreach ($alldata as $number) { |
1406 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']); |
|
1406 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count']); |
|
1407 | 1407 | } |
1408 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
1409 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1408 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
1409 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
1410 | 1410 | $alldata = array(); |
1411 | 1411 | foreach ($pall as $value) { |
1412 | 1412 | $icao = $value['airport_arrival_icao']; |
@@ -1422,15 +1422,15 @@ discard block |
||
1422 | 1422 | foreach ($alldata as $key => $row) { |
1423 | 1423 | $count[$key] = $row['airport_arrival_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->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']); |
|
1427 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count']); |
|
1428 | 1428 | } |
1429 | 1429 | if ($Connection->tableExists('countries')) { |
1430 | 1430 | $SpotterArchive = new SpotterArchive(); |
1431 | - $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
1431 | + $alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day); |
|
1432 | 1432 | foreach ($alldata as $number) { |
1433 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']); |
|
1433 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']); |
|
1434 | 1434 | } |
1435 | 1435 | } |
1436 | 1436 | |
@@ -1443,31 +1443,31 @@ discard block |
||
1443 | 1443 | $lastyear = false; |
1444 | 1444 | foreach ($alldata as $number) { |
1445 | 1445 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1446 | - $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']))); |
|
1446 | + $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']))); |
|
1447 | 1447 | } |
1448 | 1448 | $alldata = $Spotter->countAllMilitaryMonths(); |
1449 | 1449 | foreach ($alldata as $number) { |
1450 | - $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']))); |
|
1450 | + $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']))); |
|
1451 | 1451 | } |
1452 | 1452 | $alldata = $Spotter->countAllMonthsOwners(); |
1453 | 1453 | foreach ($alldata as $number) { |
1454 | - $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']))); |
|
1454 | + $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']))); |
|
1455 | 1455 | } |
1456 | 1456 | $alldata = $Spotter->countAllMonthsPilots(); |
1457 | 1457 | foreach ($alldata as $number) { |
1458 | - $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']))); |
|
1458 | + $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']))); |
|
1459 | 1459 | } |
1460 | 1460 | $alldata = $Spotter->countAllMonthsAirlines(); |
1461 | 1461 | foreach ($alldata as $number) { |
1462 | - $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']))); |
|
1462 | + $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']))); |
|
1463 | 1463 | } |
1464 | 1464 | $alldata = $Spotter->countAllMonthsAircrafts(); |
1465 | 1465 | foreach ($alldata as $number) { |
1466 | - $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']))); |
|
1466 | + $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']))); |
|
1467 | 1467 | } |
1468 | 1468 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
1469 | 1469 | foreach ($alldata as $number) { |
1470 | - $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']))); |
|
1470 | + $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']))); |
|
1471 | 1471 | } |
1472 | 1472 | echo 'Airports data...'."\n"; |
1473 | 1473 | echo '...Departure'."\n"; |
@@ -1512,7 +1512,7 @@ discard block |
||
1512 | 1512 | } |
1513 | 1513 | $alldata = $pall; |
1514 | 1514 | foreach ($alldata as $number) { |
1515 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
1515 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
1516 | 1516 | } |
1517 | 1517 | echo '...Arrival'."\n"; |
1518 | 1518 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | } |
1555 | 1555 | $alldata = $pall; |
1556 | 1556 | foreach ($alldata as $number) { |
1557 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
1557 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
1558 | 1558 | } |
1559 | 1559 | |
1560 | 1560 | echo 'Flights data...'."\n"; |
@@ -1562,28 +1562,28 @@ discard block |
||
1562 | 1562 | echo '-> countAllDatesLastMonth...'."\n"; |
1563 | 1563 | $alldata = $Spotter->countAllDatesLastMonth(); |
1564 | 1564 | foreach ($alldata as $number) { |
1565 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
1565 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
1566 | 1566 | } |
1567 | 1567 | echo '-> countAllDates...'."\n"; |
1568 | 1568 | $previousdata = $this->countAllDates(); |
1569 | 1569 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
1570 | 1570 | $this->deleteStatFlight('date'); |
1571 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates()); |
|
1571 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates()); |
|
1572 | 1572 | $values = array(); |
1573 | 1573 | foreach ($alldata as $cnt) { |
1574 | 1574 | $values[] = $cnt['date_count']; |
1575 | 1575 | } |
1576 | - array_multisort($values,SORT_DESC,$alldata); |
|
1577 | - array_splice($alldata,11); |
|
1576 | + array_multisort($values, SORT_DESC, $alldata); |
|
1577 | + array_splice($alldata, 11); |
|
1578 | 1578 | foreach ($alldata as $number) { |
1579 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
1579 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
1580 | 1580 | } |
1581 | 1581 | |
1582 | 1582 | $this->deleteStatFlight('hour'); |
1583 | 1583 | echo '-> countAllHours...'."\n"; |
1584 | 1584 | $alldata = $Spotter->countAllHours('hour'); |
1585 | 1585 | foreach ($alldata as $number) { |
1586 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
1586 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
1587 | 1587 | } |
1588 | 1588 | |
1589 | 1589 | |
@@ -1591,29 +1591,29 @@ discard block |
||
1591 | 1591 | // Count by airlines |
1592 | 1592 | echo '--- Stats by airlines ---'."\n"; |
1593 | 1593 | $Spotter = new Spotter($this->db); |
1594 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
1594 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
1595 | 1595 | foreach ($alldata as $number) { |
1596 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']); |
|
1596 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']); |
|
1597 | 1597 | } |
1598 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
1598 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
1599 | 1599 | foreach ($alldata as $number) { |
1600 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']); |
|
1600 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']); |
|
1601 | 1601 | } |
1602 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
1602 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
1603 | 1603 | foreach ($alldata as $number) { |
1604 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
1604 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
1605 | 1605 | } |
1606 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
1606 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
1607 | 1607 | foreach ($alldata as $number) { |
1608 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']); |
|
1608 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']); |
|
1609 | 1609 | } |
1610 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
1610 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
1611 | 1611 | foreach ($alldata as $number) { |
1612 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao']); |
|
1612 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao']); |
|
1613 | 1613 | } |
1614 | 1614 | |
1615 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1616 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1615 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1616 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1617 | 1617 | //$alldata = array(); |
1618 | 1618 | foreach ($dall as $value) { |
1619 | 1619 | $icao = $value['airport_departure_icao']; |
@@ -1632,10 +1632,10 @@ discard block |
||
1632 | 1632 | } |
1633 | 1633 | $alldata = $pall; |
1634 | 1634 | foreach ($alldata as $number) { |
1635 | - 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']); |
|
1635 | + 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']); |
|
1636 | 1636 | } |
1637 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1638 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1637 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1638 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1639 | 1639 | //$alldata = array(); |
1640 | 1640 | foreach ($dall as $value) { |
1641 | 1641 | $icao = $value['airport_arrival_icao']; |
@@ -1654,30 +1654,30 @@ discard block |
||
1654 | 1654 | } |
1655 | 1655 | $alldata = $pall; |
1656 | 1656 | foreach ($alldata as $number) { |
1657 | - 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']); |
|
1657 | + 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']); |
|
1658 | 1658 | } |
1659 | 1659 | $Spotter = new Spotter($this->db); |
1660 | 1660 | $alldata = $Spotter->countAllMonthsByAirlines(); |
1661 | 1661 | $lastyear = false; |
1662 | 1662 | foreach ($alldata as $number) { |
1663 | 1663 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1664 | - $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']); |
|
1664 | + $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']); |
|
1665 | 1665 | } |
1666 | 1666 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
1667 | 1667 | foreach ($alldata as $number) { |
1668 | - $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']); |
|
1668 | + $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']); |
|
1669 | 1669 | } |
1670 | 1670 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
1671 | 1671 | foreach ($alldata as $number) { |
1672 | - $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']); |
|
1672 | + $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']); |
|
1673 | 1673 | } |
1674 | 1674 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
1675 | 1675 | foreach ($alldata as $number) { |
1676 | - $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']); |
|
1676 | + $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']); |
|
1677 | 1677 | } |
1678 | 1678 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
1679 | 1679 | foreach ($alldata as $number) { |
1680 | - $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']); |
|
1680 | + $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']); |
|
1681 | 1681 | } |
1682 | 1682 | echo '...Departure'."\n"; |
1683 | 1683 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -1700,7 +1700,7 @@ discard block |
||
1700 | 1700 | } |
1701 | 1701 | $alldata = $pall; |
1702 | 1702 | foreach ($alldata as $number) { |
1703 | - $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']); |
|
1703 | + $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']); |
|
1704 | 1704 | } |
1705 | 1705 | echo '...Arrival'."\n"; |
1706 | 1706 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -1723,32 +1723,32 @@ discard block |
||
1723 | 1723 | } |
1724 | 1724 | $alldata = $pall; |
1725 | 1725 | foreach ($alldata as $number) { |
1726 | - $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']); |
|
1726 | + $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']); |
|
1727 | 1727 | } |
1728 | 1728 | |
1729 | 1729 | echo 'Flights data...'."\n"; |
1730 | 1730 | echo '-> countAllDatesLastMonth...'."\n"; |
1731 | 1731 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
1732 | 1732 | foreach ($alldata as $number) { |
1733 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
1733 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1734 | 1734 | } |
1735 | 1735 | echo '-> countAllDates...'."\n"; |
1736 | 1736 | //$previousdata = $this->countAllDatesByAirlines(); |
1737 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
|
1737 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines()); |
|
1738 | 1738 | $values = array(); |
1739 | 1739 | foreach ($alldata as $cnt) { |
1740 | 1740 | $values[] = $cnt['date_count']; |
1741 | 1741 | } |
1742 | - array_multisort($values,SORT_DESC,$alldata); |
|
1743 | - array_splice($alldata,11); |
|
1742 | + array_multisort($values, SORT_DESC, $alldata); |
|
1743 | + array_splice($alldata, 11); |
|
1744 | 1744 | foreach ($alldata as $number) { |
1745 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
1745 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1746 | 1746 | } |
1747 | 1747 | |
1748 | 1748 | echo '-> countAllHours...'."\n"; |
1749 | 1749 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
1750 | 1750 | foreach ($alldata as $number) { |
1751 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
1751 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
1752 | 1752 | } |
1753 | 1753 | |
1754 | 1754 | |
@@ -1759,29 +1759,29 @@ discard block |
||
1759 | 1759 | // Count by filter |
1760 | 1760 | echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
1761 | 1761 | $Spotter = new Spotter($this->db); |
1762 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
1762 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
1763 | 1763 | foreach ($alldata as $number) { |
1764 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name); |
|
1764 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name); |
|
1765 | 1765 | } |
1766 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
1766 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
1767 | 1767 | foreach ($alldata as $number) { |
1768 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name); |
|
1768 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name); |
|
1769 | 1769 | } |
1770 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
1770 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
1771 | 1771 | foreach ($alldata as $number) { |
1772 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name); |
|
1772 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name); |
|
1773 | 1773 | } |
1774 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
1774 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
1775 | 1775 | foreach ($alldata as $number) { |
1776 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name); |
|
1776 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name); |
|
1777 | 1777 | } |
1778 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
1778 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
1779 | 1779 | foreach ($alldata as $number) { |
1780 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name); |
|
1780 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name); |
|
1781 | 1781 | } |
1782 | 1782 | |
1783 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
1784 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
1783 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
1784 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
1785 | 1785 | $alldata = array(); |
1786 | 1786 | foreach ($pall as $value) { |
1787 | 1787 | $icao = $value['airport_departure_icao']; |
@@ -1797,12 +1797,12 @@ discard block |
||
1797 | 1797 | foreach ($alldata as $key => $row) { |
1798 | 1798 | $count[$key] = $row['airport_departure_icao_count']; |
1799 | 1799 | } |
1800 | - array_multisort($count,SORT_DESC,$alldata); |
|
1800 | + array_multisort($count, SORT_DESC, $alldata); |
|
1801 | 1801 | foreach ($alldata as $number) { |
1802 | - 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); |
|
1802 | + 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); |
|
1803 | 1803 | } |
1804 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter); |
|
1805 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter); |
|
1804 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, $filter); |
|
1805 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, $filter); |
|
1806 | 1806 | $alldata = array(); |
1807 | 1807 | foreach ($pall as $value) { |
1808 | 1808 | $icao = $value['airport_arrival_icao']; |
@@ -1818,36 +1818,36 @@ discard block |
||
1818 | 1818 | foreach ($alldata as $key => $row) { |
1819 | 1819 | $count[$key] = $row['airport_arrival_icao_count']; |
1820 | 1820 | } |
1821 | - array_multisort($count,SORT_DESC,$alldata); |
|
1821 | + array_multisort($count, SORT_DESC, $alldata); |
|
1822 | 1822 | foreach ($alldata as $number) { |
1823 | - 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); |
|
1823 | + 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); |
|
1824 | 1824 | } |
1825 | 1825 | $Spotter = new Spotter($this->db); |
1826 | 1826 | $alldata = $Spotter->countAllMonths($filter); |
1827 | 1827 | $lastyear = false; |
1828 | 1828 | foreach ($alldata as $number) { |
1829 | 1829 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1830 | - $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); |
|
1830 | + $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); |
|
1831 | 1831 | } |
1832 | 1832 | $alldata = $Spotter->countAllMonthsOwners($filter); |
1833 | 1833 | foreach ($alldata as $number) { |
1834 | - $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); |
|
1834 | + $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); |
|
1835 | 1835 | } |
1836 | 1836 | $alldata = $Spotter->countAllMonthsPilots($filter); |
1837 | 1837 | foreach ($alldata as $number) { |
1838 | - $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); |
|
1838 | + $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); |
|
1839 | 1839 | } |
1840 | 1840 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
1841 | 1841 | foreach ($alldata as $number) { |
1842 | - $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); |
|
1842 | + $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); |
|
1843 | 1843 | } |
1844 | 1844 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
1845 | 1845 | foreach ($alldata as $number) { |
1846 | - $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); |
|
1846 | + $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); |
|
1847 | 1847 | } |
1848 | 1848 | echo '...Departure'."\n"; |
1849 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
1850 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
1849 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
1850 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
1851 | 1851 | foreach ($dall as $value) { |
1852 | 1852 | $icao = $value['departure_airport_icao']; |
1853 | 1853 | $ddate = $value['date']; |
@@ -1865,11 +1865,11 @@ discard block |
||
1865 | 1865 | } |
1866 | 1866 | $alldata = $pall; |
1867 | 1867 | foreach ($alldata as $number) { |
1868 | - $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); |
|
1868 | + $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); |
|
1869 | 1869 | } |
1870 | 1870 | echo '...Arrival'."\n"; |
1871 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
1872 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
1871 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
1872 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
1873 | 1873 | foreach ($dall as $value) { |
1874 | 1874 | $icao = $value['arrival_airport_icao']; |
1875 | 1875 | $ddate = $value['date']; |
@@ -1887,32 +1887,32 @@ discard block |
||
1887 | 1887 | } |
1888 | 1888 | $alldata = $pall; |
1889 | 1889 | foreach ($alldata as $number) { |
1890 | - $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); |
|
1890 | + $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); |
|
1891 | 1891 | } |
1892 | 1892 | |
1893 | 1893 | echo 'Flights data...'."\n"; |
1894 | 1894 | echo '-> countAllDatesLastMonth...'."\n"; |
1895 | 1895 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
1896 | 1896 | foreach ($alldata as $number) { |
1897 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
1897 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
1898 | 1898 | } |
1899 | 1899 | echo '-> countAllDates...'."\n"; |
1900 | - $previousdata = $this->countAllDates('',$filter_name); |
|
1901 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
1900 | + $previousdata = $this->countAllDates('', $filter_name); |
|
1901 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
1902 | 1902 | $values = array(); |
1903 | 1903 | foreach ($alldata as $cnt) { |
1904 | 1904 | $values[] = $cnt['date_count']; |
1905 | 1905 | } |
1906 | - array_multisort($values,SORT_DESC,$alldata); |
|
1907 | - array_splice($alldata,11); |
|
1906 | + array_multisort($values, SORT_DESC, $alldata); |
|
1907 | + array_splice($alldata, 11); |
|
1908 | 1908 | foreach ($alldata as $number) { |
1909 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
1909 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
1910 | 1910 | } |
1911 | 1911 | |
1912 | 1912 | echo '-> countAllHours...'."\n"; |
1913 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
1913 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
1914 | 1914 | foreach ($alldata as $number) { |
1915 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
1915 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
1916 | 1916 | } |
1917 | 1917 | } |
1918 | 1918 | |
@@ -1923,16 +1923,16 @@ discard block |
||
1923 | 1923 | // SUM all previous month to put as year |
1924 | 1924 | $previous_year = date('Y'); |
1925 | 1925 | $previous_year--; |
1926 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1927 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1928 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1929 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1926 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1927 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1928 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1929 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1930 | 1930 | $allairlines = $this->getAllAirlineNames(); |
1931 | 1931 | foreach ($allairlines as $data) { |
1932 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1933 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1934 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1935 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1932 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1933 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1934 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1935 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1936 | 1936 | } |
1937 | 1937 | |
1938 | 1938 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -1941,7 +1941,7 @@ discard block |
||
1941 | 1941 | try { |
1942 | 1942 | $sth = $this->db->prepare($query); |
1943 | 1943 | $sth->execute(); |
1944 | - } catch(PDOException $e) { |
|
1944 | + } catch (PDOException $e) { |
|
1945 | 1945 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
1946 | 1946 | } |
1947 | 1947 | } |
@@ -1950,7 +1950,7 @@ discard block |
||
1950 | 1950 | try { |
1951 | 1951 | $sth = $this->db->prepare($query); |
1952 | 1952 | $sth->execute(); |
1953 | - } catch(PDOException $e) { |
|
1953 | + } catch (PDOException $e) { |
|
1954 | 1954 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
1955 | 1955 | } |
1956 | 1956 | } |
@@ -1972,7 +1972,7 @@ discard block |
||
1972 | 1972 | try { |
1973 | 1973 | $sth = $this->db->prepare($query); |
1974 | 1974 | $sth->execute(); |
1975 | - } catch(PDOException $e) { |
|
1975 | + } catch (PDOException $e) { |
|
1976 | 1976 | return "error : ".$e->getMessage(); |
1977 | 1977 | } |
1978 | 1978 | } |
@@ -1986,13 +1986,13 @@ discard block |
||
1986 | 1986 | try { |
1987 | 1987 | $sth = $this->db->prepare($query); |
1988 | 1988 | $sth->execute(); |
1989 | - } catch(PDOException $e) { |
|
1989 | + } catch (PDOException $e) { |
|
1990 | 1990 | return "error : ".$e->getMessage(); |
1991 | 1991 | } |
1992 | 1992 | } |
1993 | 1993 | echo 'Insert last stats update date...'."\n"; |
1994 | 1994 | date_default_timezone_set('UTC'); |
1995 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
1995 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
1996 | 1996 | //} |
1997 | 1997 | } |
1998 | 1998 | } |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | public function __construct($dbc = null) { |
14 | 14 | global $globalFilterName; |
15 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
15 | + if (isset($globalFilterName)) { |
|
16 | + $this->filter_name = $globalFilterName; |
|
17 | + } |
|
16 | 18 | $Connection = new Connection($dbc); |
17 | 19 | $this->db = $Connection->db(); |
18 | 20 | } |
@@ -41,7 +43,9 @@ discard block |
||
41 | 43 | return $all; |
42 | 44 | } |
43 | 45 | public function getAllAirlineNames($filter_name = '') { |
44 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
46 | + if ($filter_name == '') { |
|
47 | + $filter_name = $this->filter_name; |
|
48 | + } |
|
45 | 49 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
46 | 50 | try { |
47 | 51 | $sth = $this->db->prepare($query); |
@@ -53,7 +57,9 @@ discard block |
||
53 | 57 | return $all; |
54 | 58 | } |
55 | 59 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
56 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
60 | + if ($filter_name == '') { |
|
61 | + $filter_name = $this->filter_name; |
|
62 | + } |
|
57 | 63 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
58 | 64 | try { |
59 | 65 | $sth = $this->db->prepare($query); |
@@ -65,7 +71,9 @@ discard block |
||
65 | 71 | return $all; |
66 | 72 | } |
67 | 73 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
68 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
74 | + if ($filter_name == '') { |
|
75 | + $filter_name = $this->filter_name; |
|
76 | + } |
|
69 | 77 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
70 | 78 | try { |
71 | 79 | $sth = $this->db->prepare($query); |
@@ -80,9 +88,14 @@ discard block |
||
80 | 88 | |
81 | 89 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') { |
82 | 90 | global $globalStatsFilters; |
83 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
84 | - if ($limit) $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 LIMIT 10 OFFSET 0"; |
|
85 | - 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"; |
|
91 | + if ($filter_name == '') { |
|
92 | + $filter_name = $this->filter_name; |
|
93 | + } |
|
94 | + if ($limit) { |
|
95 | + $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 LIMIT 10 OFFSET 0"; |
|
96 | + } else { |
|
97 | + $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 | + } |
|
86 | 99 | try { |
87 | 100 | $sth = $this->db->prepare($query); |
88 | 101 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -102,9 +115,14 @@ discard block |
||
102 | 115 | } |
103 | 116 | public function countAllAirlineCountries($limit = true,$filter_name = '') { |
104 | 117 | global $globalStatsFilters; |
105 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
106 | - 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"; |
|
107 | - else $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"; |
|
118 | + if ($filter_name == '') { |
|
119 | + $filter_name = $this->filter_name; |
|
120 | + } |
|
121 | + if ($limit) { |
|
122 | + $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"; |
|
123 | + } else { |
|
124 | + $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"; |
|
125 | + } |
|
108 | 126 | try { |
109 | 127 | $sth = $this->db->prepare($query); |
110 | 128 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -124,9 +142,14 @@ discard block |
||
124 | 142 | } |
125 | 143 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') { |
126 | 144 | global $globalStatsFilters; |
127 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
128 | - 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"; |
|
129 | - 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"; |
|
145 | + if ($filter_name == '') { |
|
146 | + $filter_name = $this->filter_name; |
|
147 | + } |
|
148 | + if ($limit) { |
|
149 | + $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"; |
|
150 | + } else { |
|
151 | + $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"; |
|
152 | + } |
|
130 | 153 | try { |
131 | 154 | $sth = $this->db->prepare($query); |
132 | 155 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -147,9 +170,14 @@ discard block |
||
147 | 170 | |
148 | 171 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') { |
149 | 172 | global $globalStatsFilters; |
150 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
151 | - if ($limit) $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 LIMIT 10 OFFSET 0"; |
|
152 | - 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"; |
|
173 | + if ($filter_name == '') { |
|
174 | + $filter_name = $this->filter_name; |
|
175 | + } |
|
176 | + if ($limit) { |
|
177 | + $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 LIMIT 10 OFFSET 0"; |
|
178 | + } else { |
|
179 | + $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"; |
|
180 | + } |
|
153 | 181 | try { |
154 | 182 | $sth = $this->db->prepare($query); |
155 | 183 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -169,9 +197,14 @@ discard block |
||
169 | 197 | } |
170 | 198 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') { |
171 | 199 | global $globalStatsFilters; |
172 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
173 | - if ($limit) $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 LIMIT 10 OFFSET 0"; |
|
174 | - 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"; |
|
200 | + if ($filter_name == '') { |
|
201 | + $filter_name = $this->filter_name; |
|
202 | + } |
|
203 | + if ($limit) { |
|
204 | + $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 LIMIT 10 OFFSET 0"; |
|
205 | + } else { |
|
206 | + $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"; |
|
207 | + } |
|
175 | 208 | try { |
176 | 209 | $sth = $this->db->prepare($query); |
177 | 210 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -192,9 +225,14 @@ discard block |
||
192 | 225 | |
193 | 226 | public function countAllAirlines($limit = true,$filter_name = '') { |
194 | 227 | global $globalStatsFilters; |
195 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
196 | - 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"; |
|
197 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
228 | + if ($filter_name == '') { |
|
229 | + $filter_name = $this->filter_name; |
|
230 | + } |
|
231 | + if ($limit) { |
|
232 | + $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"; |
|
233 | + } else { |
|
234 | + $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"; |
|
235 | + } |
|
198 | 236 | try { |
199 | 237 | $sth = $this->db->prepare($query); |
200 | 238 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -215,9 +253,14 @@ discard block |
||
215 | 253 | } |
216 | 254 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') { |
217 | 255 | global $globalStatsFilters; |
218 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
219 | - 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"; |
|
220 | - 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"; |
|
256 | + if ($filter_name == '') { |
|
257 | + $filter_name = $this->filter_name; |
|
258 | + } |
|
259 | + if ($limit) { |
|
260 | + $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"; |
|
261 | + } else { |
|
262 | + $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"; |
|
263 | + } |
|
221 | 264 | try { |
222 | 265 | $sth = $this->db->prepare($query); |
223 | 266 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -237,9 +280,14 @@ discard block |
||
237 | 280 | } |
238 | 281 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') { |
239 | 282 | global $globalStatsFilters; |
240 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
241 | - 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"; |
|
242 | - 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"; |
|
283 | + if ($filter_name == '') { |
|
284 | + $filter_name = $this->filter_name; |
|
285 | + } |
|
286 | + if ($limit) { |
|
287 | + $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"; |
|
288 | + } else { |
|
289 | + $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"; |
|
290 | + } |
|
243 | 291 | try { |
244 | 292 | $sth = $this->db->prepare($query); |
245 | 293 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -259,10 +307,15 @@ discard block |
||
259 | 307 | } |
260 | 308 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') { |
261 | 309 | $Connection = new Connection(); |
262 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
310 | + if ($filter_name == '') { |
|
311 | + $filter_name = $this->filter_name; |
|
312 | + } |
|
263 | 313 | if ($Connection->tableExists('countries')) { |
264 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
265 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
314 | + if ($limit) { |
|
315 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
316 | + } else { |
|
317 | + $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"; |
|
318 | + } |
|
266 | 319 | try { |
267 | 320 | $sth = $this->db->prepare($query); |
268 | 321 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -283,9 +336,14 @@ discard block |
||
283 | 336 | } |
284 | 337 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') { |
285 | 338 | global $globalStatsFilters; |
286 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
287 | - 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"; |
|
288 | - 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"; |
|
339 | + if ($filter_name == '') { |
|
340 | + $filter_name = $this->filter_name; |
|
341 | + } |
|
342 | + if ($limit) { |
|
343 | + $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"; |
|
344 | + } else { |
|
345 | + $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"; |
|
346 | + } |
|
289 | 347 | try { |
290 | 348 | $sth = $this->db->prepare($query); |
291 | 349 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -305,9 +363,14 @@ discard block |
||
305 | 363 | } |
306 | 364 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') { |
307 | 365 | global $globalStatsFilters; |
308 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
309 | - 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"; |
|
310 | - 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"; |
|
366 | + if ($filter_name == '') { |
|
367 | + $filter_name = $this->filter_name; |
|
368 | + } |
|
369 | + if ($limit) { |
|
370 | + $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"; |
|
371 | + } else { |
|
372 | + $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"; |
|
373 | + } |
|
311 | 374 | try { |
312 | 375 | $sth = $this->db->prepare($query); |
313 | 376 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -327,9 +390,14 @@ discard block |
||
327 | 390 | } |
328 | 391 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') { |
329 | 392 | global $globalStatsFilters; |
330 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
331 | - 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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
332 | - 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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
393 | + if ($filter_name == '') { |
|
394 | + $filter_name = $this->filter_name; |
|
395 | + } |
|
396 | + if ($limit) { |
|
397 | + $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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
398 | + } else { |
|
399 | + $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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
400 | + } |
|
333 | 401 | try { |
334 | 402 | $sth = $this->db->prepare($query); |
335 | 403 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -355,7 +423,9 @@ discard block |
||
355 | 423 | $icao = $value['airport_departure_icao']; |
356 | 424 | if (isset($all[$icao])) { |
357 | 425 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
358 | - } else $all[$icao] = $value; |
|
426 | + } else { |
|
427 | + $all[$icao] = $value; |
|
428 | + } |
|
359 | 429 | } |
360 | 430 | $count = array(); |
361 | 431 | foreach ($all as $key => $row) { |
@@ -367,9 +437,14 @@ discard block |
||
367 | 437 | } |
368 | 438 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') { |
369 | 439 | global $globalStatsFilters; |
370 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
371 | - 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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
372 | - 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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
440 | + if ($filter_name == '') { |
|
441 | + $filter_name = $this->filter_name; |
|
442 | + } |
|
443 | + if ($limit) { |
|
444 | + $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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
445 | + } else { |
|
446 | + $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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
447 | + } |
|
373 | 448 | try { |
374 | 449 | $sth = $this->db->prepare($query); |
375 | 450 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -395,7 +470,9 @@ discard block |
||
395 | 470 | $icao = $value['airport_arrival_icao']; |
396 | 471 | if (isset($all[$icao])) { |
397 | 472 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
398 | - } else $all[$icao] = $value; |
|
473 | + } else { |
|
474 | + $all[$icao] = $value; |
|
475 | + } |
|
399 | 476 | } |
400 | 477 | $count = array(); |
401 | 478 | foreach ($all as $key => $row) { |
@@ -408,13 +485,21 @@ discard block |
||
408 | 485 | } |
409 | 486 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
410 | 487 | global $globalDBdriver, $globalStatsFilters; |
411 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
488 | + if ($filter_name == '') { |
|
489 | + $filter_name = $this->filter_name; |
|
490 | + } |
|
412 | 491 | if ($globalDBdriver == 'mysql') { |
413 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
414 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
492 | + if ($limit) { |
|
493 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
494 | + } else { |
|
495 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
496 | + } |
|
415 | 497 | } else { |
416 | - 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"; |
|
417 | - 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"; |
|
498 | + if ($limit) { |
|
499 | + $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"; |
|
500 | + } else { |
|
501 | + $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"; |
|
502 | + } |
|
418 | 503 | } |
419 | 504 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
420 | 505 | try { |
@@ -438,7 +523,9 @@ discard block |
||
438 | 523 | |
439 | 524 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
440 | 525 | global $globalStatsFilters; |
441 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
526 | + if ($filter_name == '') { |
|
527 | + $filter_name = $this->filter_name; |
|
528 | + } |
|
442 | 529 | $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"; |
443 | 530 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
444 | 531 | try { |
@@ -460,7 +547,9 @@ discard block |
||
460 | 547 | } |
461 | 548 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
462 | 549 | global $globalDBdriver, $globalStatsFilters; |
463 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
550 | + if ($filter_name == '') { |
|
551 | + $filter_name = $this->filter_name; |
|
552 | + } |
|
464 | 553 | if ($globalDBdriver == 'mysql') { |
465 | 554 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
466 | 555 | } else { |
@@ -486,7 +575,9 @@ discard block |
||
486 | 575 | } |
487 | 576 | public function countAllDates($stats_airline = '',$filter_name = '') { |
488 | 577 | global $globalStatsFilters; |
489 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
578 | + if ($filter_name == '') { |
|
579 | + $filter_name = $this->filter_name; |
|
580 | + } |
|
490 | 581 | $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"; |
491 | 582 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
492 | 583 | try { |
@@ -508,7 +599,9 @@ discard block |
||
508 | 599 | } |
509 | 600 | public function countAllDatesByAirlines($filter_name = '') { |
510 | 601 | global $globalStatsFilters; |
511 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
602 | + if ($filter_name == '') { |
|
603 | + $filter_name = $this->filter_name; |
|
604 | + } |
|
512 | 605 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
513 | 606 | $query_data = array('filter_name' => $filter_name); |
514 | 607 | try { |
@@ -530,7 +623,9 @@ discard block |
||
530 | 623 | } |
531 | 624 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
532 | 625 | global $globalStatsFilters; |
533 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
626 | + if ($filter_name == '') { |
|
627 | + $filter_name = $this->filter_name; |
|
628 | + } |
|
534 | 629 | $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"; |
535 | 630 | try { |
536 | 631 | $sth = $this->db->prepare($query); |
@@ -551,7 +646,9 @@ discard block |
||
551 | 646 | } |
552 | 647 | public function countAllMilitaryMonths($filter_name = '') { |
553 | 648 | global $globalStatsFilters; |
554 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
649 | + if ($filter_name == '') { |
|
650 | + $filter_name = $this->filter_name; |
|
651 | + } |
|
555 | 652 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
556 | 653 | try { |
557 | 654 | $sth = $this->db->prepare($query); |
@@ -572,9 +669,14 @@ discard block |
||
572 | 669 | } |
573 | 670 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
574 | 671 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
575 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
576 | - 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"; |
|
577 | - else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
672 | + if ($filter_name == '') { |
|
673 | + $filter_name = $this->filter_name; |
|
674 | + } |
|
675 | + if ($limit) { |
|
676 | + $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"; |
|
677 | + } else { |
|
678 | + $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"; |
|
679 | + } |
|
578 | 680 | if ($orderby == 'hour') { |
579 | 681 | /* |
580 | 682 | if ($globalDBdriver == 'mysql') { |
@@ -583,7 +685,9 @@ discard block |
||
583 | 685 | */ |
584 | 686 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
585 | 687 | } |
586 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
688 | + if ($orderby == 'count') { |
|
689 | + $query .= " ORDER BY hour_count DESC"; |
|
690 | + } |
|
587 | 691 | try { |
588 | 692 | $sth = $this->db->prepare($query); |
589 | 693 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
@@ -604,7 +708,9 @@ discard block |
||
604 | 708 | |
605 | 709 | public function countOverallFlights($stats_airline = '', $filter_name = '') { |
606 | 710 | global $globalStatsFilters; |
607 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
711 | + if ($filter_name == '') { |
|
712 | + $filter_name = $this->filter_name; |
|
713 | + } |
|
608 | 714 | $all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name); |
609 | 715 | if (empty($all)) { |
610 | 716 | $filters = array('airlines' => array($stats_airline)); |
@@ -618,7 +724,9 @@ discard block |
||
618 | 724 | } |
619 | 725 | public function countOverallMilitaryFlights($filter_name = '') { |
620 | 726 | global $globalStatsFilters; |
621 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
727 | + if ($filter_name == '') { |
|
728 | + $filter_name = $this->filter_name; |
|
729 | + } |
|
622 | 730 | $all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name); |
623 | 731 | if (empty($all)) { |
624 | 732 | $filters = array(); |
@@ -632,7 +740,9 @@ discard block |
||
632 | 740 | } |
633 | 741 | public function countOverallArrival($stats_airline = '',$filter_name = '') { |
634 | 742 | global $globalStatsFilters; |
635 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
743 | + if ($filter_name == '') { |
|
744 | + $filter_name = $this->filter_name; |
|
745 | + } |
|
636 | 746 | $all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name); |
637 | 747 | if (empty($all)) { |
638 | 748 | $filters = array('airlines' => array($stats_airline)); |
@@ -646,7 +756,9 @@ discard block |
||
646 | 756 | } |
647 | 757 | public function countOverallAircrafts($stats_airline = '',$filter_name = '') { |
648 | 758 | global $globalStatsFilters; |
649 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
759 | + if ($filter_name == '') { |
|
760 | + $filter_name = $this->filter_name; |
|
761 | + } |
|
650 | 762 | $all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name); |
651 | 763 | if (empty($all)) { |
652 | 764 | $filters = array('airlines' => array($stats_airline)); |
@@ -660,7 +772,9 @@ discard block |
||
660 | 772 | } |
661 | 773 | public function countOverallAirlines($filter_name = '') { |
662 | 774 | global $globalStatsFilters; |
663 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
775 | + if ($filter_name == '') { |
|
776 | + $filter_name = $this->filter_name; |
|
777 | + } |
|
664 | 778 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
665 | 779 | try { |
666 | 780 | $sth = $this->db->prepare($query); |
@@ -683,7 +797,9 @@ discard block |
||
683 | 797 | } |
684 | 798 | public function countOverallOwners($stats_airline = '',$filter_name = '') { |
685 | 799 | global $globalStatsFilters; |
686 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
800 | + if ($filter_name == '') { |
|
801 | + $filter_name = $this->filter_name; |
|
802 | + } |
|
687 | 803 | /* |
688 | 804 | $query = "SELECT COUNT(*) AS nb_owner FROM stats_owner"; |
689 | 805 | try { |
@@ -708,7 +824,9 @@ discard block |
||
708 | 824 | } |
709 | 825 | public function countOverallPilots($stats_airline = '',$filter_name = '') { |
710 | 826 | global $globalStatsFilters; |
711 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
827 | + if ($filter_name == '') { |
|
828 | + $filter_name = $this->filter_name; |
|
829 | + } |
|
712 | 830 | $all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name); |
713 | 831 | if (empty($all)) { |
714 | 832 | $filters = array('airlines' => array($stats_airline)); |
@@ -722,7 +840,9 @@ discard block |
||
722 | 840 | } |
723 | 841 | |
724 | 842 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
725 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
843 | + if ($filter_name == '') { |
|
844 | + $filter_name = $this->filter_name; |
|
845 | + } |
|
726 | 846 | $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"; |
727 | 847 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
728 | 848 | try { |
@@ -735,7 +855,9 @@ discard block |
||
735 | 855 | return $all; |
736 | 856 | } |
737 | 857 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
738 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
858 | + if ($filter_name == '') { |
|
859 | + $filter_name = $this->filter_name; |
|
860 | + } |
|
739 | 861 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
740 | 862 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
741 | 863 | try { |
@@ -748,7 +870,9 @@ discard block |
||
748 | 870 | return $all; |
749 | 871 | } |
750 | 872 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') { |
751 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
873 | + if ($filter_name == '') { |
|
874 | + $filter_name = $this->filter_name; |
|
875 | + } |
|
752 | 876 | global $globalArchiveMonths, $globalDBdriver; |
753 | 877 | if ($globalDBdriver == 'mysql') { |
754 | 878 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -767,7 +891,9 @@ discard block |
||
767 | 891 | } |
768 | 892 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
769 | 893 | global $globalArchiveMonths, $globalDBdriver; |
770 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
894 | + if ($filter_name == '') { |
|
895 | + $filter_name = $this->filter_name; |
|
896 | + } |
|
771 | 897 | if ($globalDBdriver == 'mysql') { |
772 | 898 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
773 | 899 | } else { |
@@ -785,7 +911,9 @@ discard block |
||
785 | 911 | } |
786 | 912 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
787 | 913 | global $globalArchiveMonths, $globalDBdriver; |
788 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
914 | + if ($filter_name == '') { |
|
915 | + $filter_name = $this->filter_name; |
|
916 | + } |
|
789 | 917 | if ($globalDBdriver == 'mysql') { |
790 | 918 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
791 | 919 | } else { |
@@ -802,7 +930,9 @@ discard block |
||
802 | 930 | } |
803 | 931 | public function getStatsAirlineTotal($filter_name = '') { |
804 | 932 | global $globalArchiveMonths, $globalDBdriver; |
805 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
933 | + if ($filter_name == '') { |
|
934 | + $filter_name = $this->filter_name; |
|
935 | + } |
|
806 | 936 | if ($globalDBdriver == 'mysql') { |
807 | 937 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
808 | 938 | } else { |
@@ -819,7 +949,9 @@ discard block |
||
819 | 949 | } |
820 | 950 | public function getStatsOwnerTotal($filter_name = '') { |
821 | 951 | global $globalArchiveMonths, $globalDBdriver; |
822 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
952 | + if ($filter_name == '') { |
|
953 | + $filter_name = $this->filter_name; |
|
954 | + } |
|
823 | 955 | if ($globalDBdriver == 'mysql') { |
824 | 956 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
825 | 957 | } else { |
@@ -836,7 +968,9 @@ discard block |
||
836 | 968 | } |
837 | 969 | public function getStatsPilotTotal($filter_name = '') { |
838 | 970 | global $globalArchiveMonths, $globalDBdriver; |
839 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
971 | + if ($filter_name == '') { |
|
972 | + $filter_name = $this->filter_name; |
|
973 | + } |
|
840 | 974 | if ($globalDBdriver == 'mysql') { |
841 | 975 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
842 | 976 | } else { |
@@ -854,7 +988,9 @@ discard block |
||
854 | 988 | |
855 | 989 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
856 | 990 | global $globalDBdriver; |
857 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
991 | + if ($filter_name == '') { |
|
992 | + $filter_name = $this->filter_name; |
|
993 | + } |
|
858 | 994 | if ($globalDBdriver == 'mysql') { |
859 | 995 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
860 | 996 | } else { |
@@ -870,7 +1006,9 @@ discard block |
||
870 | 1006 | } |
871 | 1007 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
872 | 1008 | global $globalDBdriver; |
873 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1009 | + if ($filter_name == '') { |
|
1010 | + $filter_name = $this->filter_name; |
|
1011 | + } |
|
874 | 1012 | if ($globalDBdriver == 'mysql') { |
875 | 1013 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
876 | 1014 | } else { |
@@ -1356,7 +1494,9 @@ discard block |
||
1356 | 1494 | echo 'Update stats !'."\n"; |
1357 | 1495 | if (isset($last_update[0]['value'])) { |
1358 | 1496 | $last_update_day = $last_update[0]['value']; |
1359 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
1497 | + } else { |
|
1498 | + $last_update_day = '2012-12-12 12:12:12'; |
|
1499 | + } |
|
1360 | 1500 | $Spotter = new Spotter($this->db); |
1361 | 1501 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
1362 | 1502 | foreach ($alldata as $number) { |
@@ -1395,7 +1535,9 @@ discard block |
||
1395 | 1535 | $icao = $value['airport_departure_icao']; |
1396 | 1536 | if (isset($alldata[$icao])) { |
1397 | 1537 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
1398 | - } else $alldata[$icao] = $value; |
|
1538 | + } else { |
|
1539 | + $alldata[$icao] = $value; |
|
1540 | + } |
|
1399 | 1541 | } |
1400 | 1542 | $count = array(); |
1401 | 1543 | foreach ($alldata as $key => $row) { |
@@ -1416,7 +1558,9 @@ discard block |
||
1416 | 1558 | $icao = $value['airport_arrival_icao']; |
1417 | 1559 | if (isset($alldata[$icao])) { |
1418 | 1560 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
1419 | - } else $alldata[$icao] = $value; |
|
1561 | + } else { |
|
1562 | + $alldata[$icao] = $value; |
|
1563 | + } |
|
1420 | 1564 | } |
1421 | 1565 | $count = array(); |
1422 | 1566 | foreach ($alldata as $key => $row) { |
@@ -1442,7 +1586,9 @@ discard block |
||
1442 | 1586 | $alldata = $Spotter->countAllMonths(); |
1443 | 1587 | $lastyear = false; |
1444 | 1588 | foreach ($alldata as $number) { |
1445 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
1589 | + if ($number['year_name'] != date('Y')) { |
|
1590 | + $lastyear = true; |
|
1591 | + } |
|
1446 | 1592 | $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']))); |
1447 | 1593 | } |
1448 | 1594 | $alldata = $Spotter->countAllMilitaryMonths(); |
@@ -1660,7 +1806,9 @@ discard block |
||
1660 | 1806 | $alldata = $Spotter->countAllMonthsByAirlines(); |
1661 | 1807 | $lastyear = false; |
1662 | 1808 | foreach ($alldata as $number) { |
1663 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
1809 | + if ($number['year_name'] != date('Y')) { |
|
1810 | + $lastyear = true; |
|
1811 | + } |
|
1664 | 1812 | $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']); |
1665 | 1813 | } |
1666 | 1814 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
@@ -1752,7 +1900,9 @@ discard block |
||
1752 | 1900 | } |
1753 | 1901 | |
1754 | 1902 | |
1755 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
1903 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
1904 | + $globalStatsFilters = array(); |
|
1905 | + } |
|
1756 | 1906 | foreach ($globalStatsFilters as $name => $filter) { |
1757 | 1907 | //$filter_name = $filter['name']; |
1758 | 1908 | $filter_name = $name; |
@@ -1791,7 +1941,9 @@ discard block |
||
1791 | 1941 | $icao = $value['airport_departure_icao']; |
1792 | 1942 | if (isset($alldata[$icao])) { |
1793 | 1943 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
1794 | - } else $alldata[$icao] = $value; |
|
1944 | + } else { |
|
1945 | + $alldata[$icao] = $value; |
|
1946 | + } |
|
1795 | 1947 | } |
1796 | 1948 | $count = array(); |
1797 | 1949 | foreach ($alldata as $key => $row) { |
@@ -1812,7 +1964,9 @@ discard block |
||
1812 | 1964 | $icao = $value['airport_arrival_icao']; |
1813 | 1965 | if (isset($alldata[$icao])) { |
1814 | 1966 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
1815 | - } else $alldata[$icao] = $value; |
|
1967 | + } else { |
|
1968 | + $alldata[$icao] = $value; |
|
1969 | + } |
|
1816 | 1970 | } |
1817 | 1971 | $count = array(); |
1818 | 1972 | foreach ($alldata as $key => $row) { |
@@ -1826,7 +1980,9 @@ discard block |
||
1826 | 1980 | $alldata = $Spotter->countAllMonths($filter); |
1827 | 1981 | $lastyear = false; |
1828 | 1982 | foreach ($alldata as $number) { |
1829 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
1983 | + if ($number['year_name'] != date('Y')) { |
|
1984 | + $lastyear = true; |
|
1985 | + } |
|
1830 | 1986 | $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); |
1831 | 1987 | } |
1832 | 1988 | $alldata = $Spotter->countAllMonthsOwners($filter); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
5 | 5 | $global_query = "SELECT spotter_output.* FROM spotter_output"; |
6 | 6 | |
7 | -class Spotter{ |
|
7 | +class Spotter { |
|
8 | 8 | public $db; |
9 | 9 | |
10 | 10 | public function __construct($dbc = null) { |
@@ -17,15 +17,15 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
22 | - if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
|
23 | - if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter); |
|
22 | + if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName], $filter); |
|
23 | + if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter); |
|
24 | 24 | $filter_query_join = ''; |
25 | 25 | $filter_query_where = ''; |
26 | 26 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
27 | 27 | if ($filter['airlines'][0] != '') { |
28 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
28 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id "; |
34 | 34 | } |
35 | 35 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
36 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
36 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
37 | 37 | } |
38 | 38 | if (isset($filter['source']) && !empty($filter['source'])) { |
39 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
39 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
40 | 40 | } |
41 | 41 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
42 | 42 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
43 | 43 | } |
44 | 44 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
45 | 45 | if ($filter_query_where == '') { |
46 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
46 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
47 | 47 | } else { |
48 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
48 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $sth = $this->db->prepare($query.$limitQuery); |
94 | 94 | $sth->execute($params); |
95 | 95 | } catch (PDOException $e) { |
96 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
96 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
97 | 97 | exit(); |
98 | 98 | } |
99 | 99 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $spotter_array = array(); |
104 | 104 | |
105 | 105 | |
106 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
106 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
107 | 107 | { |
108 | 108 | $num_rows++; |
109 | 109 | $temp_array = array(); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if (isset($row['route_stop'])) { |
149 | 149 | $temp_array['route_stop'] = $row['route_stop']; |
150 | 150 | if ($row['route_stop'] != '') { |
151 | - $allroute = explode(' ',$row['route_stop']); |
|
151 | + $allroute = explode(' ', $row['route_stop']); |
|
152 | 152 | |
153 | 153 | foreach ($allroute as $route) { |
154 | 154 | $route_airport_array = $this->getAllAirportInfo($route); |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | { |
204 | 204 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
205 | 205 | } else { |
206 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
206 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
207 | 207 | } |
208 | 208 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
209 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
210 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
209 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
210 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
211 | 211 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
212 | 212 | } |
213 | 213 | |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
242 | 242 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
243 | 243 | if (is_numeric(substr($row['ident'], 2, 1))) { |
244 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource); |
|
244 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource); |
|
245 | 245 | } elseif (is_numeric(substr($row['ident'], 3, 1))) { |
246 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
246 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
247 | 247 | } else { |
248 | 248 | $airline_array = $this->getAllAirlineInfo('NA'); |
249 | 249 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $temp_array['airline_type'] = $row['airline_type']; |
270 | 270 | } |
271 | 271 | if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') { |
272 | - $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3)); |
|
272 | + $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3)); |
|
273 | 273 | //$acars_array = ACARS->getLiveAcarsData('BA40YL'); |
274 | 274 | if (count($acars_array) > 0) { |
275 | 275 | $temp_array['acars'] = $acars_array; |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
287 | 287 | } |
288 | 288 | |
289 | - if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
289 | + if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
290 | 290 | { |
291 | 291 | if ($globalIVAO) { |
292 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
293 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
292 | + if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']); |
|
293 | + else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']); |
|
294 | 294 | } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
295 | 295 | if (count($image_array) > 0) { |
296 | 296 | $temp_array['image'] = $image_array[0]['image']; |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | if (isset($row['arrival_airport_time']) && $row['arrival_airport_time'] != '') { |
314 | 314 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
315 | 315 | } |
316 | - if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
316 | + if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
317 | 317 | $schedule_array = $Schedule->getSchedule($temp_array['ident']); |
318 | 318 | //print_r($schedule_array); |
319 | 319 | if (count($schedule_array) > 0) { |
@@ -394,12 +394,12 @@ discard block |
||
394 | 394 | if (isset($row['squawk'])) { |
395 | 395 | $temp_array['squawk'] = $row['squawk']; |
396 | 396 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
397 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
|
398 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
397 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']); |
|
398 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
399 | 399 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
400 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
|
401 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
402 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
400 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']); |
|
401 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
402 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | $temp_array['query_number_rows'] = $num_rows; |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * @return Array the spotter information |
419 | 419 | * |
420 | 420 | */ |
421 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filter = array()) |
|
421 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filter = array()) |
|
422 | 422 | { |
423 | 423 | global $globalTimezone, $globalDBdriver; |
424 | 424 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | |
429 | 429 | $query_values = array(); |
430 | 430 | $additional_query = ''; |
431 | - $filter_query = $this->getFilter($filter,true,true); |
|
431 | + $filter_query = $this->getFilter($filter, true, true); |
|
432 | 432 | if ($q != "") |
433 | 433 | { |
434 | 434 | if (!is_string($q)) |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | return false; |
437 | 437 | } else { |
438 | 438 | $q_array = explode(" ", $q); |
439 | - foreach ($q_array as $q_item){ |
|
440 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
439 | + foreach ($q_array as $q_item) { |
|
440 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
441 | 441 | $additional_query .= " AND ("; |
442 | 442 | if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
443 | 443 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -469,37 +469,37 @@ discard block |
||
469 | 469 | |
470 | 470 | if ($registration != "") |
471 | 471 | { |
472 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
472 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
473 | 473 | if (!is_string($registration)) |
474 | 474 | { |
475 | 475 | return false; |
476 | 476 | } else { |
477 | 477 | $additional_query .= " AND spotter_output.registration = :registration"; |
478 | - $query_values = array_merge($query_values,array(':registration' => $registration)); |
|
478 | + $query_values = array_merge($query_values, array(':registration' => $registration)); |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | |
482 | 482 | if ($aircraft_icao != "") |
483 | 483 | { |
484 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
484 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
485 | 485 | if (!is_string($aircraft_icao)) |
486 | 486 | { |
487 | 487 | return false; |
488 | 488 | } else { |
489 | 489 | $additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao"; |
490 | - $query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao)); |
|
490 | + $query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao)); |
|
491 | 491 | } |
492 | 492 | } |
493 | 493 | |
494 | 494 | if ($aircraft_manufacturer != "") |
495 | 495 | { |
496 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
496 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
497 | 497 | if (!is_string($aircraft_manufacturer)) |
498 | 498 | { |
499 | 499 | return false; |
500 | 500 | } else { |
501 | 501 | $additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer"; |
502 | - $query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
502 | + $query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
503 | 503 | } |
504 | 504 | } |
505 | 505 | |
@@ -515,25 +515,25 @@ discard block |
||
515 | 515 | |
516 | 516 | if ($airline_icao != "") |
517 | 517 | { |
518 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
518 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
519 | 519 | if (!is_string($airline_icao)) |
520 | 520 | { |
521 | 521 | return false; |
522 | 522 | } else { |
523 | 523 | $additional_query .= " AND spotter_output.airline_icao = :airline_icao"; |
524 | - $query_values = array_merge($query_values,array(':airline_icao' => $airline_icao)); |
|
524 | + $query_values = array_merge($query_values, array(':airline_icao' => $airline_icao)); |
|
525 | 525 | } |
526 | 526 | } |
527 | 527 | |
528 | 528 | if ($airline_country != "") |
529 | 529 | { |
530 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
530 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
531 | 531 | if (!is_string($airline_country)) |
532 | 532 | { |
533 | 533 | return false; |
534 | 534 | } else { |
535 | 535 | $additional_query .= " AND spotter_output.airline_country = :airline_country"; |
536 | - $query_values = array_merge($query_values,array(':airline_country' => $airline_country)); |
|
536 | + $query_values = array_merge($query_values, array(':airline_country' => $airline_country)); |
|
537 | 537 | } |
538 | 538 | } |
539 | 539 | |
@@ -560,31 +560,31 @@ discard block |
||
560 | 560 | |
561 | 561 | if ($airport != "") |
562 | 562 | { |
563 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
563 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
564 | 564 | if (!is_string($airport)) |
565 | 565 | { |
566 | 566 | return false; |
567 | 567 | } else { |
568 | 568 | $additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)"; |
569 | - $query_values = array_merge($query_values,array(':airport' => $airport)); |
|
569 | + $query_values = array_merge($query_values, array(':airport' => $airport)); |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
573 | 573 | if ($airport_country != "") |
574 | 574 | { |
575 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
575 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
576 | 576 | if (!is_string($airport_country)) |
577 | 577 | { |
578 | 578 | return false; |
579 | 579 | } else { |
580 | 580 | $additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)"; |
581 | - $query_values = array_merge($query_values,array(':airport_country' => $airport_country)); |
|
581 | + $query_values = array_merge($query_values, array(':airport_country' => $airport_country)); |
|
582 | 582 | } |
583 | 583 | } |
584 | 584 | |
585 | 585 | if ($callsign != "") |
586 | 586 | { |
587 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
587 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
588 | 588 | if (!is_string($callsign)) |
589 | 589 | { |
590 | 590 | return false; |
@@ -592,79 +592,79 @@ discard block |
||
592 | 592 | $translate = $Translation->ident2icao($callsign); |
593 | 593 | if ($translate != $callsign) { |
594 | 594 | $additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)"; |
595 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
595 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
596 | 596 | } else { |
597 | 597 | $additional_query .= " AND spotter_output.ident = :callsign"; |
598 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
598 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
599 | 599 | } |
600 | 600 | } |
601 | 601 | } |
602 | 602 | |
603 | 603 | if ($owner != "") |
604 | 604 | { |
605 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
605 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
606 | 606 | if (!is_string($owner)) |
607 | 607 | { |
608 | 608 | return false; |
609 | 609 | } else { |
610 | 610 | $additional_query .= " AND spotter_output.owner_name = :owner"; |
611 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
611 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | |
615 | 615 | if ($pilot_name != "") |
616 | 616 | { |
617 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
617 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
618 | 618 | if (!is_string($pilot_name)) |
619 | 619 | { |
620 | 620 | return false; |
621 | 621 | } else { |
622 | 622 | $additional_query .= " AND spotter_output.pilot_name = :pilot_name"; |
623 | - $query_values = array_merge($query_values,array(':pilot_name' => $pilot_name)); |
|
623 | + $query_values = array_merge($query_values, array(':pilot_name' => $pilot_name)); |
|
624 | 624 | } |
625 | 625 | } |
626 | 626 | |
627 | 627 | if ($pilot_id != "") |
628 | 628 | { |
629 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
629 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
630 | 630 | if (!is_string($pilot_id)) |
631 | 631 | { |
632 | 632 | return false; |
633 | 633 | } else { |
634 | 634 | $additional_query .= " AND spotter_output.pilot_id = :pilot_id"; |
635 | - $query_values = array_merge($query_values,array(':pilot_id' => $pilot_id)); |
|
635 | + $query_values = array_merge($query_values, array(':pilot_id' => $pilot_id)); |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | |
639 | 639 | if ($departure_airport_route != "") |
640 | 640 | { |
641 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
641 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
642 | 642 | if (!is_string($departure_airport_route)) |
643 | 643 | { |
644 | 644 | return false; |
645 | 645 | } else { |
646 | 646 | $additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route"; |
647 | - $query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route)); |
|
647 | + $query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route)); |
|
648 | 648 | } |
649 | 649 | } |
650 | 650 | |
651 | 651 | if ($arrival_airport_route != "") |
652 | 652 | { |
653 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
653 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
654 | 654 | if (!is_string($arrival_airport_route)) |
655 | 655 | { |
656 | 656 | return false; |
657 | 657 | } else { |
658 | 658 | $additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route"; |
659 | - $query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route)); |
|
659 | + $query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route)); |
|
660 | 660 | } |
661 | 661 | } |
662 | 662 | |
663 | 663 | if ($altitude != "") |
664 | 664 | { |
665 | 665 | $altitude_array = explode(",", $altitude); |
666 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
667 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
666 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
667 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
668 | 668 | |
669 | 669 | if ($altitude_array[1] != "") |
670 | 670 | { |
@@ -680,8 +680,8 @@ discard block |
||
680 | 680 | if ($date_posted != "") |
681 | 681 | { |
682 | 682 | $date_array = explode(",", $date_posted); |
683 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
684 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
683 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
684 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
685 | 685 | |
686 | 686 | if ($globalTimezone != '') { |
687 | 687 | date_default_timezone_set($globalTimezone); |
@@ -712,8 +712,8 @@ discard block |
||
712 | 712 | { |
713 | 713 | $limit_array = explode(",", $limit); |
714 | 714 | |
715 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
716 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
715 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
716 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
717 | 717 | |
718 | 718 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
719 | 719 | { |
@@ -742,23 +742,23 @@ discard block |
||
742 | 742 | |
743 | 743 | |
744 | 744 | if ($origLat != "" && $origLon != "" && $dist != "") { |
745 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
745 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
746 | 746 | |
747 | 747 | if ($globalDBdriver == 'mysql') { |
748 | - $query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
748 | + $query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
749 | 749 | FROM spotter_output, spotter_archive".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
750 | 750 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
751 | 751 | } else { |
752 | - $query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
752 | + $query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
753 | 753 | FROM spotter_output, spotter_archive".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
754 | 754 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
755 | 755 | } |
756 | 756 | } else { |
757 | - $query = "SELECT spotter_output.* FROM spotter_output ".$filter_query." spotter_output.ident <> '' |
|
757 | + $query = "SELECT spotter_output.* FROM spotter_output ".$filter_query." spotter_output.ident <> '' |
|
758 | 758 | ".$additional_query." |
759 | 759 | ".$orderby_query; |
760 | 760 | } |
761 | - $spotter_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
761 | + $spotter_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
762 | 762 | return $spotter_array; |
763 | 763 | } |
764 | 764 | |
@@ -781,8 +781,8 @@ discard block |
||
781 | 781 | { |
782 | 782 | $limit_array = explode(",", $limit); |
783 | 783 | |
784 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
785 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
784 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
785 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
786 | 786 | |
787 | 787 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
788 | 788 | { |
@@ -799,9 +799,9 @@ discard block |
||
799 | 799 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
800 | 800 | } |
801 | 801 | |
802 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
802 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
803 | 803 | |
804 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query); |
|
804 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
|
805 | 805 | |
806 | 806 | return $spotter_array; |
807 | 807 | } |
@@ -847,34 +847,34 @@ discard block |
||
847 | 847 | { |
848 | 848 | return false; |
849 | 849 | } else { |
850 | - if ($interval == "30m"){ |
|
850 | + if ($interval == "30m") { |
|
851 | 851 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date '; |
852 | - } else if ($interval == "1h"){ |
|
852 | + } else if ($interval == "1h") { |
|
853 | 853 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date '; |
854 | - } else if ($interval == "3h"){ |
|
854 | + } else if ($interval == "3h") { |
|
855 | 855 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date '; |
856 | - } else if ($interval == "6h"){ |
|
856 | + } else if ($interval == "6h") { |
|
857 | 857 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date '; |
858 | - } else if ($interval == "12h"){ |
|
858 | + } else if ($interval == "12h") { |
|
859 | 859 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date '; |
860 | - } else if ($interval == "24h"){ |
|
860 | + } else if ($interval == "24h") { |
|
861 | 861 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date '; |
862 | - } else if ($interval == "7d"){ |
|
862 | + } else if ($interval == "7d") { |
|
863 | 863 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date '; |
864 | - } else if ($interval == "30d"){ |
|
864 | + } else if ($interval == "30d") { |
|
865 | 865 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date '; |
866 | 866 | } |
867 | 867 | } |
868 | 868 | } |
869 | 869 | |
870 | - $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
870 | + $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
871 | 871 | WHERE spotter_output.latitude <> '' |
872 | 872 | AND spotter_output.longitude <> '' |
873 | 873 | ".$additional_query." |
874 | 874 | HAVING distance < :radius |
875 | 875 | ORDER BY distance"; |
876 | 876 | |
877 | - $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query); |
|
877 | + $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query); |
|
878 | 878 | |
879 | 879 | return $spotter_array; |
880 | 880 | } |
@@ -886,21 +886,21 @@ discard block |
||
886 | 886 | * @return Array the spotter information |
887 | 887 | * |
888 | 888 | */ |
889 | - public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
|
889 | + public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array()) |
|
890 | 890 | { |
891 | 891 | global $global_query; |
892 | 892 | |
893 | 893 | date_default_timezone_set('UTC'); |
894 | 894 | |
895 | - $filter_query = $this->getFilter($filter,true,true); |
|
895 | + $filter_query = $this->getFilter($filter, true, true); |
|
896 | 896 | |
897 | 897 | $limit_query = ''; |
898 | 898 | if ($limit != "") |
899 | 899 | { |
900 | 900 | $limit_array = explode(",", $limit); |
901 | 901 | |
902 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
903 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
902 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
903 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
904 | 904 | |
905 | 905 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
906 | 906 | { |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
918 | 918 | } |
919 | 919 | |
920 | - $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
920 | + $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
921 | 921 | |
922 | 922 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
923 | 923 | |
@@ -936,15 +936,15 @@ discard block |
||
936 | 936 | global $global_query; |
937 | 937 | |
938 | 938 | date_default_timezone_set('UTC'); |
939 | - $filter_query = $this->getFilter($filter,true,true); |
|
939 | + $filter_query = $this->getFilter($filter, true, true); |
|
940 | 940 | |
941 | 941 | $limit_query = ''; |
942 | 942 | if ($limit != "") |
943 | 943 | { |
944 | 944 | $limit_array = explode(",", $limit); |
945 | 945 | |
946 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
947 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
946 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
947 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
948 | 948 | |
949 | 949 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
950 | 950 | { |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
962 | 962 | } |
963 | 963 | |
964 | - $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
964 | + $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
965 | 965 | |
966 | 966 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
967 | 967 | |
@@ -975,20 +975,20 @@ discard block |
||
975 | 975 | * @return Array the spotter information |
976 | 976 | * |
977 | 977 | */ |
978 | - public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
|
978 | + public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array()) |
|
979 | 979 | { |
980 | 980 | global $global_query; |
981 | 981 | |
982 | 982 | date_default_timezone_set('UTC'); |
983 | - $filter_query = $this->getFilter($filter,true,true); |
|
983 | + $filter_query = $this->getFilter($filter, true, true); |
|
984 | 984 | |
985 | 985 | $limit_query = ''; |
986 | 986 | if ($limit != "") |
987 | 987 | { |
988 | 988 | $limit_array = explode(",", $limit); |
989 | 989 | |
990 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
991 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
990 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
991 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
992 | 992 | |
993 | 993 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
994 | 994 | { |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
1006 | 1006 | } |
1007 | 1007 | |
1008 | - $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1008 | + $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1009 | 1009 | |
1010 | 1010 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1011 | 1011 | |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | |
1026 | 1026 | date_default_timezone_set('UTC'); |
1027 | 1027 | |
1028 | - $filter_query = $this->getFilter($filter,true,true); |
|
1028 | + $filter_query = $this->getFilter($filter, true, true); |
|
1029 | 1029 | |
1030 | 1030 | $limit_query = ''; |
1031 | 1031 | |
@@ -1033,8 +1033,8 @@ discard block |
||
1033 | 1033 | { |
1034 | 1034 | $limit_array = explode(",", $limit); |
1035 | 1035 | |
1036 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1037 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1036 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1037 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1038 | 1038 | |
1039 | 1039 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1040 | 1040 | { |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
1052 | 1052 | } |
1053 | 1053 | |
1054 | - $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1054 | + $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1055 | 1055 | |
1056 | 1056 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1057 | 1057 | |
@@ -1070,14 +1070,14 @@ discard block |
||
1070 | 1070 | global $global_query; |
1071 | 1071 | |
1072 | 1072 | date_default_timezone_set('UTC'); |
1073 | - $filter_query = $this->getFilter($filter,true,true); |
|
1073 | + $filter_query = $this->getFilter($filter, true, true); |
|
1074 | 1074 | $limit_query = ''; |
1075 | 1075 | if ($limit != "") |
1076 | 1076 | { |
1077 | 1077 | $limit_array = explode(",", $limit); |
1078 | 1078 | |
1079 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1080 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1079 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1080 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1081 | 1081 | |
1082 | 1082 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1083 | 1083 | { |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
1095 | 1095 | } |
1096 | 1096 | |
1097 | - $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1097 | + $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1098 | 1098 | |
1099 | 1099 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1100 | 1100 | |
@@ -1118,9 +1118,9 @@ discard block |
||
1118 | 1118 | $query_values = array(':id' => $id); |
1119 | 1119 | |
1120 | 1120 | //$query = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." "; |
1121 | - $query = $global_query." WHERE ".$additional_query." "; |
|
1121 | + $query = $global_query." WHERE ".$additional_query." "; |
|
1122 | 1122 | |
1123 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
1123 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
1124 | 1124 | |
1125 | 1125 | return $spotter_array; |
1126 | 1126 | } |
@@ -1158,8 +1158,8 @@ discard block |
||
1158 | 1158 | { |
1159 | 1159 | $limit_array = explode(",", $limit); |
1160 | 1160 | |
1161 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1162 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1161 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1162 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1163 | 1163 | |
1164 | 1164 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1165 | 1165 | { |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | $query_values = array(); |
1201 | 1201 | $limit_query = ''; |
1202 | 1202 | $additional_query = ''; |
1203 | - $filter_query = $this->getFilter($filter,true,true); |
|
1203 | + $filter_query = $this->getFilter($filter, true, true); |
|
1204 | 1204 | |
1205 | 1205 | if ($aircraft_type != "") |
1206 | 1206 | { |
@@ -1217,8 +1217,8 @@ discard block |
||
1217 | 1217 | { |
1218 | 1218 | $limit_array = explode(",", $limit); |
1219 | 1219 | |
1220 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1221 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1220 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1221 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1222 | 1222 | |
1223 | 1223 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1224 | 1224 | { |
@@ -1258,7 +1258,7 @@ discard block |
||
1258 | 1258 | $query_values = array(); |
1259 | 1259 | $limit_query = ''; |
1260 | 1260 | $additional_query = ''; |
1261 | - $filter_query = $this->getFilter($filter,true,true); |
|
1261 | + $filter_query = $this->getFilter($filter, true, true); |
|
1262 | 1262 | |
1263 | 1263 | if ($registration != "") |
1264 | 1264 | { |
@@ -1275,8 +1275,8 @@ discard block |
||
1275 | 1275 | { |
1276 | 1276 | $limit_array = explode(",", $limit); |
1277 | 1277 | |
1278 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1279 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1278 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1279 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1280 | 1280 | |
1281 | 1281 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1282 | 1282 | { |
@@ -1334,8 +1334,8 @@ discard block |
||
1334 | 1334 | { |
1335 | 1335 | $limit_array = explode(",", $limit); |
1336 | 1336 | |
1337 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1338 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1337 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1338 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1339 | 1339 | |
1340 | 1340 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1341 | 1341 | { |
@@ -1389,8 +1389,8 @@ discard block |
||
1389 | 1389 | { |
1390 | 1390 | $limit_array = explode(",", $limit); |
1391 | 1391 | |
1392 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1393 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1392 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1393 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1394 | 1394 | |
1395 | 1395 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1396 | 1396 | { |
@@ -1422,7 +1422,7 @@ discard block |
||
1422 | 1422 | * @return Array the spotter information |
1423 | 1423 | * |
1424 | 1424 | */ |
1425 | - public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
1425 | + public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
1426 | 1426 | { |
1427 | 1427 | global $global_query, $globalTimezone, $globalDBdriver; |
1428 | 1428 | |
@@ -1432,19 +1432,19 @@ discard block |
||
1432 | 1432 | |
1433 | 1433 | $filter_query = ''; |
1434 | 1434 | if (isset($filter['source']) && !empty($filter['source'])) { |
1435 | - $filter_query = " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
1435 | + $filter_query = " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
1436 | 1436 | } |
1437 | 1437 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
1438 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
1438 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
1439 | 1439 | } |
1440 | 1440 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
1441 | 1441 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
1442 | 1442 | } |
1443 | 1443 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
1444 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
1444 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
1445 | 1445 | } |
1446 | 1446 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
1447 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
1447 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
1448 | 1448 | } |
1449 | 1449 | |
1450 | 1450 | |
@@ -1472,8 +1472,8 @@ discard block |
||
1472 | 1472 | { |
1473 | 1473 | $limit_array = explode(",", $limit); |
1474 | 1474 | |
1475 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1476 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1475 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1476 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1477 | 1477 | |
1478 | 1478 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1479 | 1479 | { |
@@ -1528,8 +1528,8 @@ discard block |
||
1528 | 1528 | { |
1529 | 1529 | $limit_array = explode(",", $limit); |
1530 | 1530 | |
1531 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1532 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1531 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1532 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1533 | 1533 | |
1534 | 1534 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1535 | 1535 | { |
@@ -1585,8 +1585,8 @@ discard block |
||
1585 | 1585 | { |
1586 | 1586 | $limit_array = explode(",", $limit); |
1587 | 1587 | |
1588 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1589 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1588 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1589 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1590 | 1590 | |
1591 | 1591 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1592 | 1592 | { |
@@ -1634,7 +1634,7 @@ discard block |
||
1634 | 1634 | { |
1635 | 1635 | return false; |
1636 | 1636 | } else { |
1637 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1637 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
1638 | 1638 | $additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)"; |
1639 | 1639 | $query_values = array(':departure_airport_icao' => $departure_airport_icao); |
1640 | 1640 | } |
@@ -1646,9 +1646,9 @@ discard block |
||
1646 | 1646 | { |
1647 | 1647 | return false; |
1648 | 1648 | } else { |
1649 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1649 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
1650 | 1650 | $additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)"; |
1651 | - $query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
1651 | + $query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
1652 | 1652 | } |
1653 | 1653 | } |
1654 | 1654 | |
@@ -1656,8 +1656,8 @@ discard block |
||
1656 | 1656 | { |
1657 | 1657 | $limit_array = explode(",", $limit); |
1658 | 1658 | |
1659 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1660 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1659 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1660 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1661 | 1661 | |
1662 | 1662 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1663 | 1663 | { |
@@ -1696,15 +1696,15 @@ discard block |
||
1696 | 1696 | global $global_query; |
1697 | 1697 | |
1698 | 1698 | date_default_timezone_set('UTC'); |
1699 | - $filter_query = $this->getFilter($filter,true,true); |
|
1699 | + $filter_query = $this->getFilter($filter, true, true); |
|
1700 | 1700 | $limit_query = ''; |
1701 | 1701 | |
1702 | 1702 | if ($limit != "") |
1703 | 1703 | { |
1704 | 1704 | $limit_array = explode(",", $limit); |
1705 | 1705 | |
1706 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1707 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1706 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1707 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1708 | 1708 | |
1709 | 1709 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1710 | 1710 | { |
@@ -1721,7 +1721,7 @@ discard block |
||
1721 | 1721 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
1722 | 1722 | } |
1723 | 1723 | |
1724 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
1724 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
1725 | 1725 | |
1726 | 1726 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1727 | 1727 | |
@@ -1734,19 +1734,19 @@ discard block |
||
1734 | 1734 | * @return String the highlight text |
1735 | 1735 | * |
1736 | 1736 | */ |
1737 | - public function getHighlightByRegistration($registration,$filter = array()) |
|
1737 | + public function getHighlightByRegistration($registration, $filter = array()) |
|
1738 | 1738 | { |
1739 | 1739 | global $global_query; |
1740 | 1740 | |
1741 | 1741 | date_default_timezone_set('UTC'); |
1742 | - $filter_query = $this->getFilter($filter,true,true); |
|
1743 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
1742 | + $filter_query = $this->getFilter($filter, true, true); |
|
1743 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
1744 | 1744 | |
1745 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
1745 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
1746 | 1746 | $sth = $this->db->prepare($query); |
1747 | 1747 | $sth->execute(array(':registration' => $registration)); |
1748 | 1748 | |
1749 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1749 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1750 | 1750 | { |
1751 | 1751 | $highlight = $row['highlight']; |
1752 | 1752 | } |
@@ -1762,14 +1762,14 @@ discard block |
||
1762 | 1762 | * @return String usage |
1763 | 1763 | * |
1764 | 1764 | */ |
1765 | - public function getSquawkUsage($squawk = '',$country = 'FR') |
|
1765 | + public function getSquawkUsage($squawk = '', $country = 'FR') |
|
1766 | 1766 | { |
1767 | 1767 | |
1768 | - $squawk = filter_var($squawk,FILTER_SANITIZE_STRING); |
|
1769 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
1768 | + $squawk = filter_var($squawk, FILTER_SANITIZE_STRING); |
|
1769 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
1770 | 1770 | |
1771 | 1771 | $query = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1"; |
1772 | - $query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country); |
|
1772 | + $query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country); |
|
1773 | 1773 | |
1774 | 1774 | $sth = $this->db->prepare($query); |
1775 | 1775 | $sth->execute($query_values); |
@@ -1791,9 +1791,9 @@ discard block |
||
1791 | 1791 | public function getAirportIcao($airport_iata = '') |
1792 | 1792 | { |
1793 | 1793 | |
1794 | - $airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING); |
|
1794 | + $airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING); |
|
1795 | 1795 | |
1796 | - $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
1796 | + $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
1797 | 1797 | $query_values = array(':airport' => $airport_iata); |
1798 | 1798 | |
1799 | 1799 | $sth = $this->db->prepare($query); |
@@ -1815,12 +1815,12 @@ discard block |
||
1815 | 1815 | * @return Float distance to the airport |
1816 | 1816 | * |
1817 | 1817 | */ |
1818 | - public function getAirportDistance($airport_icao,$latitude,$longitude) |
|
1818 | + public function getAirportDistance($airport_icao, $latitude, $longitude) |
|
1819 | 1819 | { |
1820 | 1820 | |
1821 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
1821 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
1822 | 1822 | |
1823 | - $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
1823 | + $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
1824 | 1824 | $query_values = array(':airport' => $airport_icao); |
1825 | 1825 | $sth = $this->db->prepare($query); |
1826 | 1826 | $sth->execute($query_values); |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | $airport_latitude = $row['latitude']; |
1831 | 1831 | $airport_longitude = $row['longitude']; |
1832 | 1832 | $Common = new Common(); |
1833 | - return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
|
1833 | + return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude); |
|
1834 | 1834 | } else return ''; |
1835 | 1835 | } |
1836 | 1836 | |
@@ -1844,11 +1844,11 @@ discard block |
||
1844 | 1844 | public function getAllAirportInfo($airport = '') |
1845 | 1845 | { |
1846 | 1846 | |
1847 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
1847 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
1848 | 1848 | |
1849 | 1849 | $query_values = array(); |
1850 | 1850 | if ($airport == 'NA') { |
1851 | - return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => '')); |
|
1851 | + return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => '')); |
|
1852 | 1852 | } elseif ($airport == '') { |
1853 | 1853 | $query = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport"; |
1854 | 1854 | } else { |
@@ -1896,14 +1896,14 @@ discard block |
||
1896 | 1896 | { |
1897 | 1897 | $lst_countries = ''; |
1898 | 1898 | foreach ($countries as $country) { |
1899 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
1899 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
1900 | 1900 | if ($lst_countries == '') { |
1901 | 1901 | $lst_countries = "'".$country."'"; |
1902 | 1902 | } else { |
1903 | 1903 | $lst_countries .= ",'".$country."'"; |
1904 | 1904 | } |
1905 | 1905 | } |
1906 | - $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
1906 | + $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
1907 | 1907 | |
1908 | 1908 | $sth = $this->db->prepare($query); |
1909 | 1909 | $sth->execute(); |
@@ -1911,7 +1911,7 @@ discard block |
||
1911 | 1911 | $airport_array = array(); |
1912 | 1912 | $temp_array = array(); |
1913 | 1913 | |
1914 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1914 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1915 | 1915 | { |
1916 | 1916 | $temp_array['name'] = $row['name']; |
1917 | 1917 | $temp_array['city'] = $row['city']; |
@@ -1939,10 +1939,10 @@ discard block |
||
1939 | 1939 | { |
1940 | 1940 | global $globalDBdriver; |
1941 | 1941 | if (is_array($coord)) { |
1942 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1943 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1944 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1945 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1942 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1943 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1944 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1945 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1946 | 1946 | } else return array(); |
1947 | 1947 | if ($globalDBdriver == 'mysql') { |
1948 | 1948 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
@@ -1954,7 +1954,7 @@ discard block |
||
1954 | 1954 | |
1955 | 1955 | $airport_array = array(); |
1956 | 1956 | |
1957 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1957 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1958 | 1958 | { |
1959 | 1959 | $temp_array = $row; |
1960 | 1960 | |
@@ -1974,13 +1974,13 @@ discard block |
||
1974 | 1974 | public function getAllWaypointsInfobyCoord($coord) |
1975 | 1975 | { |
1976 | 1976 | if (is_array($coord)) { |
1977 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1978 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1979 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1980 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1977 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1978 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1979 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1980 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1981 | 1981 | } else return array(); |
1982 | 1982 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
1983 | - $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
1983 | + $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
1984 | 1984 | //$query = "SELECT waypoints.* FROM waypoints"; |
1985 | 1985 | //$query = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end"; |
1986 | 1986 | //$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
@@ -1992,7 +1992,7 @@ discard block |
||
1992 | 1992 | |
1993 | 1993 | $waypoints_array = array(); |
1994 | 1994 | |
1995 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1995 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1996 | 1996 | { |
1997 | 1997 | $temp_array = $row; |
1998 | 1998 | |
@@ -2014,10 +2014,10 @@ discard block |
||
2014 | 2014 | { |
2015 | 2015 | global $globalUseRealAirlines; |
2016 | 2016 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
2017 | - $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
|
2017 | + $airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING)); |
|
2018 | 2018 | if ($airline_icao == 'NA') { |
2019 | 2019 | $airline_array = array(); |
2020 | - $airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
2020 | + $airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
2021 | 2021 | return $airline_array; |
2022 | 2022 | } else { |
2023 | 2023 | if (strlen($airline_icao) == 2) { |
@@ -2038,7 +2038,7 @@ discard block |
||
2038 | 2038 | if ($fromsource === NULL) { |
2039 | 2039 | $sth->execute(array(':airline_icao' => $airline_icao)); |
2040 | 2040 | } else { |
2041 | - $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
|
2041 | + $sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource)); |
|
2042 | 2042 | } |
2043 | 2043 | /* |
2044 | 2044 | $airline_array = array(); |
@@ -2080,12 +2080,12 @@ discard block |
||
2080 | 2080 | */ |
2081 | 2081 | public function getAllAircraftInfo($aircraft_type) |
2082 | 2082 | { |
2083 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
2083 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
2084 | 2084 | |
2085 | 2085 | if ($aircraft_type == 'NA') { |
2086 | - return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
2086 | + return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
2087 | 2087 | } |
2088 | - $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
2088 | + $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
2089 | 2089 | |
2090 | 2090 | $sth = $this->db->prepare($query); |
2091 | 2091 | $sth->execute(array(':aircraft_type' => $aircraft_type)); |
@@ -2117,7 +2117,7 @@ discard block |
||
2117 | 2117 | */ |
2118 | 2118 | public function getAircraftIcao($aircraft_type) |
2119 | 2119 | { |
2120 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
2120 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
2121 | 2121 | $all_aircraft = array('737-300' => 'B733', |
2122 | 2122 | '777-200' => 'B772', |
2123 | 2123 | '777-200ER' => 'B772', |
@@ -2129,10 +2129,10 @@ discard block |
||
2129 | 2129 | 'A380' => 'A388'); |
2130 | 2130 | if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
2131 | 2131 | |
2132 | - $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
2132 | + $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
2133 | 2133 | $aircraft_type = strtoupper($aircraft_type); |
2134 | 2134 | $sth = $this->db->prepare($query); |
2135 | - $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
|
2135 | + $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,)); |
|
2136 | 2136 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
2137 | 2137 | if (isset($result[0]['icao'])) return $result[0]['icao']; |
2138 | 2138 | else return ''; |
@@ -2147,9 +2147,9 @@ discard block |
||
2147 | 2147 | */ |
2148 | 2148 | public function getAllAircraftType($aircraft_modes) |
2149 | 2149 | { |
2150 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
2150 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
2151 | 2151 | |
2152 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
2152 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
2153 | 2153 | |
2154 | 2154 | $sth = $this->db->prepare($query); |
2155 | 2155 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -2170,8 +2170,8 @@ discard block |
||
2170 | 2170 | */ |
2171 | 2171 | public function getOperator($operator) |
2172 | 2172 | { |
2173 | - $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
|
2174 | - $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
2173 | + $operator = filter_var($operator, FILTER_SANITIZE_STRING); |
|
2174 | + $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
2175 | 2175 | |
2176 | 2176 | $sth = $this->db->prepare($query); |
2177 | 2177 | $sth->execute(array(':operator' => $operator)); |
@@ -2192,9 +2192,9 @@ discard block |
||
2192 | 2192 | */ |
2193 | 2193 | public function getRouteInfo($callsign) |
2194 | 2194 | { |
2195 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
2195 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
2196 | 2196 | if ($callsign == '') return array(); |
2197 | - $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
2197 | + $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
2198 | 2198 | |
2199 | 2199 | $sth = $this->db->prepare($query); |
2200 | 2200 | $sth->execute(array(':callsign' => $callsign)); |
@@ -2215,9 +2215,9 @@ discard block |
||
2215 | 2215 | */ |
2216 | 2216 | public function getAircraftInfoByRegistration($registration) |
2217 | 2217 | { |
2218 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
2218 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
2219 | 2219 | |
2220 | - $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
2220 | + $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
2221 | 2221 | |
2222 | 2222 | $sth = $this->db->prepare($query); |
2223 | 2223 | $sth->execute(array(':registration' => $registration)); |
@@ -2225,7 +2225,7 @@ discard block |
||
2225 | 2225 | $aircraft_array = array(); |
2226 | 2226 | $temp_array = array(); |
2227 | 2227 | |
2228 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2228 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2229 | 2229 | { |
2230 | 2230 | $temp_array['airline_icao'] = $row['airline_icao']; |
2231 | 2231 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -2247,7 +2247,7 @@ discard block |
||
2247 | 2247 | */ |
2248 | 2248 | public function getAircraftOwnerByRegistration($registration) |
2249 | 2249 | { |
2250 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
2250 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
2251 | 2251 | $Connection = new Connection($this->db); |
2252 | 2252 | if ($Connection->tableExists('aircraft_owner')) { |
2253 | 2253 | $query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1"; |
@@ -2269,7 +2269,7 @@ discard block |
||
2269 | 2269 | public function getAllFlightsforSitemap() |
2270 | 2270 | { |
2271 | 2271 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
2272 | - $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
2272 | + $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
2273 | 2273 | |
2274 | 2274 | $sth = $this->db->prepare($query); |
2275 | 2275 | $sth->execute(); |
@@ -2316,7 +2316,7 @@ discard block |
||
2316 | 2316 | $manufacturer_array = array(); |
2317 | 2317 | $temp_array = array(); |
2318 | 2318 | |
2319 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2319 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2320 | 2320 | { |
2321 | 2321 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
2322 | 2322 | |
@@ -2342,7 +2342,7 @@ discard block |
||
2342 | 2342 | ORDER BY spotter_output.aircraft_name ASC"; |
2343 | 2343 | |
2344 | 2344 | */ |
2345 | - $filter_query = $this->getFilter($filters,true,true); |
|
2345 | + $filter_query = $this->getFilter($filters, true, true); |
|
2346 | 2346 | $query = "SELECT DISTINCT icao AS aircraft_icao, type AS aircraft_name, manufacturer AS aircraft_manufacturer FROM aircraft".$filter_query." icao <> '' ORDER BY aircraft_manufacturer ASC"; |
2347 | 2347 | |
2348 | 2348 | $sth = $this->db->prepare($query); |
@@ -2351,7 +2351,7 @@ discard block |
||
2351 | 2351 | $aircraft_array = array(); |
2352 | 2352 | $temp_array = array(); |
2353 | 2353 | |
2354 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2354 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2355 | 2355 | { |
2356 | 2356 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
2357 | 2357 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
@@ -2372,8 +2372,8 @@ discard block |
||
2372 | 2372 | */ |
2373 | 2373 | public function getAllAircraftRegistrations($filters = array()) |
2374 | 2374 | { |
2375 | - $filter_query = $this->getFilter($filters,true,true); |
|
2376 | - $query = "SELECT DISTINCT spotter_output.registration |
|
2375 | + $filter_query = $this->getFilter($filters, true, true); |
|
2376 | + $query = "SELECT DISTINCT spotter_output.registration |
|
2377 | 2377 | FROM spotter_output".$filter_query." spotter_output.registration <> '' |
2378 | 2378 | ORDER BY spotter_output.registration ASC"; |
2379 | 2379 | |
@@ -2383,7 +2383,7 @@ discard block |
||
2383 | 2383 | $aircraft_array = array(); |
2384 | 2384 | $temp_array = array(); |
2385 | 2385 | |
2386 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2386 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2387 | 2387 | { |
2388 | 2388 | $temp_array['registration'] = $row['registration']; |
2389 | 2389 | |
@@ -2400,11 +2400,11 @@ discard block |
||
2400 | 2400 | * @return Array list of source name |
2401 | 2401 | * |
2402 | 2402 | */ |
2403 | - public function getAllSourceName($type = '',$filters = array()) |
|
2403 | + public function getAllSourceName($type = '', $filters = array()) |
|
2404 | 2404 | { |
2405 | - $filter_query = $this->getFilter($filters,true,true); |
|
2405 | + $filter_query = $this->getFilter($filters, true, true); |
|
2406 | 2406 | $query_values = array(); |
2407 | - $query = "SELECT DISTINCT spotter_output.source_name |
|
2407 | + $query = "SELECT DISTINCT spotter_output.source_name |
|
2408 | 2408 | FROM spotter_output".$filter_query." spotter_output.source_name <> ''"; |
2409 | 2409 | if ($type != '') { |
2410 | 2410 | $query_values = array(':type' => $type); |
@@ -2419,7 +2419,7 @@ discard block |
||
2419 | 2419 | $source_array = array(); |
2420 | 2420 | $temp_array = array(); |
2421 | 2421 | |
2422 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2422 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2423 | 2423 | { |
2424 | 2424 | $temp_array['source_name'] = $row['source_name']; |
2425 | 2425 | $source_array[] = $temp_array; |
@@ -2435,11 +2435,11 @@ discard block |
||
2435 | 2435 | * @return Array list of airline names |
2436 | 2436 | * |
2437 | 2437 | */ |
2438 | - public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
|
2438 | + public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array()) |
|
2439 | 2439 | { |
2440 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
2441 | - $filter_query = $this->getFilter($filters,true,true); |
|
2442 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
2440 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
2441 | + $filter_query = $this->getFilter($filters, true, true); |
|
2442 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
2443 | 2443 | if ($airline_type == '' || $airline_type == 'all') { |
2444 | 2444 | /* |
2445 | 2445 | $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
@@ -2458,7 +2458,7 @@ discard block |
||
2458 | 2458 | $query_data = array(':forsource' => $forsource); |
2459 | 2459 | } |
2460 | 2460 | } else { |
2461 | - $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
2461 | + $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
2462 | 2462 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
2463 | 2463 | AND spotter_output.airline_type = :airline_type |
2464 | 2464 | ORDER BY spotter_output.airline_icao ASC"; |
@@ -2471,7 +2471,7 @@ discard block |
||
2471 | 2471 | $airline_array = array(); |
2472 | 2472 | $temp_array = array(); |
2473 | 2473 | |
2474 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2474 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2475 | 2475 | { |
2476 | 2476 | $temp_array['airline_icao'] = $row['airline_icao']; |
2477 | 2477 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -2491,8 +2491,8 @@ discard block |
||
2491 | 2491 | */ |
2492 | 2492 | public function getAllAirlineCountries($filters = array()) |
2493 | 2493 | { |
2494 | - $filter_query = $this->getFilter($filters,true,true); |
|
2495 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
2494 | + $filter_query = $this->getFilter($filters, true, true); |
|
2495 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
2496 | 2496 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
2497 | 2497 | ORDER BY spotter_output.airline_country ASC"; |
2498 | 2498 | |
@@ -2503,7 +2503,7 @@ discard block |
||
2503 | 2503 | $airline_array = array(); |
2504 | 2504 | $temp_array = array(); |
2505 | 2505 | |
2506 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2506 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2507 | 2507 | { |
2508 | 2508 | $temp_array['airline_country'] = $row['airline_country']; |
2509 | 2509 | |
@@ -2523,9 +2523,9 @@ discard block |
||
2523 | 2523 | */ |
2524 | 2524 | public function getAllAirportNames($filters = array()) |
2525 | 2525 | { |
2526 | - $filter_query = $this->getFilter($filters,true,true); |
|
2526 | + $filter_query = $this->getFilter($filters, true, true); |
|
2527 | 2527 | $airport_array = array(); |
2528 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
2528 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
2529 | 2529 | FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' |
2530 | 2530 | ORDER BY spotter_output.departure_airport_city ASC"; |
2531 | 2531 | |
@@ -2534,7 +2534,7 @@ discard block |
||
2534 | 2534 | $sth->execute(); |
2535 | 2535 | |
2536 | 2536 | $temp_array = array(); |
2537 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2537 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2538 | 2538 | { |
2539 | 2539 | $temp_array['airport_icao'] = $row['airport_icao']; |
2540 | 2540 | $temp_array['airport_name'] = $row['airport_name']; |
@@ -2544,14 +2544,14 @@ discard block |
||
2544 | 2544 | $airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array; |
2545 | 2545 | } |
2546 | 2546 | |
2547 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
2547 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
2548 | 2548 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' |
2549 | 2549 | ORDER BY spotter_output.arrival_airport_city ASC"; |
2550 | 2550 | |
2551 | 2551 | $sth = $this->db->prepare($query); |
2552 | 2552 | $sth->execute(); |
2553 | 2553 | |
2554 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2554 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2555 | 2555 | { |
2556 | 2556 | // if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao']) |
2557 | 2557 | // { |
@@ -2591,21 +2591,21 @@ discard block |
||
2591 | 2591 | |
2592 | 2592 | $temp_array = array(); |
2593 | 2593 | |
2594 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2594 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2595 | 2595 | { |
2596 | 2596 | $temp_array['airport_country'] = $row['airport_country']; |
2597 | 2597 | |
2598 | 2598 | $airport_array[$row['airport_country']] = $temp_array; |
2599 | 2599 | } |
2600 | - $filter_query = $this->getFilter($filters,true,true); |
|
2601 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
2600 | + $filter_query = $this->getFilter($filters, true, true); |
|
2601 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
2602 | 2602 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
2603 | 2603 | ORDER BY spotter_output.arrival_airport_country ASC"; |
2604 | 2604 | |
2605 | 2605 | $sth = $this->db->prepare($query); |
2606 | 2606 | $sth->execute(); |
2607 | 2607 | |
2608 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2608 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2609 | 2609 | { |
2610 | 2610 | if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country']) |
2611 | 2611 | { |
@@ -2628,9 +2628,9 @@ discard block |
||
2628 | 2628 | */ |
2629 | 2629 | public function getAllCountries($filters = array()) |
2630 | 2630 | { |
2631 | - $Connection= new Connection($this->db); |
|
2631 | + $Connection = new Connection($this->db); |
|
2632 | 2632 | if ($Connection->tableExists('countries')) { |
2633 | - $query = "SELECT countries.name AS airport_country |
|
2633 | + $query = "SELECT countries.name AS airport_country |
|
2634 | 2634 | FROM countries |
2635 | 2635 | ORDER BY countries.name ASC"; |
2636 | 2636 | $sth = $this->db->prepare($query); |
@@ -2639,14 +2639,14 @@ discard block |
||
2639 | 2639 | $temp_array = array(); |
2640 | 2640 | $country_array = array(); |
2641 | 2641 | |
2642 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2642 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2643 | 2643 | { |
2644 | 2644 | $temp_array['country'] = $row['airport_country']; |
2645 | 2645 | $country_array[$row['airport_country']] = $temp_array; |
2646 | 2646 | } |
2647 | 2647 | } else { |
2648 | - $filter_query = $this->getFilter($filters,true,true); |
|
2649 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
2648 | + $filter_query = $this->getFilter($filters, true, true); |
|
2649 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
2650 | 2650 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' |
2651 | 2651 | ORDER BY spotter_output.departure_airport_country ASC"; |
2652 | 2652 | |
@@ -2655,20 +2655,20 @@ discard block |
||
2655 | 2655 | |
2656 | 2656 | $temp_array = array(); |
2657 | 2657 | $country_array = array(); |
2658 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2658 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2659 | 2659 | { |
2660 | 2660 | $temp_array['country'] = $row['airport_country']; |
2661 | 2661 | $country_array[$row['airport_country']] = $temp_array; |
2662 | 2662 | } |
2663 | 2663 | |
2664 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
2664 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
2665 | 2665 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
2666 | 2666 | ORDER BY spotter_output.arrival_airport_country ASC"; |
2667 | 2667 | |
2668 | 2668 | $sth = $this->db->prepare($query); |
2669 | 2669 | $sth->execute(); |
2670 | 2670 | |
2671 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2671 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2672 | 2672 | { |
2673 | 2673 | if ($country_array[$row['airport_country']]['country'] != $row['airport_country']) |
2674 | 2674 | { |
@@ -2678,14 +2678,14 @@ discard block |
||
2678 | 2678 | } |
2679 | 2679 | } |
2680 | 2680 | |
2681 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
2681 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
2682 | 2682 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
2683 | 2683 | ORDER BY spotter_output.airline_country ASC"; |
2684 | 2684 | |
2685 | 2685 | $sth = $this->db->prepare($query); |
2686 | 2686 | $sth->execute(); |
2687 | 2687 | |
2688 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2688 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2689 | 2689 | { |
2690 | 2690 | if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country']) |
2691 | 2691 | { |
@@ -2709,8 +2709,8 @@ discard block |
||
2709 | 2709 | */ |
2710 | 2710 | public function getAllIdents($filters = array()) |
2711 | 2711 | { |
2712 | - $filter_query = $this->getFilter($filters,true,true); |
|
2713 | - $query = "SELECT DISTINCT spotter_output.ident |
|
2712 | + $filter_query = $this->getFilter($filters, true, true); |
|
2713 | + $query = "SELECT DISTINCT spotter_output.ident |
|
2714 | 2714 | FROM spotter_output".$filter_query." spotter_output.ident <> '' |
2715 | 2715 | ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0"; |
2716 | 2716 | |
@@ -2720,7 +2720,7 @@ discard block |
||
2720 | 2720 | $ident_array = array(); |
2721 | 2721 | $temp_array = array(); |
2722 | 2722 | |
2723 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2723 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2724 | 2724 | { |
2725 | 2725 | $temp_array['ident'] = $row['ident']; |
2726 | 2726 | $ident_array[] = $temp_array; |
@@ -2734,9 +2734,9 @@ discard block |
||
2734 | 2734 | * @return Array number, icao, name and city of airports |
2735 | 2735 | */ |
2736 | 2736 | |
2737 | - public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
|
2737 | + public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) { |
|
2738 | 2738 | global $globalTimezone, $globalDBdriver; |
2739 | - $filter_query = $this->getFilter($filters,true,true); |
|
2739 | + $filter_query = $this->getFilter($filters, true, true); |
|
2740 | 2740 | if ($globalTimezone != '') { |
2741 | 2741 | date_default_timezone_set($globalTimezone); |
2742 | 2742 | $datetime = new DateTime(); |
@@ -2801,7 +2801,7 @@ discard block |
||
2801 | 2801 | |
2802 | 2802 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
2803 | 2803 | global $globalTimezone, $globalDBdriver; |
2804 | - $filter_query = $this->getFilter($filters,true,true); |
|
2804 | + $filter_query = $this->getFilter($filters, true, true); |
|
2805 | 2805 | if ($globalTimezone != '') { |
2806 | 2806 | date_default_timezone_set($globalTimezone); |
2807 | 2807 | $datetime = new DateTime(); |
@@ -2885,7 +2885,7 @@ discard block |
||
2885 | 2885 | |
2886 | 2886 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
2887 | 2887 | global $globalTimezone, $globalDBdriver; |
2888 | - $filter_query = $this->getFilter($filters,true,true); |
|
2888 | + $filter_query = $this->getFilter($filters, true, true); |
|
2889 | 2889 | if ($globalTimezone != '') { |
2890 | 2890 | date_default_timezone_set($globalTimezone); |
2891 | 2891 | $datetime = new DateTime(); |
@@ -2918,9 +2918,9 @@ discard block |
||
2918 | 2918 | * @return Array number, icao, name and city of airports |
2919 | 2919 | */ |
2920 | 2920 | |
2921 | - public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
|
2921 | + public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) { |
|
2922 | 2922 | global $globalTimezone, $globalDBdriver; |
2923 | - $filter_query = $this->getFilter($filters,true,true); |
|
2923 | + $filter_query = $this->getFilter($filters, true, true); |
|
2924 | 2924 | if ($globalTimezone != '') { |
2925 | 2925 | date_default_timezone_set($globalTimezone); |
2926 | 2926 | $datetime = new DateTime(); |
@@ -3052,12 +3052,12 @@ discard block |
||
3052 | 3052 | } else $offset = '+00:00'; |
3053 | 3053 | |
3054 | 3054 | if ($globalDBdriver == 'mysql') { |
3055 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
3055 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
3056 | 3056 | FROM spotter_output |
3057 | 3057 | WHERE spotter_output.date <> '' |
3058 | 3058 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
3059 | 3059 | } else { |
3060 | - $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
3060 | + $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
3061 | 3061 | FROM spotter_output |
3062 | 3062 | WHERE spotter_output.date <> '' |
3063 | 3063 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
@@ -3069,7 +3069,7 @@ discard block |
||
3069 | 3069 | $date_array = array(); |
3070 | 3070 | $temp_array = array(); |
3071 | 3071 | |
3072 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3072 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3073 | 3073 | { |
3074 | 3074 | $temp_array['date'] = $row['date']; |
3075 | 3075 | |
@@ -3089,7 +3089,7 @@ discard block |
||
3089 | 3089 | */ |
3090 | 3090 | public function getAllRoutes() |
3091 | 3091 | { |
3092 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
3092 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
3093 | 3093 | FROM spotter_output |
3094 | 3094 | WHERE spotter_output.ident <> '' |
3095 | 3095 | GROUP BY route |
@@ -3100,7 +3100,7 @@ discard block |
||
3100 | 3100 | |
3101 | 3101 | $routes_array = array(); |
3102 | 3102 | $temp_array = array(); |
3103 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3103 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3104 | 3104 | { |
3105 | 3105 | $temp_array['route'] = $row['route']; |
3106 | 3106 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -3119,21 +3119,21 @@ discard block |
||
3119 | 3119 | * @return String success or false |
3120 | 3120 | * |
3121 | 3121 | */ |
3122 | - public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
|
3122 | + public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL) |
|
3123 | 3123 | { |
3124 | 3124 | if (!is_numeric(substr($ident, 0, 3))) |
3125 | 3125 | { |
3126 | 3126 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
3127 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
3127 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
3128 | 3128 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
3129 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
3129 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
3130 | 3130 | } else { |
3131 | 3131 | $airline_array = $this->getAllAirlineInfo("NA"); |
3132 | 3132 | } |
3133 | 3133 | if (count($airline_array) == 0) { |
3134 | 3134 | $airline_array = $this->getAllAirlineInfo("NA"); |
3135 | 3135 | } |
3136 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
3136 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
3137 | 3137 | $airline_array = $this->getAllAirlineInfo("NA"); |
3138 | 3138 | } |
3139 | 3139 | } else { |
@@ -3146,7 +3146,7 @@ discard block |
||
3146 | 3146 | |
3147 | 3147 | |
3148 | 3148 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
3149 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
3149 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type); |
|
3150 | 3150 | |
3151 | 3151 | try { |
3152 | 3152 | $sth = $this->db->prepare($query); |
@@ -3167,11 +3167,11 @@ discard block |
||
3167 | 3167 | * @return String success or false |
3168 | 3168 | * |
3169 | 3169 | */ |
3170 | - public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
|
3170 | + public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '') |
|
3171 | 3171 | { |
3172 | 3172 | if ($groundspeed == '') $groundspeed = NULL; |
3173 | 3173 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
3174 | - $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
3174 | + $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
3175 | 3175 | |
3176 | 3176 | try { |
3177 | 3177 | $sth = $this->db->prepare($query); |
@@ -3211,7 +3211,7 @@ discard block |
||
3211 | 3211 | * @param String $verticalrate vertival rate of flight |
3212 | 3212 | * @return String success or false |
3213 | 3213 | */ |
3214 | - public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
|
3214 | + public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '') |
|
3215 | 3215 | { |
3216 | 3216 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
3217 | 3217 | |
@@ -3235,13 +3235,13 @@ discard block |
||
3235 | 3235 | if ($ModeS != '') { |
3236 | 3236 | $timeelapsed = microtime(true); |
3237 | 3237 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
3238 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3238 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3239 | 3239 | } else { |
3240 | - $myhex = explode('-',$flightaware_id); |
|
3240 | + $myhex = explode('-', $flightaware_id); |
|
3241 | 3241 | if (count($myhex) > 0) { |
3242 | 3242 | $timeelapsed = microtime(true); |
3243 | 3243 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
3244 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3244 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3245 | 3245 | } |
3246 | 3246 | } |
3247 | 3247 | } |
@@ -3263,24 +3263,24 @@ discard block |
||
3263 | 3263 | { |
3264 | 3264 | $timeelapsed = microtime(true); |
3265 | 3265 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
3266 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
3266 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
3267 | 3267 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
3268 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
3268 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
3269 | 3269 | } else { |
3270 | 3270 | $airline_array = $this->getAllAirlineInfo("NA"); |
3271 | 3271 | } |
3272 | 3272 | if (count($airline_array) == 0) { |
3273 | 3273 | $airline_array = $this->getAllAirlineInfo("NA"); |
3274 | 3274 | } |
3275 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
3275 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
3276 | 3276 | $airline_array = $this->getAllAirlineInfo("NA"); |
3277 | 3277 | } |
3278 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3278 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3279 | 3279 | |
3280 | 3280 | } else { |
3281 | 3281 | $timeelapsed = microtime(true); |
3282 | 3282 | $airline_array = $this->getAllAirlineInfo("NA"); |
3283 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3283 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3284 | 3284 | } |
3285 | 3285 | } |
3286 | 3286 | } else $airline_array = array(); |
@@ -3297,27 +3297,27 @@ discard block |
||
3297 | 3297 | { |
3298 | 3298 | $timeelapsed = microtime(true); |
3299 | 3299 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3300 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3300 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3301 | 3301 | } else { |
3302 | 3302 | $timeelapsed = microtime(true); |
3303 | 3303 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3304 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3304 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3305 | 3305 | } |
3306 | 3306 | } |
3307 | 3307 | } else { |
3308 | 3308 | if ($ModeS != '') { |
3309 | 3309 | $timeelapsed = microtime(true); |
3310 | 3310 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
3311 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3311 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3312 | 3312 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
3313 | 3313 | { |
3314 | 3314 | $timeelapsed = microtime(true); |
3315 | 3315 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3316 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3316 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3317 | 3317 | } else { |
3318 | 3318 | $timeelapsed = microtime(true); |
3319 | 3319 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3320 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3320 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3321 | 3321 | } |
3322 | 3322 | } |
3323 | 3323 | } |
@@ -3332,7 +3332,7 @@ discard block |
||
3332 | 3332 | } else { |
3333 | 3333 | $timeelapsed = microtime(true); |
3334 | 3334 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
3335 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3335 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3336 | 3336 | } |
3337 | 3337 | } |
3338 | 3338 | |
@@ -3346,7 +3346,7 @@ discard block |
||
3346 | 3346 | } else { |
3347 | 3347 | $timeelapsed = microtime(true); |
3348 | 3348 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
3349 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3349 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3350 | 3350 | } |
3351 | 3351 | } |
3352 | 3352 | |
@@ -3410,7 +3410,7 @@ discard block |
||
3410 | 3410 | { |
3411 | 3411 | $timeelapsed = microtime(true); |
3412 | 3412 | $image_array = $Image->getSpotterImage($registration); |
3413 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3413 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3414 | 3414 | if (!isset($image_array[0]['registration'])) |
3415 | 3415 | { |
3416 | 3416 | //echo "Add image !!!! \n"; |
@@ -3418,7 +3418,7 @@ discard block |
||
3418 | 3418 | } |
3419 | 3419 | $timeelapsed = microtime(true); |
3420 | 3420 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
3421 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3421 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3422 | 3422 | if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
3423 | 3423 | } |
3424 | 3424 | |
@@ -3426,33 +3426,33 @@ discard block |
||
3426 | 3426 | { |
3427 | 3427 | if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
3428 | 3428 | else $airline_icao = ''; |
3429 | - $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
3429 | + $image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
3430 | 3430 | if (!isset($image_array[0]['registration'])) |
3431 | 3431 | { |
3432 | 3432 | //echo "Add image !!!! \n"; |
3433 | - $Image->addSpotterImage('',$aircraft_icao,$airline_icao); |
|
3433 | + $Image->addSpotterImage('', $aircraft_icao, $airline_icao); |
|
3434 | 3434 | } |
3435 | 3435 | } |
3436 | 3436 | |
3437 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
3438 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
3439 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
3440 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
3441 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
3442 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
3443 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
3444 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
3445 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
3446 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
3447 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
3448 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
3449 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
3450 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
3451 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
3452 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
3453 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
3454 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
3455 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
3437 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
3438 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
3439 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
3440 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
3441 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
3442 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
3443 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
3444 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
3445 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
3446 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
3447 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
3448 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
3449 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
3450 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
3451 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
3452 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
3453 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
3454 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
3455 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
3456 | 3456 | |
3457 | 3457 | if (count($airline_array) == 0) |
3458 | 3458 | { |
@@ -3476,7 +3476,7 @@ discard block |
||
3476 | 3476 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
3477 | 3477 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
3478 | 3478 | if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
3479 | - $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
3479 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
3480 | 3480 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
3481 | 3481 | |
3482 | 3482 | $airline_name = $airline_array[0]['name']; |
@@ -3486,7 +3486,7 @@ discard block |
||
3486 | 3486 | if ($airline_type == '') { |
3487 | 3487 | $timeelapsed = microtime(true); |
3488 | 3488 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
3489 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3489 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3490 | 3490 | } |
3491 | 3491 | if ($airline_type == null) $airline_type = ''; |
3492 | 3492 | $aircraft_type = $aircraft_array[0]['type']; |
@@ -3497,7 +3497,7 @@ discard block |
||
3497 | 3497 | $arrival_airport_name = $arrival_airport_array[0]['name']; |
3498 | 3498 | $arrival_airport_city = $arrival_airport_array[0]['city']; |
3499 | 3499 | $arrival_airport_country = $arrival_airport_array[0]['country']; |
3500 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
3500 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
3501 | 3501 | |
3502 | 3502 | try { |
3503 | 3503 | |
@@ -3523,13 +3523,13 @@ discard block |
||
3523 | 3523 | { |
3524 | 3524 | global $globalDBdriver, $globalTimezone; |
3525 | 3525 | if ($globalDBdriver == 'mysql') { |
3526 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
3526 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
3527 | 3527 | WHERE spotter_output.ident = :ident |
3528 | 3528 | AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
3529 | 3529 | AND spotter_output.date < UTC_TIMESTAMP()"; |
3530 | 3530 | $query_data = array(':ident' => $ident); |
3531 | 3531 | } else { |
3532 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
3532 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
3533 | 3533 | WHERE spotter_output.ident = :ident |
3534 | 3534 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
3535 | 3535 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -3538,8 +3538,8 @@ discard block |
||
3538 | 3538 | |
3539 | 3539 | $sth = $this->db->prepare($query); |
3540 | 3540 | $sth->execute($query_data); |
3541 | - $ident_result=''; |
|
3542 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3541 | + $ident_result = ''; |
|
3542 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3543 | 3543 | { |
3544 | 3544 | $ident_result = $row['ident']; |
3545 | 3545 | } |
@@ -3565,8 +3565,8 @@ discard block |
||
3565 | 3565 | return false; |
3566 | 3566 | } else { |
3567 | 3567 | $q_array = explode(" ", $q); |
3568 | - foreach ($q_array as $q_item){ |
|
3569 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
3568 | + foreach ($q_array as $q_item) { |
|
3569 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
3570 | 3570 | $additional_query .= " AND ("; |
3571 | 3571 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
3572 | 3572 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
@@ -3581,11 +3581,11 @@ discard block |
||
3581 | 3581 | } |
3582 | 3582 | } |
3583 | 3583 | if ($globalDBdriver == 'mysql') { |
3584 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
3584 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
3585 | 3585 | WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
3586 | 3586 | AND spotter_output.date < UTC_TIMESTAMP()"; |
3587 | 3587 | } else { |
3588 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
3588 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
3589 | 3589 | WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
3590 | 3590 | AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
3591 | 3591 | } |
@@ -3602,11 +3602,11 @@ discard block |
||
3602 | 3602 | * @return Array the airline list |
3603 | 3603 | * |
3604 | 3604 | */ |
3605 | - public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
3605 | + public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
3606 | 3606 | { |
3607 | 3607 | global $globalDBdriver; |
3608 | - $filter_query = $this->getFilter($filters,true,true); |
|
3609 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3608 | + $filter_query = $this->getFilter($filters, true, true); |
|
3609 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3610 | 3610 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' "; |
3611 | 3611 | if ($olderthanmonths > 0) { |
3612 | 3612 | if ($globalDBdriver == 'mysql') { |
@@ -3630,7 +3630,7 @@ discard block |
||
3630 | 3630 | |
3631 | 3631 | $airline_array = array(); |
3632 | 3632 | $temp_array = array(); |
3633 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3633 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3634 | 3634 | { |
3635 | 3635 | $temp_array['airline_name'] = $row['airline_name']; |
3636 | 3636 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3647,11 +3647,11 @@ discard block |
||
3647 | 3647 | * @return Array the pilots list |
3648 | 3648 | * |
3649 | 3649 | */ |
3650 | - public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
3650 | + public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
3651 | 3651 | { |
3652 | 3652 | global $globalDBdriver; |
3653 | - $filter_query = $this->getFilter($filters,true,true); |
|
3654 | - $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
|
3653 | + $filter_query = $this->getFilter($filters, true, true); |
|
3654 | + $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
|
3655 | 3655 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
3656 | 3656 | if ($olderthanmonths > 0) { |
3657 | 3657 | if ($globalDBdriver == 'mysql') { |
@@ -3677,7 +3677,7 @@ discard block |
||
3677 | 3677 | $airline_array = array(); |
3678 | 3678 | $temp_array = array(); |
3679 | 3679 | |
3680 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3680 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3681 | 3681 | { |
3682 | 3682 | $temp_array['pilot_name'] = $row['pilot_name']; |
3683 | 3683 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3696,7 +3696,7 @@ discard block |
||
3696 | 3696 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
3697 | 3697 | { |
3698 | 3698 | global $globalDBdriver; |
3699 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
|
3699 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
|
3700 | 3700 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
3701 | 3701 | if ($olderthanmonths > 0) { |
3702 | 3702 | if ($globalDBdriver == 'mysql') { |
@@ -3722,7 +3722,7 @@ discard block |
||
3722 | 3722 | $airline_array = array(); |
3723 | 3723 | $temp_array = array(); |
3724 | 3724 | |
3725 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3725 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3726 | 3726 | { |
3727 | 3727 | $temp_array['pilot_name'] = $row['pilot_name']; |
3728 | 3728 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3739,11 +3739,11 @@ discard block |
||
3739 | 3739 | * @return Array the pilots list |
3740 | 3740 | * |
3741 | 3741 | */ |
3742 | - public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
3742 | + public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
3743 | 3743 | { |
3744 | 3744 | global $globalDBdriver; |
3745 | - $filter_query = $this->getFilter($filters,true,true); |
|
3746 | - $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
3745 | + $filter_query = $this->getFilter($filters, true, true); |
|
3746 | + $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
3747 | 3747 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
3748 | 3748 | if ($olderthanmonths > 0) { |
3749 | 3749 | if ($globalDBdriver == 'mysql') { |
@@ -3769,7 +3769,7 @@ discard block |
||
3769 | 3769 | $airline_array = array(); |
3770 | 3770 | $temp_array = array(); |
3771 | 3771 | |
3772 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3772 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3773 | 3773 | { |
3774 | 3774 | $temp_array['owner_name'] = $row['owner_name']; |
3775 | 3775 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3784,11 +3784,11 @@ discard block |
||
3784 | 3784 | * @return Array the pilots list |
3785 | 3785 | * |
3786 | 3786 | */ |
3787 | - public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
3787 | + public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
3788 | 3788 | { |
3789 | 3789 | global $globalDBdriver; |
3790 | - $filter_query = $this->getFilter($filters,true,true); |
|
3791 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
3790 | + $filter_query = $this->getFilter($filters, true, true); |
|
3791 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
3792 | 3792 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
3793 | 3793 | if ($olderthanmonths > 0) { |
3794 | 3794 | if ($globalDBdriver == 'mysql') { |
@@ -3814,7 +3814,7 @@ discard block |
||
3814 | 3814 | $airline_array = array(); |
3815 | 3815 | $temp_array = array(); |
3816 | 3816 | |
3817 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3817 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3818 | 3818 | { |
3819 | 3819 | $temp_array['owner_name'] = $row['owner_name']; |
3820 | 3820 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3830,11 +3830,11 @@ discard block |
||
3830 | 3830 | * @return Array the airline list |
3831 | 3831 | * |
3832 | 3832 | */ |
3833 | - public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
|
3833 | + public function countAllAirlinesByAircraft($aircraft_icao, $filters = array()) |
|
3834 | 3834 | { |
3835 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
3836 | - $filter_query = $this->getFilter($filters,true,true); |
|
3837 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3835 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
3836 | + $filter_query = $this->getFilter($filters, true, true); |
|
3837 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3838 | 3838 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
3839 | 3839 | GROUP BY spotter_output.airline_name |
3840 | 3840 | ORDER BY airline_count DESC"; |
@@ -3846,7 +3846,7 @@ discard block |
||
3846 | 3846 | $airline_array = array(); |
3847 | 3847 | $temp_array = array(); |
3848 | 3848 | |
3849 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3849 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3850 | 3850 | { |
3851 | 3851 | $temp_array['airline_name'] = $row['airline_name']; |
3852 | 3852 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3866,11 +3866,11 @@ discard block |
||
3866 | 3866 | * @return Array the airline country list |
3867 | 3867 | * |
3868 | 3868 | */ |
3869 | - public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
|
3869 | + public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array()) |
|
3870 | 3870 | { |
3871 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
3872 | - $filter_query = $this->getFilter($filters,true,true); |
|
3873 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
3871 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
3872 | + $filter_query = $this->getFilter($filters, true, true); |
|
3873 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
3874 | 3874 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
3875 | 3875 | GROUP BY spotter_output.airline_country |
3876 | 3876 | ORDER BY airline_country_count DESC |
@@ -3883,7 +3883,7 @@ discard block |
||
3883 | 3883 | $airline_country_array = array(); |
3884 | 3884 | $temp_array = array(); |
3885 | 3885 | |
3886 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3886 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3887 | 3887 | { |
3888 | 3888 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
3889 | 3889 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -3902,11 +3902,11 @@ discard block |
||
3902 | 3902 | * @return Array the airline list |
3903 | 3903 | * |
3904 | 3904 | */ |
3905 | - public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
|
3905 | + public function countAllAirlinesByAirport($airport_icao, $filters = array()) |
|
3906 | 3906 | { |
3907 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
3908 | - $filter_query = $this->getFilter($filters,true,true); |
|
3909 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3907 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
3908 | + $filter_query = $this->getFilter($filters, true, true); |
|
3909 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3910 | 3910 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
3911 | 3911 | GROUP BY spotter_output.airline_name |
3912 | 3912 | ORDER BY airline_count DESC"; |
@@ -3918,7 +3918,7 @@ discard block |
||
3918 | 3918 | $airline_array = array(); |
3919 | 3919 | $temp_array = array(); |
3920 | 3920 | |
3921 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3921 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3922 | 3922 | { |
3923 | 3923 | $temp_array['airline_name'] = $row['airline_name']; |
3924 | 3924 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3937,11 +3937,11 @@ discard block |
||
3937 | 3937 | * @return Array the airline country list |
3938 | 3938 | * |
3939 | 3939 | */ |
3940 | - public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
|
3940 | + public function countAllAirlineCountriesByAirport($airport_icao, $filters = array()) |
|
3941 | 3941 | { |
3942 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
3943 | - $filter_query = $this->getFilter($filters,true,true); |
|
3944 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
3942 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
3943 | + $filter_query = $this->getFilter($filters, true, true); |
|
3944 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
3945 | 3945 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
3946 | 3946 | GROUP BY spotter_output.airline_country |
3947 | 3947 | ORDER BY airline_country_count DESC |
@@ -3954,7 +3954,7 @@ discard block |
||
3954 | 3954 | $airline_country_array = array(); |
3955 | 3955 | $temp_array = array(); |
3956 | 3956 | |
3957 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3957 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3958 | 3958 | { |
3959 | 3959 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
3960 | 3960 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -3971,11 +3971,11 @@ discard block |
||
3971 | 3971 | * @return Array the airline list |
3972 | 3972 | * |
3973 | 3973 | */ |
3974 | - public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
3974 | + public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
3975 | 3975 | { |
3976 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
3977 | - $filter_query = $this->getFilter($filters,true,true); |
|
3978 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3976 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
3977 | + $filter_query = $this->getFilter($filters, true, true); |
|
3978 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3979 | 3979 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
3980 | 3980 | GROUP BY spotter_output.airline_name |
3981 | 3981 | ORDER BY airline_count DESC"; |
@@ -3986,7 +3986,7 @@ discard block |
||
3986 | 3986 | $airline_array = array(); |
3987 | 3987 | $temp_array = array(); |
3988 | 3988 | |
3989 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3989 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3990 | 3990 | { |
3991 | 3991 | $temp_array['airline_name'] = $row['airline_name']; |
3992 | 3992 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4006,11 +4006,11 @@ discard block |
||
4006 | 4006 | * @return Array the airline country list |
4007 | 4007 | * |
4008 | 4008 | */ |
4009 | - public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
4009 | + public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
4010 | 4010 | { |
4011 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
4012 | - $filter_query = $this->getFilter($filters,true,true); |
|
4013 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4011 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
4012 | + $filter_query = $this->getFilter($filters, true, true); |
|
4013 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4014 | 4014 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
4015 | 4015 | GROUP BY spotter_output.airline_country |
4016 | 4016 | ORDER BY airline_country_count DESC |
@@ -4023,7 +4023,7 @@ discard block |
||
4023 | 4023 | $airline_country_array = array(); |
4024 | 4024 | $temp_array = array(); |
4025 | 4025 | |
4026 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4026 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4027 | 4027 | { |
4028 | 4028 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4029 | 4029 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4039,11 +4039,11 @@ discard block |
||
4039 | 4039 | * @return Array the airline list |
4040 | 4040 | * |
4041 | 4041 | */ |
4042 | - public function countAllAirlinesByDate($date,$filters = array()) |
|
4042 | + public function countAllAirlinesByDate($date, $filters = array()) |
|
4043 | 4043 | { |
4044 | 4044 | global $globalTimezone, $globalDBdriver; |
4045 | - $filter_query = $this->getFilter($filters,true,true); |
|
4046 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4045 | + $filter_query = $this->getFilter($filters, true, true); |
|
4046 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4047 | 4047 | if ($globalTimezone != '') { |
4048 | 4048 | date_default_timezone_set($globalTimezone); |
4049 | 4049 | $datetime = new DateTime($date); |
@@ -4051,12 +4051,12 @@ discard block |
||
4051 | 4051 | } else $offset = '+00:00'; |
4052 | 4052 | |
4053 | 4053 | if ($globalDBdriver == 'mysql') { |
4054 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4054 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4055 | 4055 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4056 | 4056 | GROUP BY spotter_output.airline_name |
4057 | 4057 | ORDER BY airline_count DESC"; |
4058 | 4058 | } else { |
4059 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4059 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4060 | 4060 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4061 | 4061 | GROUP BY spotter_output.airline_name |
4062 | 4062 | ORDER BY airline_count DESC"; |
@@ -4067,7 +4067,7 @@ discard block |
||
4067 | 4067 | |
4068 | 4068 | $airline_array = array(); |
4069 | 4069 | $temp_array = array(); |
4070 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4070 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4071 | 4071 | { |
4072 | 4072 | $temp_array['airline_name'] = $row['airline_name']; |
4073 | 4073 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4087,11 +4087,11 @@ discard block |
||
4087 | 4087 | * @return Array the airline country list |
4088 | 4088 | * |
4089 | 4089 | */ |
4090 | - public function countAllAirlineCountriesByDate($date,$filters = array()) |
|
4090 | + public function countAllAirlineCountriesByDate($date, $filters = array()) |
|
4091 | 4091 | { |
4092 | 4092 | global $globalTimezone, $globalDBdriver; |
4093 | - $filter_query = $this->getFilter($filters,true,true); |
|
4094 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4093 | + $filter_query = $this->getFilter($filters, true, true); |
|
4094 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4095 | 4095 | if ($globalTimezone != '') { |
4096 | 4096 | date_default_timezone_set($globalTimezone); |
4097 | 4097 | $datetime = new DateTime($date); |
@@ -4099,13 +4099,13 @@ discard block |
||
4099 | 4099 | } else $offset = '+00:00'; |
4100 | 4100 | |
4101 | 4101 | if ($globalDBdriver == 'mysql') { |
4102 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4102 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4103 | 4103 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4104 | 4104 | GROUP BY spotter_output.airline_country |
4105 | 4105 | ORDER BY airline_country_count DESC |
4106 | 4106 | LIMIT 10 OFFSET 0"; |
4107 | 4107 | } else { |
4108 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4108 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4109 | 4109 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4110 | 4110 | GROUP BY spotter_output.airline_country |
4111 | 4111 | ORDER BY airline_country_count DESC |
@@ -4117,7 +4117,7 @@ discard block |
||
4117 | 4117 | |
4118 | 4118 | $airline_country_array = array(); |
4119 | 4119 | $temp_array = array(); |
4120 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4120 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4121 | 4121 | { |
4122 | 4122 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4123 | 4123 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4134,11 +4134,11 @@ discard block |
||
4134 | 4134 | * @return Array the airline list |
4135 | 4135 | * |
4136 | 4136 | */ |
4137 | - public function countAllAirlinesByIdent($ident,$filters = array()) |
|
4137 | + public function countAllAirlinesByIdent($ident, $filters = array()) |
|
4138 | 4138 | { |
4139 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
4140 | - $filter_query = $this->getFilter($filters,true,true); |
|
4141 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4139 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
4140 | + $filter_query = $this->getFilter($filters, true, true); |
|
4141 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4142 | 4142 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
4143 | 4143 | GROUP BY spotter_output.airline_name |
4144 | 4144 | ORDER BY airline_count DESC"; |
@@ -4150,7 +4150,7 @@ discard block |
||
4150 | 4150 | $airline_array = array(); |
4151 | 4151 | $temp_array = array(); |
4152 | 4152 | |
4153 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4153 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4154 | 4154 | { |
4155 | 4155 | $temp_array['airline_name'] = $row['airline_name']; |
4156 | 4156 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4168,25 +4168,25 @@ discard block |
||
4168 | 4168 | * @return Array the airline list |
4169 | 4169 | * |
4170 | 4170 | */ |
4171 | - public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
4171 | + public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
4172 | 4172 | { |
4173 | - $filter_query = $this->getFilter($filters,true,true); |
|
4174 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
4175 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
4173 | + $filter_query = $this->getFilter($filters, true, true); |
|
4174 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
4175 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
4176 | 4176 | |
4177 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4177 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4178 | 4178 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
4179 | 4179 | GROUP BY spotter_output.airline_name |
4180 | 4180 | ORDER BY airline_count DESC"; |
4181 | 4181 | |
4182 | 4182 | |
4183 | 4183 | $sth = $this->db->prepare($query); |
4184 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
4184 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
4185 | 4185 | |
4186 | 4186 | $airline_array = array(); |
4187 | 4187 | $temp_array = array(); |
4188 | 4188 | |
4189 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4189 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4190 | 4190 | { |
4191 | 4191 | $temp_array['airline_name'] = $row['airline_name']; |
4192 | 4192 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4204,13 +4204,13 @@ discard block |
||
4204 | 4204 | * @return Array the airline country list |
4205 | 4205 | * |
4206 | 4206 | */ |
4207 | - public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
|
4207 | + public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
4208 | 4208 | { |
4209 | - $filter_query = $this->getFilter($filters,true,true); |
|
4210 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
4211 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
4209 | + $filter_query = $this->getFilter($filters, true, true); |
|
4210 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
4211 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
4212 | 4212 | |
4213 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4213 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4214 | 4214 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
4215 | 4215 | GROUP BY spotter_output.airline_country |
4216 | 4216 | ORDER BY airline_country_count DESC |
@@ -4218,11 +4218,11 @@ discard block |
||
4218 | 4218 | |
4219 | 4219 | |
4220 | 4220 | $sth = $this->db->prepare($query); |
4221 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
4221 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
4222 | 4222 | |
4223 | 4223 | $airline_country_array = array(); |
4224 | 4224 | $temp_array = array(); |
4225 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4225 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4226 | 4226 | { |
4227 | 4227 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4228 | 4228 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4240,11 +4240,11 @@ discard block |
||
4240 | 4240 | * @return Array the airline list |
4241 | 4241 | * |
4242 | 4242 | */ |
4243 | - public function countAllAirlinesByCountry($country,$filters = array()) |
|
4243 | + public function countAllAirlinesByCountry($country, $filters = array()) |
|
4244 | 4244 | { |
4245 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
4246 | - $filter_query = $this->getFilter($filters,true,true); |
|
4247 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4245 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
4246 | + $filter_query = $this->getFilter($filters, true, true); |
|
4247 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4248 | 4248 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
4249 | 4249 | GROUP BY spotter_output.airline_name |
4250 | 4250 | ORDER BY airline_count DESC"; |
@@ -4255,7 +4255,7 @@ discard block |
||
4255 | 4255 | |
4256 | 4256 | $airline_array = array(); |
4257 | 4257 | $temp_array = array(); |
4258 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4258 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4259 | 4259 | { |
4260 | 4260 | $temp_array['airline_name'] = $row['airline_name']; |
4261 | 4261 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4274,11 +4274,11 @@ discard block |
||
4274 | 4274 | * @return Array the airline country list |
4275 | 4275 | * |
4276 | 4276 | */ |
4277 | - public function countAllAirlineCountriesByCountry($country,$filters = array()) |
|
4277 | + public function countAllAirlineCountriesByCountry($country, $filters = array()) |
|
4278 | 4278 | { |
4279 | - $filter_query = $this->getFilter($filters,true,true); |
|
4280 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
4281 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4279 | + $filter_query = $this->getFilter($filters, true, true); |
|
4280 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
4281 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4282 | 4282 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
4283 | 4283 | GROUP BY spotter_output.airline_country |
4284 | 4284 | ORDER BY airline_country_count DESC |
@@ -4290,7 +4290,7 @@ discard block |
||
4290 | 4290 | |
4291 | 4291 | $airline_country_array = array(); |
4292 | 4292 | $temp_array = array(); |
4293 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4293 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4294 | 4294 | { |
4295 | 4295 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4296 | 4296 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4309,8 +4309,8 @@ discard block |
||
4309 | 4309 | */ |
4310 | 4310 | public function countAllAirlineCountries($limit = true, $filters = array()) |
4311 | 4311 | { |
4312 | - $filter_query = $this->getFilter($filters,true,true); |
|
4313 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4312 | + $filter_query = $this->getFilter($filters, true, true); |
|
4313 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4314 | 4314 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
4315 | 4315 | GROUP BY spotter_output.airline_country |
4316 | 4316 | ORDER BY airline_country_count DESC"; |
@@ -4321,7 +4321,7 @@ discard block |
||
4321 | 4321 | |
4322 | 4322 | $airline_array = array(); |
4323 | 4323 | $temp_array = array(); |
4324 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4324 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4325 | 4325 | { |
4326 | 4326 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4327 | 4327 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4337,11 +4337,11 @@ discard block |
||
4337 | 4337 | * @return Array the airline country list |
4338 | 4338 | * |
4339 | 4339 | */ |
4340 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
4340 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
4341 | 4341 | { |
4342 | 4342 | global $globalDBdriver; |
4343 | 4343 | //$filter_query = $this->getFilter($filters,true,true); |
4344 | - $Connection= new Connection($this->db); |
|
4344 | + $Connection = new Connection($this->db); |
|
4345 | 4345 | if (!$Connection->tableExists('countries')) return array(); |
4346 | 4346 | /* |
4347 | 4347 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -4376,7 +4376,7 @@ discard block |
||
4376 | 4376 | $flight_array = array(); |
4377 | 4377 | $temp_array = array(); |
4378 | 4378 | |
4379 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4379 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4380 | 4380 | { |
4381 | 4381 | $temp_array['flight_count'] = $row['nb']; |
4382 | 4382 | $temp_array['flight_country'] = $row['name']; |
@@ -4394,12 +4394,12 @@ discard block |
||
4394 | 4394 | * @return Array the aircraft list |
4395 | 4395 | * |
4396 | 4396 | */ |
4397 | - public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
4397 | + public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
4398 | 4398 | { |
4399 | 4399 | global $globalDBdriver; |
4400 | - $filter_query = $this->getFilter($filters,true,true); |
|
4400 | + $filter_query = $this->getFilter($filters, true, true); |
|
4401 | 4401 | |
4402 | - $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4402 | + $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4403 | 4403 | FROM spotter_output ".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> ''"; |
4404 | 4404 | if ($olderthanmonths > 0) { |
4405 | 4405 | if ($globalDBdriver == 'mysql') { |
@@ -4424,7 +4424,7 @@ discard block |
||
4424 | 4424 | |
4425 | 4425 | $aircraft_array = array(); |
4426 | 4426 | $temp_array = array(); |
4427 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4427 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4428 | 4428 | { |
4429 | 4429 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4430 | 4430 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4441,11 +4441,11 @@ discard block |
||
4441 | 4441 | * @return Array the aircraft list |
4442 | 4442 | * |
4443 | 4443 | */ |
4444 | - public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
4444 | + public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
4445 | 4445 | { |
4446 | 4446 | global $globalDBdriver; |
4447 | - $filter_query = $this->getFilter($filters,true,true); |
|
4448 | - $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4447 | + $filter_query = $this->getFilter($filters, true, true); |
|
4448 | + $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4449 | 4449 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
4450 | 4450 | if ($olderthanmonths > 0) { |
4451 | 4451 | if ($globalDBdriver == 'mysql') { |
@@ -4470,7 +4470,7 @@ discard block |
||
4470 | 4470 | |
4471 | 4471 | $aircraft_array = array(); |
4472 | 4472 | $temp_array = array(); |
4473 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4473 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4474 | 4474 | { |
4475 | 4475 | $temp_array['airline_icao'] = $row['airline_icao']; |
4476 | 4476 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4489,13 +4489,13 @@ discard block |
||
4489 | 4489 | * @return Array the aircraft list |
4490 | 4490 | * |
4491 | 4491 | */ |
4492 | - public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
|
4492 | + public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array()) |
|
4493 | 4493 | { |
4494 | 4494 | $Image = new Image($this->db); |
4495 | - $filter_query = $this->getFilter($filters,true,true); |
|
4496 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
4495 | + $filter_query = $this->getFilter($filters, true, true); |
|
4496 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
4497 | 4497 | |
4498 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4498 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4499 | 4499 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
4500 | 4500 | GROUP BY spotter_output.registration |
4501 | 4501 | ORDER BY registration_count DESC"; |
@@ -4506,14 +4506,14 @@ discard block |
||
4506 | 4506 | $aircraft_array = array(); |
4507 | 4507 | $temp_array = array(); |
4508 | 4508 | |
4509 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4509 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4510 | 4510 | { |
4511 | 4511 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4512 | 4512 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4513 | 4513 | $temp_array['registration'] = $row['registration']; |
4514 | 4514 | $temp_array['airline_name'] = $row['airline_name']; |
4515 | 4515 | $temp_array['image_thumbnail'] = ""; |
4516 | - if($row['registration'] != "") |
|
4516 | + if ($row['registration'] != "") |
|
4517 | 4517 | { |
4518 | 4518 | $image_array = $Image->getSpotterImage($row['registration']); |
4519 | 4519 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4532,11 +4532,11 @@ discard block |
||
4532 | 4532 | * @return Array the aircraft list |
4533 | 4533 | * |
4534 | 4534 | */ |
4535 | - public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
|
4535 | + public function countAllAircraftTypesByAirline($airline_icao, $filters = array()) |
|
4536 | 4536 | { |
4537 | - $filter_query = $this->getFilter($filters,true,true); |
|
4538 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
4539 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4537 | + $filter_query = $this->getFilter($filters, true, true); |
|
4538 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
4539 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4540 | 4540 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao |
4541 | 4541 | GROUP BY spotter_output.aircraft_name |
4542 | 4542 | ORDER BY aircraft_icao_count DESC"; |
@@ -4547,7 +4547,7 @@ discard block |
||
4547 | 4547 | $aircraft_array = array(); |
4548 | 4548 | $temp_array = array(); |
4549 | 4549 | |
4550 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4550 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4551 | 4551 | { |
4552 | 4552 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4553 | 4553 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4565,13 +4565,13 @@ discard block |
||
4565 | 4565 | * @return Array the aircraft list |
4566 | 4566 | * |
4567 | 4567 | */ |
4568 | - public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
|
4568 | + public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array()) |
|
4569 | 4569 | { |
4570 | - $filter_query = $this->getFilter($filters,true,true); |
|
4570 | + $filter_query = $this->getFilter($filters, true, true); |
|
4571 | 4571 | $Image = new Image($this->db); |
4572 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
4572 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
4573 | 4573 | |
4574 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4574 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4575 | 4575 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao |
4576 | 4576 | GROUP BY spotter_output.registration |
4577 | 4577 | ORDER BY registration_count DESC"; |
@@ -4581,14 +4581,14 @@ discard block |
||
4581 | 4581 | |
4582 | 4582 | $aircraft_array = array(); |
4583 | 4583 | $temp_array = array(); |
4584 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4584 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4585 | 4585 | { |
4586 | 4586 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4587 | 4587 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4588 | 4588 | $temp_array['registration'] = $row['registration']; |
4589 | 4589 | $temp_array['airline_name'] = $row['airline_name']; |
4590 | 4590 | $temp_array['image_thumbnail'] = ""; |
4591 | - if($row['registration'] != "") |
|
4591 | + if ($row['registration'] != "") |
|
4592 | 4592 | { |
4593 | 4593 | $image_array = $Image->getSpotterImage($row['registration']); |
4594 | 4594 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4607,11 +4607,11 @@ discard block |
||
4607 | 4607 | * @return Array the aircraft list |
4608 | 4608 | * |
4609 | 4609 | */ |
4610 | - public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
|
4610 | + public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array()) |
|
4611 | 4611 | { |
4612 | - $filter_query = $this->getFilter($filters,true,true); |
|
4613 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
4614 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4612 | + $filter_query = $this->getFilter($filters, true, true); |
|
4613 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
4614 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4615 | 4615 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao |
4616 | 4616 | GROUP BY spotter_output.aircraft_manufacturer |
4617 | 4617 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4622,7 +4622,7 @@ discard block |
||
4622 | 4622 | $aircraft_array = array(); |
4623 | 4623 | $temp_array = array(); |
4624 | 4624 | |
4625 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4625 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4626 | 4626 | { |
4627 | 4627 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
4628 | 4628 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4639,12 +4639,12 @@ discard block |
||
4639 | 4639 | * @return Array the aircraft list |
4640 | 4640 | * |
4641 | 4641 | */ |
4642 | - public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
|
4642 | + public function countAllAircraftTypesByAirport($airport_icao, $filters = array()) |
|
4643 | 4643 | { |
4644 | - $filter_query = $this->getFilter($filters,true,true); |
|
4645 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
4644 | + $filter_query = $this->getFilter($filters, true, true); |
|
4645 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
4646 | 4646 | |
4647 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4647 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4648 | 4648 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
4649 | 4649 | GROUP BY spotter_output.aircraft_name |
4650 | 4650 | ORDER BY aircraft_icao_count DESC"; |
@@ -4654,7 +4654,7 @@ discard block |
||
4654 | 4654 | |
4655 | 4655 | $aircraft_array = array(); |
4656 | 4656 | $temp_array = array(); |
4657 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4657 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4658 | 4658 | { |
4659 | 4659 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4660 | 4660 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4672,13 +4672,13 @@ discard block |
||
4672 | 4672 | * @return Array the aircraft list |
4673 | 4673 | * |
4674 | 4674 | */ |
4675 | - public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
|
4675 | + public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array()) |
|
4676 | 4676 | { |
4677 | - $filter_query = $this->getFilter($filters,true,true); |
|
4677 | + $filter_query = $this->getFilter($filters, true, true); |
|
4678 | 4678 | $Image = new Image($this->db); |
4679 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
4679 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
4680 | 4680 | |
4681 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4681 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4682 | 4682 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
4683 | 4683 | GROUP BY spotter_output.registration |
4684 | 4684 | ORDER BY registration_count DESC"; |
@@ -4689,14 +4689,14 @@ discard block |
||
4689 | 4689 | |
4690 | 4690 | $aircraft_array = array(); |
4691 | 4691 | $temp_array = array(); |
4692 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4692 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4693 | 4693 | { |
4694 | 4694 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4695 | 4695 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4696 | 4696 | $temp_array['registration'] = $row['registration']; |
4697 | 4697 | $temp_array['airline_name'] = $row['airline_name']; |
4698 | 4698 | $temp_array['image_thumbnail'] = ""; |
4699 | - if($row['registration'] != "") |
|
4699 | + if ($row['registration'] != "") |
|
4700 | 4700 | { |
4701 | 4701 | $image_array = $Image->getSpotterImage($row['registration']); |
4702 | 4702 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4714,11 +4714,11 @@ discard block |
||
4714 | 4714 | * @return Array the aircraft list |
4715 | 4715 | * |
4716 | 4716 | */ |
4717 | - public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
|
4717 | + public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array()) |
|
4718 | 4718 | { |
4719 | - $filter_query = $this->getFilter($filters,true,true); |
|
4720 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
4721 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4719 | + $filter_query = $this->getFilter($filters, true, true); |
|
4720 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
4721 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4722 | 4722 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
4723 | 4723 | GROUP BY spotter_output.aircraft_manufacturer |
4724 | 4724 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4729,7 +4729,7 @@ discard block |
||
4729 | 4729 | |
4730 | 4730 | $aircraft_array = array(); |
4731 | 4731 | $temp_array = array(); |
4732 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4732 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4733 | 4733 | { |
4734 | 4734 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
4735 | 4735 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4744,12 +4744,12 @@ discard block |
||
4744 | 4744 | * @return Array the aircraft list |
4745 | 4745 | * |
4746 | 4746 | */ |
4747 | - public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
4747 | + public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
4748 | 4748 | { |
4749 | - $filter_query = $this->getFilter($filters,true,true); |
|
4750 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
4749 | + $filter_query = $this->getFilter($filters, true, true); |
|
4750 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
4751 | 4751 | |
4752 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4752 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4753 | 4753 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
4754 | 4754 | GROUP BY spotter_output.aircraft_name |
4755 | 4755 | ORDER BY aircraft_icao_count DESC"; |
@@ -4758,7 +4758,7 @@ discard block |
||
4758 | 4758 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
4759 | 4759 | $aircraft_array = array(); |
4760 | 4760 | $temp_array = array(); |
4761 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4761 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4762 | 4762 | { |
4763 | 4763 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4764 | 4764 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4777,11 +4777,11 @@ discard block |
||
4777 | 4777 | */ |
4778 | 4778 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
4779 | 4779 | { |
4780 | - $filter_query = $this->getFilter($filters,true,true); |
|
4780 | + $filter_query = $this->getFilter($filters, true, true); |
|
4781 | 4781 | $Image = new Image($this->db); |
4782 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
4782 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
4783 | 4783 | |
4784 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4784 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4785 | 4785 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
4786 | 4786 | GROUP BY spotter_output.registration |
4787 | 4787 | ORDER BY registration_count DESC"; |
@@ -4791,14 +4791,14 @@ discard block |
||
4791 | 4791 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
4792 | 4792 | $aircraft_array = array(); |
4793 | 4793 | $temp_array = array(); |
4794 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4794 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4795 | 4795 | { |
4796 | 4796 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4797 | 4797 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4798 | 4798 | $temp_array['registration'] = $row['registration']; |
4799 | 4799 | $temp_array['airline_name'] = $row['airline_name']; |
4800 | 4800 | $temp_array['image_thumbnail'] = ""; |
4801 | - if($row['registration'] != "") |
|
4801 | + if ($row['registration'] != "") |
|
4802 | 4802 | { |
4803 | 4803 | $image_array = $Image->getSpotterImage($row['registration']); |
4804 | 4804 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4815,11 +4815,11 @@ discard block |
||
4815 | 4815 | * @return Array the aircraft list |
4816 | 4816 | * |
4817 | 4817 | */ |
4818 | - public function countAllAircraftTypesByDate($date,$filters = array()) |
|
4818 | + public function countAllAircraftTypesByDate($date, $filters = array()) |
|
4819 | 4819 | { |
4820 | 4820 | global $globalTimezone, $globalDBdriver; |
4821 | - $filter_query = $this->getFilter($filters,true,true); |
|
4822 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4821 | + $filter_query = $this->getFilter($filters, true, true); |
|
4822 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4823 | 4823 | if ($globalTimezone != '') { |
4824 | 4824 | date_default_timezone_set($globalTimezone); |
4825 | 4825 | $datetime = new DateTime($date); |
@@ -4827,12 +4827,12 @@ discard block |
||
4827 | 4827 | } else $offset = '+00:00'; |
4828 | 4828 | |
4829 | 4829 | if ($globalDBdriver == 'mysql') { |
4830 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4830 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4831 | 4831 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4832 | 4832 | GROUP BY spotter_output.aircraft_name |
4833 | 4833 | ORDER BY aircraft_icao_count DESC"; |
4834 | 4834 | } else { |
4835 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4835 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4836 | 4836 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4837 | 4837 | GROUP BY spotter_output.aircraft_name |
4838 | 4838 | ORDER BY aircraft_icao_count DESC"; |
@@ -4843,7 +4843,7 @@ discard block |
||
4843 | 4843 | |
4844 | 4844 | $aircraft_array = array(); |
4845 | 4845 | $temp_array = array(); |
4846 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4846 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4847 | 4847 | { |
4848 | 4848 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4849 | 4849 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4861,12 +4861,12 @@ discard block |
||
4861 | 4861 | * @return Array the aircraft list |
4862 | 4862 | * |
4863 | 4863 | */ |
4864 | - public function countAllAircraftRegistrationByDate($date,$filters = array()) |
|
4864 | + public function countAllAircraftRegistrationByDate($date, $filters = array()) |
|
4865 | 4865 | { |
4866 | 4866 | global $globalTimezone, $globalDBdriver; |
4867 | - $filter_query = $this->getFilter($filters,true,true); |
|
4867 | + $filter_query = $this->getFilter($filters, true, true); |
|
4868 | 4868 | $Image = new Image($this->db); |
4869 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4869 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4870 | 4870 | if ($globalTimezone != '') { |
4871 | 4871 | date_default_timezone_set($globalTimezone); |
4872 | 4872 | $datetime = new DateTime($date); |
@@ -4874,12 +4874,12 @@ discard block |
||
4874 | 4874 | } else $offset = '+00:00'; |
4875 | 4875 | |
4876 | 4876 | if ($globalDBdriver == 'mysql') { |
4877 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4877 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4878 | 4878 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4879 | 4879 | GROUP BY spotter_output.registration |
4880 | 4880 | ORDER BY registration_count DESC"; |
4881 | 4881 | } else { |
4882 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4882 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4883 | 4883 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4884 | 4884 | GROUP BY spotter_output.registration |
4885 | 4885 | ORDER BY registration_count DESC"; |
@@ -4890,14 +4890,14 @@ discard block |
||
4890 | 4890 | |
4891 | 4891 | $aircraft_array = array(); |
4892 | 4892 | $temp_array = array(); |
4893 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4893 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4894 | 4894 | { |
4895 | 4895 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4896 | 4896 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4897 | 4897 | $temp_array['registration'] = $row['registration']; |
4898 | 4898 | $temp_array['airline_name'] = $row['airline_name']; |
4899 | 4899 | $temp_array['image_thumbnail'] = ""; |
4900 | - if($row['registration'] != "") |
|
4900 | + if ($row['registration'] != "") |
|
4901 | 4901 | { |
4902 | 4902 | $image_array = $Image->getSpotterImage($row['registration']); |
4903 | 4903 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4916,11 +4916,11 @@ discard block |
||
4916 | 4916 | * @return Array the aircraft manufacturer list |
4917 | 4917 | * |
4918 | 4918 | */ |
4919 | - public function countAllAircraftManufacturerByDate($date,$filters = array()) |
|
4919 | + public function countAllAircraftManufacturerByDate($date, $filters = array()) |
|
4920 | 4920 | { |
4921 | 4921 | global $globalTimezone, $globalDBdriver; |
4922 | - $filter_query = $this->getFilter($filters,true,true); |
|
4923 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4922 | + $filter_query = $this->getFilter($filters, true, true); |
|
4923 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4924 | 4924 | if ($globalTimezone != '') { |
4925 | 4925 | date_default_timezone_set($globalTimezone); |
4926 | 4926 | $datetime = new DateTime($date); |
@@ -4928,12 +4928,12 @@ discard block |
||
4928 | 4928 | } else $offset = '+00:00'; |
4929 | 4929 | |
4930 | 4930 | if ($globalDBdriver == 'mysql') { |
4931 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4931 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4932 | 4932 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4933 | 4933 | GROUP BY spotter_output.aircraft_manufacturer |
4934 | 4934 | ORDER BY aircraft_manufacturer_count DESC"; |
4935 | 4935 | } else { |
4936 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4936 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4937 | 4937 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4938 | 4938 | GROUP BY spotter_output.aircraft_manufacturer |
4939 | 4939 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4945,7 +4945,7 @@ discard block |
||
4945 | 4945 | $aircraft_array = array(); |
4946 | 4946 | $temp_array = array(); |
4947 | 4947 | |
4948 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4948 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4949 | 4949 | { |
4950 | 4950 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
4951 | 4951 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4962,11 +4962,11 @@ discard block |
||
4962 | 4962 | * @return Array the aircraft list |
4963 | 4963 | * |
4964 | 4964 | */ |
4965 | - public function countAllAircraftTypesByIdent($ident,$filters = array()) |
|
4965 | + public function countAllAircraftTypesByIdent($ident, $filters = array()) |
|
4966 | 4966 | { |
4967 | - $filter_query = $this->getFilter($filters,true,true); |
|
4968 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
4969 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4967 | + $filter_query = $this->getFilter($filters, true, true); |
|
4968 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
4969 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4970 | 4970 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
4971 | 4971 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
4972 | 4972 | ORDER BY aircraft_icao_count DESC"; |
@@ -4977,7 +4977,7 @@ discard block |
||
4977 | 4977 | $aircraft_array = array(); |
4978 | 4978 | $temp_array = array(); |
4979 | 4979 | |
4980 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4980 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4981 | 4981 | { |
4982 | 4982 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4983 | 4983 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4995,13 +4995,13 @@ discard block |
||
4995 | 4995 | * @return Array the aircraft list |
4996 | 4996 | * |
4997 | 4997 | */ |
4998 | - public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
|
4998 | + public function countAllAircraftRegistrationByIdent($ident, $filters = array()) |
|
4999 | 4999 | { |
5000 | - $filter_query = $this->getFilter($filters,true,true); |
|
5000 | + $filter_query = $this->getFilter($filters, true, true); |
|
5001 | 5001 | $Image = new Image($this->db); |
5002 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
5002 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
5003 | 5003 | |
5004 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5004 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5005 | 5005 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident |
5006 | 5006 | GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
5007 | 5007 | ORDER BY registration_count DESC"; |
@@ -5013,14 +5013,14 @@ discard block |
||
5013 | 5013 | $aircraft_array = array(); |
5014 | 5014 | $temp_array = array(); |
5015 | 5015 | |
5016 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5016 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5017 | 5017 | { |
5018 | 5018 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5019 | 5019 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5020 | 5020 | $temp_array['registration'] = $row['registration']; |
5021 | 5021 | $temp_array['airline_name'] = $row['airline_name']; |
5022 | 5022 | $temp_array['image_thumbnail'] = ""; |
5023 | - if($row['registration'] != "") |
|
5023 | + if ($row['registration'] != "") |
|
5024 | 5024 | { |
5025 | 5025 | $image_array = $Image->getSpotterImage($row['registration']); |
5026 | 5026 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5039,11 +5039,11 @@ discard block |
||
5039 | 5039 | * @return Array the aircraft manufacturer list |
5040 | 5040 | * |
5041 | 5041 | */ |
5042 | - public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
|
5042 | + public function countAllAircraftManufacturerByIdent($ident, $filters = array()) |
|
5043 | 5043 | { |
5044 | - $filter_query = $this->getFilter($filters,true,true); |
|
5045 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
5046 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5044 | + $filter_query = $this->getFilter($filters, true, true); |
|
5045 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
5046 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5047 | 5047 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident |
5048 | 5048 | GROUP BY spotter_output.aircraft_manufacturer |
5049 | 5049 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5053,7 +5053,7 @@ discard block |
||
5053 | 5053 | $sth->execute(array(':ident' => $ident)); |
5054 | 5054 | $aircraft_array = array(); |
5055 | 5055 | $temp_array = array(); |
5056 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5056 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5057 | 5057 | { |
5058 | 5058 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5059 | 5059 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5069,24 +5069,24 @@ discard block |
||
5069 | 5069 | * @return Array the aircraft list |
5070 | 5070 | * |
5071 | 5071 | */ |
5072 | - public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
5072 | + public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
5073 | 5073 | { |
5074 | - $filter_query = $this->getFilter($filters,true,true); |
|
5075 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
5076 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
5074 | + $filter_query = $this->getFilter($filters, true, true); |
|
5075 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
5076 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
5077 | 5077 | |
5078 | 5078 | |
5079 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5079 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5080 | 5080 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
5081 | 5081 | GROUP BY spotter_output.aircraft_name |
5082 | 5082 | ORDER BY aircraft_icao_count DESC"; |
5083 | 5083 | |
5084 | 5084 | |
5085 | 5085 | $sth = $this->db->prepare($query); |
5086 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
5086 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
5087 | 5087 | $aircraft_array = array(); |
5088 | 5088 | $temp_array = array(); |
5089 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5089 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5090 | 5090 | { |
5091 | 5091 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5092 | 5092 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5102,33 +5102,33 @@ discard block |
||
5102 | 5102 | * @return Array the aircraft list |
5103 | 5103 | * |
5104 | 5104 | */ |
5105 | - public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
5105 | + public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
5106 | 5106 | { |
5107 | - $filter_query = $this->getFilter($filters,true,true); |
|
5107 | + $filter_query = $this->getFilter($filters, true, true); |
|
5108 | 5108 | $Image = new Image($this->db); |
5109 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
5110 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
5109 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
5110 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
5111 | 5111 | |
5112 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5112 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5113 | 5113 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
5114 | 5114 | GROUP BY spotter_output.registration |
5115 | 5115 | ORDER BY registration_count DESC"; |
5116 | 5116 | |
5117 | 5117 | |
5118 | 5118 | $sth = $this->db->prepare($query); |
5119 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
5119 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
5120 | 5120 | |
5121 | 5121 | $aircraft_array = array(); |
5122 | 5122 | $temp_array = array(); |
5123 | 5123 | |
5124 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5124 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5125 | 5125 | { |
5126 | 5126 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5127 | 5127 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5128 | 5128 | $temp_array['registration'] = $row['registration']; |
5129 | 5129 | $temp_array['airline_name'] = $row['airline_name']; |
5130 | 5130 | $temp_array['image_thumbnail'] = ""; |
5131 | - if($row['registration'] != "") |
|
5131 | + if ($row['registration'] != "") |
|
5132 | 5132 | { |
5133 | 5133 | $image_array = $Image->getSpotterImage($row['registration']); |
5134 | 5134 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5148,25 +5148,25 @@ discard block |
||
5148 | 5148 | * @return Array the aircraft manufacturer list |
5149 | 5149 | * |
5150 | 5150 | */ |
5151 | - public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
5151 | + public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
5152 | 5152 | { |
5153 | - $filter_query = $this->getFilter($filters,true,true); |
|
5154 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
5155 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
5153 | + $filter_query = $this->getFilter($filters, true, true); |
|
5154 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
5155 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
5156 | 5156 | |
5157 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5157 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5158 | 5158 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
5159 | 5159 | GROUP BY spotter_output.aircraft_manufacturer |
5160 | 5160 | ORDER BY aircraft_manufacturer_count DESC"; |
5161 | 5161 | |
5162 | 5162 | |
5163 | 5163 | $sth = $this->db->prepare($query); |
5164 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
5164 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
5165 | 5165 | |
5166 | 5166 | $aircraft_array = array(); |
5167 | 5167 | $temp_array = array(); |
5168 | 5168 | |
5169 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5169 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5170 | 5170 | { |
5171 | 5171 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5172 | 5172 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5186,11 +5186,11 @@ discard block |
||
5186 | 5186 | * @return Array the aircraft list |
5187 | 5187 | * |
5188 | 5188 | */ |
5189 | - public function countAllAircraftTypesByCountry($country,$filters = array()) |
|
5189 | + public function countAllAircraftTypesByCountry($country, $filters = array()) |
|
5190 | 5190 | { |
5191 | - $filter_query = $this->getFilter($filters,true,true); |
|
5192 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
5193 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5191 | + $filter_query = $this->getFilter($filters, true, true); |
|
5192 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
5193 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5194 | 5194 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
5195 | 5195 | GROUP BY spotter_output.aircraft_name |
5196 | 5196 | ORDER BY aircraft_icao_count DESC"; |
@@ -5202,7 +5202,7 @@ discard block |
||
5202 | 5202 | $aircraft_array = array(); |
5203 | 5203 | $temp_array = array(); |
5204 | 5204 | |
5205 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5205 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5206 | 5206 | { |
5207 | 5207 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5208 | 5208 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5221,12 +5221,12 @@ discard block |
||
5221 | 5221 | * @return Array the aircraft list |
5222 | 5222 | * |
5223 | 5223 | */ |
5224 | - public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
|
5224 | + public function countAllAircraftRegistrationByCountry($country, $filters = array()) |
|
5225 | 5225 | { |
5226 | - $filter_query = $this->getFilter($filters,true,true); |
|
5226 | + $filter_query = $this->getFilter($filters, true, true); |
|
5227 | 5227 | $Image = new Image($this->db); |
5228 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
5229 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5228 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
5229 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5230 | 5230 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
5231 | 5231 | GROUP BY spotter_output.registration |
5232 | 5232 | ORDER BY registration_count DESC"; |
@@ -5238,14 +5238,14 @@ discard block |
||
5238 | 5238 | $aircraft_array = array(); |
5239 | 5239 | $temp_array = array(); |
5240 | 5240 | |
5241 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5241 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5242 | 5242 | { |
5243 | 5243 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5244 | 5244 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5245 | 5245 | $temp_array['registration'] = $row['registration']; |
5246 | 5246 | $temp_array['airline_name'] = $row['airline_name']; |
5247 | 5247 | $temp_array['image_thumbnail'] = ""; |
5248 | - if($row['registration'] != "") |
|
5248 | + if ($row['registration'] != "") |
|
5249 | 5249 | { |
5250 | 5250 | $image_array = $Image->getSpotterImage($row['registration']); |
5251 | 5251 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5265,11 +5265,11 @@ discard block |
||
5265 | 5265 | * @return Array the aircraft manufacturer list |
5266 | 5266 | * |
5267 | 5267 | */ |
5268 | - public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
|
5268 | + public function countAllAircraftManufacturerByCountry($country, $filters = array()) |
|
5269 | 5269 | { |
5270 | - $filter_query = $this->getFilter($filters,true,true); |
|
5271 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
5272 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5270 | + $filter_query = $this->getFilter($filters, true, true); |
|
5271 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
5272 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5273 | 5273 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
5274 | 5274 | GROUP BY spotter_output.aircraft_manufacturer |
5275 | 5275 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5281,7 +5281,7 @@ discard block |
||
5281 | 5281 | $aircraft_array = array(); |
5282 | 5282 | $temp_array = array(); |
5283 | 5283 | |
5284 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5284 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5285 | 5285 | { |
5286 | 5286 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5287 | 5287 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5302,8 +5302,8 @@ discard block |
||
5302 | 5302 | */ |
5303 | 5303 | public function countAllAircraftManufacturers($filters = array()) |
5304 | 5304 | { |
5305 | - $filter_query = $this->getFilter($filters,true,true); |
|
5306 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5305 | + $filter_query = $this->getFilter($filters, true, true); |
|
5306 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5307 | 5307 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
5308 | 5308 | $query .= " GROUP BY spotter_output.aircraft_manufacturer |
5309 | 5309 | ORDER BY aircraft_manufacturer_count DESC |
@@ -5316,7 +5316,7 @@ discard block |
||
5316 | 5316 | $manufacturer_array = array(); |
5317 | 5317 | $temp_array = array(); |
5318 | 5318 | |
5319 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5319 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5320 | 5320 | { |
5321 | 5321 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5322 | 5322 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5335,12 +5335,12 @@ discard block |
||
5335 | 5335 | * @return Array the aircraft list |
5336 | 5336 | * |
5337 | 5337 | */ |
5338 | - public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
5338 | + public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5339 | 5339 | { |
5340 | 5340 | global $globalDBdriver; |
5341 | 5341 | $Image = new Image($this->db); |
5342 | - $filter_query = $this->getFilter($filters,true,true); |
|
5343 | - $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
5342 | + $filter_query = $this->getFilter($filters, true, true); |
|
5343 | + $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
5344 | 5344 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
5345 | 5345 | if ($olderthanmonths > 0) { |
5346 | 5346 | if ($globalDBdriver == 'mysql') { |
@@ -5368,7 +5368,7 @@ discard block |
||
5368 | 5368 | $aircraft_array = array(); |
5369 | 5369 | $temp_array = array(); |
5370 | 5370 | |
5371 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5371 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5372 | 5372 | { |
5373 | 5373 | $temp_array['registration'] = $row['registration']; |
5374 | 5374 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5376,7 +5376,7 @@ discard block |
||
5376 | 5376 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5377 | 5377 | $temp_array['airline_name'] = $row['airline_name']; |
5378 | 5378 | $temp_array['image_thumbnail'] = ""; |
5379 | - if($row['registration'] != "") |
|
5379 | + if ($row['registration'] != "") |
|
5380 | 5380 | { |
5381 | 5381 | $image_array = $Image->getSpotterImage($row['registration']); |
5382 | 5382 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5395,12 +5395,12 @@ discard block |
||
5395 | 5395 | * @return Array the aircraft list |
5396 | 5396 | * |
5397 | 5397 | */ |
5398 | - public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
5398 | + public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5399 | 5399 | { |
5400 | 5400 | global $globalDBdriver; |
5401 | - $filter_query = $this->getFilter($filters,true,true); |
|
5401 | + $filter_query = $this->getFilter($filters, true, true); |
|
5402 | 5402 | $Image = new Image($this->db); |
5403 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
5403 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
5404 | 5404 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
5405 | 5405 | if ($olderthanmonths > 0) { |
5406 | 5406 | if ($globalDBdriver == 'mysql') { |
@@ -5428,7 +5428,7 @@ discard block |
||
5428 | 5428 | $aircraft_array = array(); |
5429 | 5429 | $temp_array = array(); |
5430 | 5430 | |
5431 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5431 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5432 | 5432 | { |
5433 | 5433 | $temp_array['registration'] = $row['registration']; |
5434 | 5434 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5437,7 +5437,7 @@ discard block |
||
5437 | 5437 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5438 | 5438 | $temp_array['airline_name'] = $row['airline_name']; |
5439 | 5439 | $temp_array['image_thumbnail'] = ""; |
5440 | - if($row['registration'] != "") |
|
5440 | + if ($row['registration'] != "") |
|
5441 | 5441 | { |
5442 | 5442 | $image_array = $Image->getSpotterImage($row['registration']); |
5443 | 5443 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5456,11 +5456,11 @@ discard block |
||
5456 | 5456 | * @return Array the airport list |
5457 | 5457 | * |
5458 | 5458 | */ |
5459 | - public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
5459 | + public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5460 | 5460 | { |
5461 | 5461 | global $globalDBdriver; |
5462 | - $filter_query = $this->getFilter($filters,true,true); |
|
5463 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5462 | + $filter_query = $this->getFilter($filters, true, true); |
|
5463 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5464 | 5464 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
5465 | 5465 | if ($olderthanmonths > 0) { |
5466 | 5466 | if ($globalDBdriver == 'mysql') { |
@@ -5489,7 +5489,7 @@ discard block |
||
5489 | 5489 | $airport_array = array(); |
5490 | 5490 | $temp_array = array(); |
5491 | 5491 | |
5492 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5492 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5493 | 5493 | { |
5494 | 5494 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5495 | 5495 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5508,11 +5508,11 @@ discard block |
||
5508 | 5508 | * @return Array the airport list |
5509 | 5509 | * |
5510 | 5510 | */ |
5511 | - public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
5511 | + public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5512 | 5512 | { |
5513 | 5513 | global $globalDBdriver; |
5514 | - $filter_query = $this->getFilter($filters,true,true); |
|
5515 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5514 | + $filter_query = $this->getFilter($filters, true, true); |
|
5515 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5516 | 5516 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' "; |
5517 | 5517 | if ($olderthanmonths > 0) { |
5518 | 5518 | if ($globalDBdriver == 'mysql') { |
@@ -5541,7 +5541,7 @@ discard block |
||
5541 | 5541 | $airport_array = array(); |
5542 | 5542 | $temp_array = array(); |
5543 | 5543 | |
5544 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5544 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5545 | 5545 | { |
5546 | 5546 | $temp_array['airline_icao'] = $row['airline_icao']; |
5547 | 5547 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5561,11 +5561,11 @@ discard block |
||
5561 | 5561 | * @return Array the airport list |
5562 | 5562 | * |
5563 | 5563 | */ |
5564 | - public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
5564 | + public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5565 | 5565 | { |
5566 | 5566 | global $globalDBdriver; |
5567 | - $filter_query = $this->getFilter($filters,true,true); |
|
5568 | - $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
5567 | + $filter_query = $this->getFilter($filters, true, true); |
|
5568 | + $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
5569 | 5569 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
5570 | 5570 | if ($olderthanmonths > 0) { |
5571 | 5571 | if ($globalDBdriver == 'mysql') { |
@@ -5593,7 +5593,7 @@ discard block |
||
5593 | 5593 | $airport_array = array(); |
5594 | 5594 | $temp_array = array(); |
5595 | 5595 | |
5596 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5596 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5597 | 5597 | { |
5598 | 5598 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5599 | 5599 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5612,11 +5612,11 @@ discard block |
||
5612 | 5612 | * @return Array the airport list |
5613 | 5613 | * |
5614 | 5614 | */ |
5615 | - public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
5615 | + public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5616 | 5616 | { |
5617 | 5617 | global $globalDBdriver; |
5618 | - $filter_query = $this->getFilter($filters,true,true); |
|
5619 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
5618 | + $filter_query = $this->getFilter($filters, true, true); |
|
5619 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
5620 | 5620 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
5621 | 5621 | if ($olderthanmonths > 0) { |
5622 | 5622 | if ($globalDBdriver == 'mysql') { |
@@ -5645,7 +5645,7 @@ discard block |
||
5645 | 5645 | $airport_array = array(); |
5646 | 5646 | $temp_array = array(); |
5647 | 5647 | |
5648 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5648 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5649 | 5649 | { |
5650 | 5650 | $temp_array['airline_icao'] = $row['airline_icao']; |
5651 | 5651 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5665,11 +5665,11 @@ discard block |
||
5665 | 5665 | * @return Array the airport list |
5666 | 5666 | * |
5667 | 5667 | */ |
5668 | - public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
|
5668 | + public function countAllDepartureAirportsByAirline($airline_icao, $filters = array()) |
|
5669 | 5669 | { |
5670 | - $filter_query = $this->getFilter($filters,true,true); |
|
5671 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
5672 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5670 | + $filter_query = $this->getFilter($filters, true, true); |
|
5671 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
5672 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5673 | 5673 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao |
5674 | 5674 | GROUP BY spotter_output.departure_airport_icao |
5675 | 5675 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5681,7 +5681,7 @@ discard block |
||
5681 | 5681 | $airport_array = array(); |
5682 | 5682 | $temp_array = array(); |
5683 | 5683 | |
5684 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5684 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5685 | 5685 | { |
5686 | 5686 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5687 | 5687 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5703,11 +5703,11 @@ discard block |
||
5703 | 5703 | * @return Array the airport list |
5704 | 5704 | * |
5705 | 5705 | */ |
5706 | - public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
|
5706 | + public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array()) |
|
5707 | 5707 | { |
5708 | - $filter_query = $this->getFilter($filters,true,true); |
|
5709 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
5710 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5708 | + $filter_query = $this->getFilter($filters, true, true); |
|
5709 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
5710 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5711 | 5711 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
5712 | 5712 | GROUP BY spotter_output.departure_airport_country |
5713 | 5713 | ORDER BY airport_departure_country_count DESC"; |
@@ -5719,7 +5719,7 @@ discard block |
||
5719 | 5719 | $airport_array = array(); |
5720 | 5720 | $temp_array = array(); |
5721 | 5721 | |
5722 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5722 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5723 | 5723 | { |
5724 | 5724 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
5725 | 5725 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5738,11 +5738,11 @@ discard block |
||
5738 | 5738 | * @return Array the airport list |
5739 | 5739 | * |
5740 | 5740 | */ |
5741 | - public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
|
5741 | + public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array()) |
|
5742 | 5742 | { |
5743 | - $filter_query = $this->getFilter($filters,true,true); |
|
5744 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
5745 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5743 | + $filter_query = $this->getFilter($filters, true, true); |
|
5744 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
5745 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5746 | 5746 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao |
5747 | 5747 | GROUP BY spotter_output.departure_airport_icao |
5748 | 5748 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5754,7 +5754,7 @@ discard block |
||
5754 | 5754 | $airport_array = array(); |
5755 | 5755 | $temp_array = array(); |
5756 | 5756 | |
5757 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5757 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5758 | 5758 | { |
5759 | 5759 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5760 | 5760 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5775,11 +5775,11 @@ discard block |
||
5775 | 5775 | * @return Array the airport list |
5776 | 5776 | * |
5777 | 5777 | */ |
5778 | - public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
5778 | + public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
5779 | 5779 | { |
5780 | - $filter_query = $this->getFilter($filters,true,true); |
|
5781 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
5782 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5780 | + $filter_query = $this->getFilter($filters, true, true); |
|
5781 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
5782 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5783 | 5783 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
5784 | 5784 | GROUP BY spotter_output.departure_airport_country |
5785 | 5785 | ORDER BY airport_departure_country_count DESC"; |
@@ -5791,7 +5791,7 @@ discard block |
||
5791 | 5791 | $airport_array = array(); |
5792 | 5792 | $temp_array = array(); |
5793 | 5793 | |
5794 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5794 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5795 | 5795 | { |
5796 | 5796 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
5797 | 5797 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5809,11 +5809,11 @@ discard block |
||
5809 | 5809 | * @return Array the airport list |
5810 | 5810 | * |
5811 | 5811 | */ |
5812 | - public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
|
5812 | + public function countAllDepartureAirportsByRegistration($registration, $filters = array()) |
|
5813 | 5813 | { |
5814 | - $filter_query = $this->getFilter($filters,true,true); |
|
5815 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
5816 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5814 | + $filter_query = $this->getFilter($filters, true, true); |
|
5815 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
5816 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5817 | 5817 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration |
5818 | 5818 | GROUP BY spotter_output.departure_airport_icao |
5819 | 5819 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5825,7 +5825,7 @@ discard block |
||
5825 | 5825 | $airport_array = array(); |
5826 | 5826 | $temp_array = array(); |
5827 | 5827 | |
5828 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5828 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5829 | 5829 | { |
5830 | 5830 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5831 | 5831 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5846,11 +5846,11 @@ discard block |
||
5846 | 5846 | * @return Array the airport list |
5847 | 5847 | * |
5848 | 5848 | */ |
5849 | - public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
|
5849 | + public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array()) |
|
5850 | 5850 | { |
5851 | - $filter_query = $this->getFilter($filters,true,true); |
|
5852 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
5853 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5851 | + $filter_query = $this->getFilter($filters, true, true); |
|
5852 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
5853 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5854 | 5854 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration |
5855 | 5855 | GROUP BY spotter_output.departure_airport_country |
5856 | 5856 | ORDER BY airport_departure_country_count DESC"; |
@@ -5862,7 +5862,7 @@ discard block |
||
5862 | 5862 | $airport_array = array(); |
5863 | 5863 | $temp_array = array(); |
5864 | 5864 | |
5865 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5865 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5866 | 5866 | { |
5867 | 5867 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
5868 | 5868 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5880,11 +5880,11 @@ discard block |
||
5880 | 5880 | * @return Array the airport list |
5881 | 5881 | * |
5882 | 5882 | */ |
5883 | - public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
|
5883 | + public function countAllDepartureAirportsByAirport($airport_icao, $filters = array()) |
|
5884 | 5884 | { |
5885 | - $filter_query = $this->getFilter($filters,true,true); |
|
5886 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
5887 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5885 | + $filter_query = $this->getFilter($filters, true, true); |
|
5886 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
5887 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5888 | 5888 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao |
5889 | 5889 | GROUP BY spotter_output.departure_airport_icao |
5890 | 5890 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5896,7 +5896,7 @@ discard block |
||
5896 | 5896 | $airport_array = array(); |
5897 | 5897 | $temp_array = array(); |
5898 | 5898 | |
5899 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5899 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5900 | 5900 | { |
5901 | 5901 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5902 | 5902 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5917,11 +5917,11 @@ discard block |
||
5917 | 5917 | * @return Array the airport list |
5918 | 5918 | * |
5919 | 5919 | */ |
5920 | - public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
|
5920 | + public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array()) |
|
5921 | 5921 | { |
5922 | - $filter_query = $this->getFilter($filters,true,true); |
|
5923 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
5924 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5922 | + $filter_query = $this->getFilter($filters, true, true); |
|
5923 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
5924 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5925 | 5925 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao |
5926 | 5926 | GROUP BY spotter_output.departure_airport_country |
5927 | 5927 | ORDER BY airport_departure_country_count DESC"; |
@@ -5933,7 +5933,7 @@ discard block |
||
5933 | 5933 | $airport_array = array(); |
5934 | 5934 | $temp_array = array(); |
5935 | 5935 | |
5936 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5936 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5937 | 5937 | { |
5938 | 5938 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
5939 | 5939 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5952,11 +5952,11 @@ discard block |
||
5952 | 5952 | * @return Array the airport list |
5953 | 5953 | * |
5954 | 5954 | */ |
5955 | - public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
5955 | + public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
5956 | 5956 | { |
5957 | - $filter_query = $this->getFilter($filters,true,true); |
|
5958 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
5959 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5957 | + $filter_query = $this->getFilter($filters, true, true); |
|
5958 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
5959 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5960 | 5960 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
5961 | 5961 | GROUP BY spotter_output.departure_airport_icao |
5962 | 5962 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5968,7 +5968,7 @@ discard block |
||
5968 | 5968 | $airport_array = array(); |
5969 | 5969 | $temp_array = array(); |
5970 | 5970 | |
5971 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5971 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5972 | 5972 | { |
5973 | 5973 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5974 | 5974 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5989,11 +5989,11 @@ discard block |
||
5989 | 5989 | * @return Array the airport list |
5990 | 5990 | * |
5991 | 5991 | */ |
5992 | - public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
5992 | + public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
5993 | 5993 | { |
5994 | - $filter_query = $this->getFilter($filters,true,true); |
|
5995 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
5996 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5994 | + $filter_query = $this->getFilter($filters, true, true); |
|
5995 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
5996 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5997 | 5997 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
5998 | 5998 | GROUP BY spotter_output.departure_airport_country |
5999 | 5999 | ORDER BY airport_departure_country_count DESC"; |
@@ -6005,7 +6005,7 @@ discard block |
||
6005 | 6005 | $airport_array = array(); |
6006 | 6006 | $temp_array = array(); |
6007 | 6007 | |
6008 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6008 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6009 | 6009 | { |
6010 | 6010 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6011 | 6011 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6023,11 +6023,11 @@ discard block |
||
6023 | 6023 | * @return Array the airport list |
6024 | 6024 | * |
6025 | 6025 | */ |
6026 | - public function countAllDepartureAirportsByDate($date,$filters = array()) |
|
6026 | + public function countAllDepartureAirportsByDate($date, $filters = array()) |
|
6027 | 6027 | { |
6028 | 6028 | global $globalTimezone, $globalDBdriver; |
6029 | - $filter_query = $this->getFilter($filters,true,true); |
|
6030 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
6029 | + $filter_query = $this->getFilter($filters, true, true); |
|
6030 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
6031 | 6031 | if ($globalTimezone != '') { |
6032 | 6032 | date_default_timezone_set($globalTimezone); |
6033 | 6033 | $datetime = new DateTime($date); |
@@ -6035,12 +6035,12 @@ discard block |
||
6035 | 6035 | } else $offset = '+00:00'; |
6036 | 6036 | |
6037 | 6037 | if ($globalDBdriver == 'mysql') { |
6038 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6038 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6039 | 6039 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
6040 | 6040 | GROUP BY spotter_output.departure_airport_icao |
6041 | 6041 | ORDER BY airport_departure_icao_count DESC"; |
6042 | 6042 | } else { |
6043 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6043 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6044 | 6044 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
6045 | 6045 | GROUP BY spotter_output.departure_airport_icao |
6046 | 6046 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6052,7 +6052,7 @@ discard block |
||
6052 | 6052 | $airport_array = array(); |
6053 | 6053 | $temp_array = array(); |
6054 | 6054 | |
6055 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6055 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6056 | 6056 | { |
6057 | 6057 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
6058 | 6058 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6073,11 +6073,11 @@ discard block |
||
6073 | 6073 | * @return Array the airport list |
6074 | 6074 | * |
6075 | 6075 | */ |
6076 | - public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
|
6076 | + public function countAllDepartureAirportCountriesByDate($date, $filters = array()) |
|
6077 | 6077 | { |
6078 | 6078 | global $globalTimezone, $globalDBdriver; |
6079 | - $filter_query = $this->getFilter($filters,true,true); |
|
6080 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
6079 | + $filter_query = $this->getFilter($filters, true, true); |
|
6080 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
6081 | 6081 | if ($globalTimezone != '') { |
6082 | 6082 | date_default_timezone_set($globalTimezone); |
6083 | 6083 | $datetime = new DateTime($date); |
@@ -6085,12 +6085,12 @@ discard block |
||
6085 | 6085 | } else $offset = '+00:00'; |
6086 | 6086 | |
6087 | 6087 | if ($globalDBdriver == 'mysql') { |
6088 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6088 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6089 | 6089 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
6090 | 6090 | GROUP BY spotter_output.departure_airport_country |
6091 | 6091 | ORDER BY airport_departure_country_count DESC"; |
6092 | 6092 | } else { |
6093 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6093 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6094 | 6094 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
6095 | 6095 | GROUP BY spotter_output.departure_airport_country |
6096 | 6096 | ORDER BY airport_departure_country_count DESC"; |
@@ -6102,7 +6102,7 @@ discard block |
||
6102 | 6102 | $airport_array = array(); |
6103 | 6103 | $temp_array = array(); |
6104 | 6104 | |
6105 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6105 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6106 | 6106 | { |
6107 | 6107 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6108 | 6108 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6120,11 +6120,11 @@ discard block |
||
6120 | 6120 | * @return Array the airport list |
6121 | 6121 | * |
6122 | 6122 | */ |
6123 | - public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
|
6123 | + public function countAllDepartureAirportsByIdent($ident, $filters = array()) |
|
6124 | 6124 | { |
6125 | - $filter_query = $this->getFilter($filters,true,true); |
|
6126 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
6127 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6125 | + $filter_query = $this->getFilter($filters, true, true); |
|
6126 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
6127 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6128 | 6128 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident |
6129 | 6129 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6130 | 6130 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6136,7 +6136,7 @@ discard block |
||
6136 | 6136 | $airport_array = array(); |
6137 | 6137 | $temp_array = array(); |
6138 | 6138 | |
6139 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6139 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6140 | 6140 | { |
6141 | 6141 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
6142 | 6142 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6158,11 +6158,11 @@ discard block |
||
6158 | 6158 | * @return Array the airport list |
6159 | 6159 | * |
6160 | 6160 | */ |
6161 | - public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
|
6161 | + public function countAllDepartureAirportCountriesByIdent($ident, $filters = array()) |
|
6162 | 6162 | { |
6163 | - $filter_query = $this->getFilter($filters,true,true); |
|
6164 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
6165 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6163 | + $filter_query = $this->getFilter($filters, true, true); |
|
6164 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
6165 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6166 | 6166 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident |
6167 | 6167 | GROUP BY spotter_output.departure_airport_country |
6168 | 6168 | ORDER BY airport_departure_country_count DESC"; |
@@ -6174,7 +6174,7 @@ discard block |
||
6174 | 6174 | $airport_array = array(); |
6175 | 6175 | $temp_array = array(); |
6176 | 6176 | |
6177 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6177 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6178 | 6178 | { |
6179 | 6179 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6180 | 6180 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6193,12 +6193,12 @@ discard block |
||
6193 | 6193 | * @return Array the airport list |
6194 | 6194 | * |
6195 | 6195 | */ |
6196 | - public function countAllDepartureAirportsByCountry($country,$filters = array()) |
|
6196 | + public function countAllDepartureAirportsByCountry($country, $filters = array()) |
|
6197 | 6197 | { |
6198 | - $filter_query = $this->getFilter($filters,true,true); |
|
6199 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
6198 | + $filter_query = $this->getFilter($filters, true, true); |
|
6199 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
6200 | 6200 | |
6201 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6201 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6202 | 6202 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
6203 | 6203 | GROUP BY spotter_output.departure_airport_icao |
6204 | 6204 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6210,7 +6210,7 @@ discard block |
||
6210 | 6210 | $airport_array = array(); |
6211 | 6211 | $temp_array = array(); |
6212 | 6212 | |
6213 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6213 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6214 | 6214 | { |
6215 | 6215 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
6216 | 6216 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6231,11 +6231,11 @@ discard block |
||
6231 | 6231 | * @return Array the airport list |
6232 | 6232 | * |
6233 | 6233 | */ |
6234 | - public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
|
6234 | + public function countAllDepartureAirportCountriesByCountry($country, $filters = array()) |
|
6235 | 6235 | { |
6236 | - $filter_query = $this->getFilter($filters,true,true); |
|
6237 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
6238 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6236 | + $filter_query = $this->getFilter($filters, true, true); |
|
6237 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
6238 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6239 | 6239 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
6240 | 6240 | GROUP BY spotter_output.departure_airport_country |
6241 | 6241 | ORDER BY airport_departure_country_count DESC"; |
@@ -6247,7 +6247,7 @@ discard block |
||
6247 | 6247 | $airport_array = array(); |
6248 | 6248 | $temp_array = array(); |
6249 | 6249 | |
6250 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6250 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6251 | 6251 | { |
6252 | 6252 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6253 | 6253 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6265,11 +6265,11 @@ discard block |
||
6265 | 6265 | * @return Array the airport list |
6266 | 6266 | * |
6267 | 6267 | */ |
6268 | - public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
6268 | + public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
6269 | 6269 | { |
6270 | 6270 | global $globalDBdriver; |
6271 | - $filter_query = $this->getFilter($filters,true,true); |
|
6272 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6271 | + $filter_query = $this->getFilter($filters, true, true); |
|
6272 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6273 | 6273 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
6274 | 6274 | if ($olderthanmonths > 0) { |
6275 | 6275 | if ($globalDBdriver == 'mysql') { |
@@ -6304,7 +6304,7 @@ discard block |
||
6304 | 6304 | $airport_array = array(); |
6305 | 6305 | $temp_array = array(); |
6306 | 6306 | |
6307 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6307 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6308 | 6308 | { |
6309 | 6309 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6310 | 6310 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6327,11 +6327,11 @@ discard block |
||
6327 | 6327 | * @return Array the airport list |
6328 | 6328 | * |
6329 | 6329 | */ |
6330 | - public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
6330 | + public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
6331 | 6331 | { |
6332 | 6332 | global $globalDBdriver; |
6333 | - $filter_query = $this->getFilter($filters,true,true); |
|
6334 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6333 | + $filter_query = $this->getFilter($filters, true, true); |
|
6334 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6335 | 6335 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' "; |
6336 | 6336 | if ($olderthanmonths > 0) { |
6337 | 6337 | if ($globalDBdriver == 'mysql') { |
@@ -6366,7 +6366,7 @@ discard block |
||
6366 | 6366 | $airport_array = array(); |
6367 | 6367 | $temp_array = array(); |
6368 | 6368 | |
6369 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6369 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6370 | 6370 | { |
6371 | 6371 | $temp_array['airline_icao'] = $row['airline_icao']; |
6372 | 6372 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
@@ -6391,11 +6391,11 @@ discard block |
||
6391 | 6391 | * @return Array the airport list |
6392 | 6392 | * |
6393 | 6393 | */ |
6394 | - public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
6394 | + public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
6395 | 6395 | { |
6396 | 6396 | global $globalDBdriver; |
6397 | - $filter_query = $this->getFilter($filters,true,true); |
|
6398 | - $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
6397 | + $filter_query = $this->getFilter($filters, true, true); |
|
6398 | + $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
6399 | 6399 | FROM spotter_output, airport".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
6400 | 6400 | if ($olderthanmonths > 0) { |
6401 | 6401 | if ($globalDBdriver == 'mysql') { |
@@ -6429,7 +6429,7 @@ discard block |
||
6429 | 6429 | $airport_array = array(); |
6430 | 6430 | $temp_array = array(); |
6431 | 6431 | |
6432 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6432 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6433 | 6433 | { |
6434 | 6434 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6435 | 6435 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6452,11 +6452,11 @@ discard block |
||
6452 | 6452 | * @return Array the airport list |
6453 | 6453 | * |
6454 | 6454 | */ |
6455 | - public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
6455 | + public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
6456 | 6456 | { |
6457 | 6457 | global $globalDBdriver; |
6458 | - $filter_query = $this->getFilter($filters,true,true); |
|
6459 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
6458 | + $filter_query = $this->getFilter($filters, true, true); |
|
6459 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
6460 | 6460 | FROM spotter_output, airport".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
6461 | 6461 | if ($olderthanmonths > 0) { |
6462 | 6462 | if ($globalDBdriver == 'mysql') { |
@@ -6491,7 +6491,7 @@ discard block |
||
6491 | 6491 | $airport_array = array(); |
6492 | 6492 | $temp_array = array(); |
6493 | 6493 | |
6494 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6494 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6495 | 6495 | { |
6496 | 6496 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6497 | 6497 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6517,9 +6517,9 @@ discard block |
||
6517 | 6517 | */ |
6518 | 6518 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
6519 | 6519 | { |
6520 | - $filter_query = $this->getFilter($filters,true,true); |
|
6521 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
6522 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6520 | + $filter_query = $this->getFilter($filters, true, true); |
|
6521 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
6522 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6523 | 6523 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao |
6524 | 6524 | GROUP BY spotter_output.arrival_airport_icao |
6525 | 6525 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6530,7 +6530,7 @@ discard block |
||
6530 | 6530 | $airport_array = array(); |
6531 | 6531 | $temp_array = array(); |
6532 | 6532 | |
6533 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6533 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6534 | 6534 | { |
6535 | 6535 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6536 | 6536 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6551,12 +6551,12 @@ discard block |
||
6551 | 6551 | * @return Array the airport list |
6552 | 6552 | * |
6553 | 6553 | */ |
6554 | - public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
|
6554 | + public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array()) |
|
6555 | 6555 | { |
6556 | - $filter_query = $this->getFilter($filters,true,true); |
|
6557 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
6556 | + $filter_query = $this->getFilter($filters, true, true); |
|
6557 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
6558 | 6558 | |
6559 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6559 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6560 | 6560 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
6561 | 6561 | GROUP BY spotter_output.arrival_airport_country |
6562 | 6562 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6568,7 +6568,7 @@ discard block |
||
6568 | 6568 | $airport_array = array(); |
6569 | 6569 | $temp_array = array(); |
6570 | 6570 | |
6571 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6571 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6572 | 6572 | { |
6573 | 6573 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6574 | 6574 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6586,11 +6586,11 @@ discard block |
||
6586 | 6586 | * @return Array the airport list |
6587 | 6587 | * |
6588 | 6588 | */ |
6589 | - public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
|
6589 | + public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array()) |
|
6590 | 6590 | { |
6591 | - $filter_query = $this->getFilter($filters,true,true); |
|
6592 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
6593 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6591 | + $filter_query = $this->getFilter($filters, true, true); |
|
6592 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
6593 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6594 | 6594 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao |
6595 | 6595 | GROUP BY spotter_output.arrival_airport_icao |
6596 | 6596 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6602,7 +6602,7 @@ discard block |
||
6602 | 6602 | $airport_array = array(); |
6603 | 6603 | $temp_array = array(); |
6604 | 6604 | |
6605 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6605 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6606 | 6606 | { |
6607 | 6607 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6608 | 6608 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6624,11 +6624,11 @@ discard block |
||
6624 | 6624 | * @return Array the airport list |
6625 | 6625 | * |
6626 | 6626 | */ |
6627 | - public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
6627 | + public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
6628 | 6628 | { |
6629 | - $filter_query = $this->getFilter($filters,true,true); |
|
6630 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
6631 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6629 | + $filter_query = $this->getFilter($filters, true, true); |
|
6630 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
6631 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6632 | 6632 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
6633 | 6633 | GROUP BY spotter_output.arrival_airport_country |
6634 | 6634 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6640,7 +6640,7 @@ discard block |
||
6640 | 6640 | $airport_array = array(); |
6641 | 6641 | $temp_array = array(); |
6642 | 6642 | |
6643 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6643 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6644 | 6644 | { |
6645 | 6645 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6646 | 6646 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6658,12 +6658,12 @@ discard block |
||
6658 | 6658 | * @return Array the airport list |
6659 | 6659 | * |
6660 | 6660 | */ |
6661 | - public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
|
6661 | + public function countAllArrivalAirportsByRegistration($registration, $filters = array()) |
|
6662 | 6662 | { |
6663 | - $filter_query = $this->getFilter($filters,true,true); |
|
6664 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
6663 | + $filter_query = $this->getFilter($filters, true, true); |
|
6664 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
6665 | 6665 | |
6666 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6666 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6667 | 6667 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration |
6668 | 6668 | GROUP BY spotter_output.arrival_airport_icao |
6669 | 6669 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6675,7 +6675,7 @@ discard block |
||
6675 | 6675 | $airport_array = array(); |
6676 | 6676 | $temp_array = array(); |
6677 | 6677 | |
6678 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6678 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6679 | 6679 | { |
6680 | 6680 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6681 | 6681 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6696,11 +6696,11 @@ discard block |
||
6696 | 6696 | * @return Array the airport list |
6697 | 6697 | * |
6698 | 6698 | */ |
6699 | - public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
|
6699 | + public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array()) |
|
6700 | 6700 | { |
6701 | - $filter_query = $this->getFilter($filters,true,true); |
|
6702 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
6703 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6701 | + $filter_query = $this->getFilter($filters, true, true); |
|
6702 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
6703 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6704 | 6704 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration |
6705 | 6705 | GROUP BY spotter_output.arrival_airport_country |
6706 | 6706 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6712,7 +6712,7 @@ discard block |
||
6712 | 6712 | $airport_array = array(); |
6713 | 6713 | $temp_array = array(); |
6714 | 6714 | |
6715 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6715 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6716 | 6716 | { |
6717 | 6717 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6718 | 6718 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6731,11 +6731,11 @@ discard block |
||
6731 | 6731 | * @return Array the airport list |
6732 | 6732 | * |
6733 | 6733 | */ |
6734 | - public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
|
6734 | + public function countAllArrivalAirportsByAirport($airport_icao, $filters = array()) |
|
6735 | 6735 | { |
6736 | - $filter_query = $this->getFilter($filters,true,true); |
|
6737 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
6738 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6736 | + $filter_query = $this->getFilter($filters, true, true); |
|
6737 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
6738 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6739 | 6739 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao |
6740 | 6740 | GROUP BY spotter_output.arrival_airport_icao |
6741 | 6741 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6747,7 +6747,7 @@ discard block |
||
6747 | 6747 | $airport_array = array(); |
6748 | 6748 | $temp_array = array(); |
6749 | 6749 | |
6750 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6750 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6751 | 6751 | { |
6752 | 6752 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6753 | 6753 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6768,11 +6768,11 @@ discard block |
||
6768 | 6768 | * @return Array the airport list |
6769 | 6769 | * |
6770 | 6770 | */ |
6771 | - public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
|
6771 | + public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array()) |
|
6772 | 6772 | { |
6773 | - $filter_query = $this->getFilter($filters,true,true); |
|
6774 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
6775 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6773 | + $filter_query = $this->getFilter($filters, true, true); |
|
6774 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
6775 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6776 | 6776 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao |
6777 | 6777 | GROUP BY spotter_output.arrival_airport_country |
6778 | 6778 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6784,7 +6784,7 @@ discard block |
||
6784 | 6784 | $airport_array = array(); |
6785 | 6785 | $temp_array = array(); |
6786 | 6786 | |
6787 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6787 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6788 | 6788 | { |
6789 | 6789 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6790 | 6790 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6802,11 +6802,11 @@ discard block |
||
6802 | 6802 | * @return Array the airport list |
6803 | 6803 | * |
6804 | 6804 | */ |
6805 | - public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
6805 | + public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
6806 | 6806 | { |
6807 | - $filter_query = $this->getFilter($filters,true,true); |
|
6808 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
6809 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6807 | + $filter_query = $this->getFilter($filters, true, true); |
|
6808 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
6809 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6810 | 6810 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
6811 | 6811 | GROUP BY spotter_output.arrival_airport_icao |
6812 | 6812 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6818,7 +6818,7 @@ discard block |
||
6818 | 6818 | $airport_array = array(); |
6819 | 6819 | $temp_array = array(); |
6820 | 6820 | |
6821 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6821 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6822 | 6822 | { |
6823 | 6823 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6824 | 6824 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6840,11 +6840,11 @@ discard block |
||
6840 | 6840 | * @return Array the airport list |
6841 | 6841 | * |
6842 | 6842 | */ |
6843 | - public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
6843 | + public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
6844 | 6844 | { |
6845 | - $filter_query = $this->getFilter($filters,true,true); |
|
6846 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
6847 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6845 | + $filter_query = $this->getFilter($filters, true, true); |
|
6846 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
6847 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6848 | 6848 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
6849 | 6849 | GROUP BY spotter_output.arrival_airport_country |
6850 | 6850 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6856,7 +6856,7 @@ discard block |
||
6856 | 6856 | $airport_array = array(); |
6857 | 6857 | $temp_array = array(); |
6858 | 6858 | |
6859 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6859 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6860 | 6860 | { |
6861 | 6861 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6862 | 6862 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6875,11 +6875,11 @@ discard block |
||
6875 | 6875 | * @return Array the airport list |
6876 | 6876 | * |
6877 | 6877 | */ |
6878 | - public function countAllArrivalAirportsByDate($date,$filters = array()) |
|
6878 | + public function countAllArrivalAirportsByDate($date, $filters = array()) |
|
6879 | 6879 | { |
6880 | 6880 | global $globalTimezone, $globalDBdriver; |
6881 | - $filter_query = $this->getFilter($filters,true,true); |
|
6882 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
6881 | + $filter_query = $this->getFilter($filters, true, true); |
|
6882 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
6883 | 6883 | if ($globalTimezone != '') { |
6884 | 6884 | date_default_timezone_set($globalTimezone); |
6885 | 6885 | $datetime = new DateTime($date); |
@@ -6887,12 +6887,12 @@ discard block |
||
6887 | 6887 | } else $offset = '+00:00'; |
6888 | 6888 | |
6889 | 6889 | if ($globalDBdriver == 'mysql') { |
6890 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6890 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6891 | 6891 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
6892 | 6892 | GROUP BY spotter_output.arrival_airport_icao |
6893 | 6893 | ORDER BY airport_arrival_icao_count DESC"; |
6894 | 6894 | } else { |
6895 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6895 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6896 | 6896 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
6897 | 6897 | GROUP BY spotter_output.arrival_airport_icao |
6898 | 6898 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6904,7 +6904,7 @@ discard block |
||
6904 | 6904 | $airport_array = array(); |
6905 | 6905 | $temp_array = array(); |
6906 | 6906 | |
6907 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6907 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6908 | 6908 | { |
6909 | 6909 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6910 | 6910 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6928,8 +6928,8 @@ discard block |
||
6928 | 6928 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
6929 | 6929 | { |
6930 | 6930 | global $globalTimezone, $globalDBdriver; |
6931 | - $filter_query = $this->getFilter($filters,true,true); |
|
6932 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
6931 | + $filter_query = $this->getFilter($filters, true, true); |
|
6932 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
6933 | 6933 | if ($globalTimezone != '') { |
6934 | 6934 | date_default_timezone_set($globalTimezone); |
6935 | 6935 | $datetime = new DateTime($date); |
@@ -6937,12 +6937,12 @@ discard block |
||
6937 | 6937 | } else $offset = '+00:00'; |
6938 | 6938 | |
6939 | 6939 | if ($globalDBdriver == 'mysql') { |
6940 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6940 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6941 | 6941 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
6942 | 6942 | GROUP BY spotter_output.arrival_airport_country |
6943 | 6943 | ORDER BY airport_arrival_country_count DESC"; |
6944 | 6944 | } else { |
6945 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6945 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6946 | 6946 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
6947 | 6947 | GROUP BY spotter_output.arrival_airport_country |
6948 | 6948 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6954,7 +6954,7 @@ discard block |
||
6954 | 6954 | $airport_array = array(); |
6955 | 6955 | $temp_array = array(); |
6956 | 6956 | |
6957 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6957 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6958 | 6958 | { |
6959 | 6959 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6960 | 6960 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6972,11 +6972,11 @@ discard block |
||
6972 | 6972 | * @return Array the airport list |
6973 | 6973 | * |
6974 | 6974 | */ |
6975 | - public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
|
6975 | + public function countAllArrivalAirportsByIdent($ident, $filters = array()) |
|
6976 | 6976 | { |
6977 | - $filter_query = $this->getFilter($filters,true,true); |
|
6978 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
6979 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6977 | + $filter_query = $this->getFilter($filters, true, true); |
|
6978 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
6979 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6980 | 6980 | FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident |
6981 | 6981 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6982 | 6982 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6988,7 +6988,7 @@ discard block |
||
6988 | 6988 | $airport_array = array(); |
6989 | 6989 | $temp_array = array(); |
6990 | 6990 | |
6991 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6991 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6992 | 6992 | { |
6993 | 6993 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6994 | 6994 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7011,9 +7011,9 @@ discard block |
||
7011 | 7011 | */ |
7012 | 7012 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
7013 | 7013 | { |
7014 | - $filter_query = $this->getFilter($filters,true,true); |
|
7015 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
7016 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7014 | + $filter_query = $this->getFilter($filters, true, true); |
|
7015 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
7016 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7017 | 7017 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident |
7018 | 7018 | GROUP BY spotter_output.arrival_airport_country |
7019 | 7019 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7025,7 +7025,7 @@ discard block |
||
7025 | 7025 | $airport_array = array(); |
7026 | 7026 | $temp_array = array(); |
7027 | 7027 | |
7028 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7028 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7029 | 7029 | { |
7030 | 7030 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
7031 | 7031 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7044,11 +7044,11 @@ discard block |
||
7044 | 7044 | * @return Array the airport list |
7045 | 7045 | * |
7046 | 7046 | */ |
7047 | - public function countAllArrivalAirportsByCountry($country,$filters = array()) |
|
7047 | + public function countAllArrivalAirportsByCountry($country, $filters = array()) |
|
7048 | 7048 | { |
7049 | - $filter_query = $this->getFilter($filters,true,true); |
|
7050 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
7051 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
7049 | + $filter_query = $this->getFilter($filters, true, true); |
|
7050 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
7051 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
7052 | 7052 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
7053 | 7053 | GROUP BY spotter_output.arrival_airport_icao |
7054 | 7054 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7060,7 +7060,7 @@ discard block |
||
7060 | 7060 | $airport_array = array(); |
7061 | 7061 | $temp_array = array(); |
7062 | 7062 | |
7063 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7063 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7064 | 7064 | { |
7065 | 7065 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
7066 | 7066 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7081,11 +7081,11 @@ discard block |
||
7081 | 7081 | * @return Array the airport list |
7082 | 7082 | * |
7083 | 7083 | */ |
7084 | - public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
|
7084 | + public function countAllArrivalAirportCountriesByCountry($country, $filters = array()) |
|
7085 | 7085 | { |
7086 | - $filter_query = $this->getFilter($filters,true,true); |
|
7087 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
7088 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7086 | + $filter_query = $this->getFilter($filters, true, true); |
|
7087 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
7088 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7089 | 7089 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
7090 | 7090 | GROUP BY spotter_output.arrival_airport_country |
7091 | 7091 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7097,7 +7097,7 @@ discard block |
||
7097 | 7097 | $airport_array = array(); |
7098 | 7098 | $temp_array = array(); |
7099 | 7099 | |
7100 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7100 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7101 | 7101 | { |
7102 | 7102 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
7103 | 7103 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7118,7 +7118,7 @@ discard block |
||
7118 | 7118 | */ |
7119 | 7119 | public function countAllDepartureCountries($filters = array()) |
7120 | 7120 | { |
7121 | - $filter_query = $this->getFilter($filters,true,true); |
|
7121 | + $filter_query = $this->getFilter($filters, true, true); |
|
7122 | 7122 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
7123 | 7123 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
7124 | 7124 | $query .= " GROUP BY spotter_output.departure_airport_country |
@@ -7132,7 +7132,7 @@ discard block |
||
7132 | 7132 | $airport_array = array(); |
7133 | 7133 | $temp_array = array(); |
7134 | 7134 | |
7135 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7135 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7136 | 7136 | { |
7137 | 7137 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
7138 | 7138 | $temp_array['airport_departure_country'] = $row['departure_airport_country']; |
@@ -7150,9 +7150,9 @@ discard block |
||
7150 | 7150 | * @return Array the airport arrival list |
7151 | 7151 | * |
7152 | 7152 | */ |
7153 | - public function countAllArrivalCountries($limit = true,$filters = array()) |
|
7153 | + public function countAllArrivalCountries($limit = true, $filters = array()) |
|
7154 | 7154 | { |
7155 | - $filter_query = $this->getFilter($filters,true,true); |
|
7155 | + $filter_query = $this->getFilter($filters, true, true); |
|
7156 | 7156 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
7157 | 7157 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
7158 | 7158 | $query .= " GROUP BY spotter_output.arrival_airport_country |
@@ -7166,7 +7166,7 @@ discard block |
||
7166 | 7166 | $airport_array = array(); |
7167 | 7167 | $temp_array = array(); |
7168 | 7168 | |
7169 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7169 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7170 | 7170 | { |
7171 | 7171 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
7172 | 7172 | $temp_array['airport_arrival_country'] = $row['arrival_airport_country']; |
@@ -7189,8 +7189,8 @@ discard block |
||
7189 | 7189 | */ |
7190 | 7190 | public function countAllRoutes($filters = array()) |
7191 | 7191 | { |
7192 | - $filter_query = $this->getFilter($filters,true,true); |
|
7193 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7192 | + $filter_query = $this->getFilter($filters, true, true); |
|
7193 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7194 | 7194 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA' |
7195 | 7195 | GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
7196 | 7196 | ORDER BY route_count DESC |
@@ -7203,7 +7203,7 @@ discard block |
||
7203 | 7203 | $routes_array = array(); |
7204 | 7204 | $temp_array = array(); |
7205 | 7205 | |
7206 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7206 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7207 | 7207 | { |
7208 | 7208 | $temp_array['route_count'] = $row['route_count']; |
7209 | 7209 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7230,11 +7230,11 @@ discard block |
||
7230 | 7230 | * @return Array the route list |
7231 | 7231 | * |
7232 | 7232 | */ |
7233 | - public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
|
7233 | + public function countAllRoutesByAircraft($aircraft_icao, $filters = array()) |
|
7234 | 7234 | { |
7235 | - $filter_query = $this->getFilter($filters,true,true); |
|
7236 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
7237 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7235 | + $filter_query = $this->getFilter($filters, true, true); |
|
7236 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
7237 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7238 | 7238 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
7239 | 7239 | GROUP BY route |
7240 | 7240 | ORDER BY route_count DESC"; |
@@ -7245,7 +7245,7 @@ discard block |
||
7245 | 7245 | $routes_array = array(); |
7246 | 7246 | $temp_array = array(); |
7247 | 7247 | |
7248 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7248 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7249 | 7249 | { |
7250 | 7250 | $temp_array['route_count'] = $row['route_count']; |
7251 | 7251 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7272,9 +7272,9 @@ discard block |
||
7272 | 7272 | */ |
7273 | 7273 | public function countAllRoutesByRegistration($registration, $filters = array()) |
7274 | 7274 | { |
7275 | - $filter_query = $this->getFilter($filters,true,true); |
|
7275 | + $filter_query = $this->getFilter($filters, true, true); |
|
7276 | 7276 | $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
7277 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7277 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7278 | 7278 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration |
7279 | 7279 | GROUP BY route |
7280 | 7280 | ORDER BY route_count DESC"; |
@@ -7286,7 +7286,7 @@ discard block |
||
7286 | 7286 | $routes_array = array(); |
7287 | 7287 | $temp_array = array(); |
7288 | 7288 | |
7289 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7289 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7290 | 7290 | { |
7291 | 7291 | $temp_array['route_count'] = $row['route_count']; |
7292 | 7292 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7314,9 +7314,9 @@ discard block |
||
7314 | 7314 | */ |
7315 | 7315 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
7316 | 7316 | { |
7317 | - $filter_query = $this->getFilter($filters,true,true); |
|
7318 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
7319 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7317 | + $filter_query = $this->getFilter($filters, true, true); |
|
7318 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
7319 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7320 | 7320 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao |
7321 | 7321 | GROUP BY route |
7322 | 7322 | ORDER BY route_count DESC"; |
@@ -7328,7 +7328,7 @@ discard block |
||
7328 | 7328 | $routes_array = array(); |
7329 | 7329 | $temp_array = array(); |
7330 | 7330 | |
7331 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7331 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7332 | 7332 | { |
7333 | 7333 | $temp_array['route_count'] = $row['route_count']; |
7334 | 7334 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7356,9 +7356,9 @@ discard block |
||
7356 | 7356 | */ |
7357 | 7357 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
7358 | 7358 | { |
7359 | - $filter_query = $this->getFilter($filters,true,true); |
|
7360 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
7361 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7359 | + $filter_query = $this->getFilter($filters, true, true); |
|
7360 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
7361 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7362 | 7362 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
7363 | 7363 | GROUP BY route |
7364 | 7364 | ORDER BY route_count DESC"; |
@@ -7369,7 +7369,7 @@ discard block |
||
7369 | 7369 | $routes_array = array(); |
7370 | 7370 | $temp_array = array(); |
7371 | 7371 | |
7372 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7372 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7373 | 7373 | { |
7374 | 7374 | $temp_array['route_count'] = $row['route_count']; |
7375 | 7375 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7397,9 +7397,9 @@ discard block |
||
7397 | 7397 | */ |
7398 | 7398 | public function countAllRoutesByCountry($country, $filters = array()) |
7399 | 7399 | { |
7400 | - $filter_query = $this->getFilter($filters,true,true); |
|
7401 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
7402 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7400 | + $filter_query = $this->getFilter($filters, true, true); |
|
7401 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
7402 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7403 | 7403 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
7404 | 7404 | GROUP BY route |
7405 | 7405 | ORDER BY route_count DESC"; |
@@ -7410,7 +7410,7 @@ discard block |
||
7410 | 7410 | $routes_array = array(); |
7411 | 7411 | $temp_array = array(); |
7412 | 7412 | |
7413 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7413 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7414 | 7414 | { |
7415 | 7415 | $temp_array['route_count'] = $row['route_count']; |
7416 | 7416 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7438,8 +7438,8 @@ discard block |
||
7438 | 7438 | public function countAllRoutesByDate($date, $filters = array()) |
7439 | 7439 | { |
7440 | 7440 | global $globalTimezone, $globalDBdriver; |
7441 | - $filter_query = $this->getFilter($filters,true,true); |
|
7442 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
7441 | + $filter_query = $this->getFilter($filters, true, true); |
|
7442 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
7443 | 7443 | if ($globalTimezone != '') { |
7444 | 7444 | date_default_timezone_set($globalTimezone); |
7445 | 7445 | $datetime = new DateTime($date); |
@@ -7447,12 +7447,12 @@ discard block |
||
7447 | 7447 | } else $offset = '+00:00'; |
7448 | 7448 | |
7449 | 7449 | if ($globalDBdriver == 'mysql') { |
7450 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7450 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7451 | 7451 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
7452 | 7452 | GROUP BY route |
7453 | 7453 | ORDER BY route_count DESC"; |
7454 | 7454 | } else { |
7455 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7455 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7456 | 7456 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
7457 | 7457 | GROUP BY route |
7458 | 7458 | ORDER BY route_count DESC"; |
@@ -7464,7 +7464,7 @@ discard block |
||
7464 | 7464 | $routes_array = array(); |
7465 | 7465 | $temp_array = array(); |
7466 | 7466 | |
7467 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7467 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7468 | 7468 | { |
7469 | 7469 | $temp_array['route_count'] = $row['route_count']; |
7470 | 7470 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7491,9 +7491,9 @@ discard block |
||
7491 | 7491 | */ |
7492 | 7492 | public function countAllRoutesByIdent($ident, $filters = array()) |
7493 | 7493 | { |
7494 | - $filter_query = $this->getFilter($filters,true,true); |
|
7495 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
7496 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7494 | + $filter_query = $this->getFilter($filters, true, true); |
|
7495 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
7496 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7497 | 7497 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident |
7498 | 7498 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7499 | 7499 | ORDER BY route_count DESC"; |
@@ -7505,7 +7505,7 @@ discard block |
||
7505 | 7505 | $routes_array = array(); |
7506 | 7506 | $temp_array = array(); |
7507 | 7507 | |
7508 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7508 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7509 | 7509 | { |
7510 | 7510 | $temp_array['route_count'] = $row['route_count']; |
7511 | 7511 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7532,9 +7532,9 @@ discard block |
||
7532 | 7532 | */ |
7533 | 7533 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
7534 | 7534 | { |
7535 | - $filter_query = $this->getFilter($filters,true,true); |
|
7536 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
7537 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7535 | + $filter_query = $this->getFilter($filters, true, true); |
|
7536 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
7537 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7538 | 7538 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
7539 | 7539 | GROUP BY route |
7540 | 7540 | ORDER BY route_count DESC"; |
@@ -7546,7 +7546,7 @@ discard block |
||
7546 | 7546 | $routes_array = array(); |
7547 | 7547 | $temp_array = array(); |
7548 | 7548 | |
7549 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7549 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7550 | 7550 | { |
7551 | 7551 | $temp_array['route_count'] = $row['route_count']; |
7552 | 7552 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7574,8 +7574,8 @@ discard block |
||
7574 | 7574 | */ |
7575 | 7575 | public function countAllRoutesWithWaypoints($filters = array()) |
7576 | 7576 | { |
7577 | - $filter_query = $this->getFilter($filters,true,true); |
|
7578 | - $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7577 | + $filter_query = $this->getFilter($filters, true, true); |
|
7578 | + $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7579 | 7579 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' |
7580 | 7580 | GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7581 | 7581 | ORDER BY route_count DESC |
@@ -7588,7 +7588,7 @@ discard block |
||
7588 | 7588 | $routes_array = array(); |
7589 | 7589 | $temp_array = array(); |
7590 | 7590 | |
7591 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7591 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7592 | 7592 | { |
7593 | 7593 | $temp_array['spotter_id'] = $row['spotter_id']; |
7594 | 7594 | $temp_array['route_count'] = $row['route_count']; |
@@ -7613,11 +7613,11 @@ discard block |
||
7613 | 7613 | * @return Array the callsign list |
7614 | 7614 | * |
7615 | 7615 | */ |
7616 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
7616 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
7617 | 7617 | { |
7618 | 7618 | global $globalDBdriver; |
7619 | - $filter_query = $this->getFilter($filters,true,true); |
|
7620 | - $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
7619 | + $filter_query = $this->getFilter($filters, true, true); |
|
7620 | + $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
7621 | 7621 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
7622 | 7622 | if ($olderthanmonths > 0) { |
7623 | 7623 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -7636,7 +7636,7 @@ discard block |
||
7636 | 7636 | $callsign_array = array(); |
7637 | 7637 | $temp_array = array(); |
7638 | 7638 | |
7639 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7639 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7640 | 7640 | { |
7641 | 7641 | $temp_array['callsign_icao'] = $row['ident']; |
7642 | 7642 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7658,8 +7658,8 @@ discard block |
||
7658 | 7658 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
7659 | 7659 | { |
7660 | 7660 | global $globalDBdriver; |
7661 | - $filter_query = $this->getFilter($filters,true,true); |
|
7662 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
7661 | + $filter_query = $this->getFilter($filters, true, true); |
|
7662 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
7663 | 7663 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
7664 | 7664 | if ($olderthanmonths > 0) { |
7665 | 7665 | if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
@@ -7678,7 +7678,7 @@ discard block |
||
7678 | 7678 | $callsign_array = array(); |
7679 | 7679 | $temp_array = array(); |
7680 | 7680 | |
7681 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7681 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7682 | 7682 | { |
7683 | 7683 | $temp_array['callsign_icao'] = $row['ident']; |
7684 | 7684 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7732,7 +7732,7 @@ discard block |
||
7732 | 7732 | $date_array = array(); |
7733 | 7733 | $temp_array = array(); |
7734 | 7734 | |
7735 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7735 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7736 | 7736 | { |
7737 | 7737 | $temp_array['date_name'] = $row['date_name']; |
7738 | 7738 | $temp_array['date_count'] = $row['date_count']; |
@@ -7757,15 +7757,15 @@ discard block |
||
7757 | 7757 | $datetime = new DateTime(); |
7758 | 7758 | $offset = $datetime->format('P'); |
7759 | 7759 | } else $offset = '+00:00'; |
7760 | - $filter_query = $this->getFilter($filters,true,true); |
|
7760 | + $filter_query = $this->getFilter($filters, true, true); |
|
7761 | 7761 | if ($globalDBdriver == 'mysql') { |
7762 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
7762 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
7763 | 7763 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
7764 | 7764 | GROUP BY spotter_output.airline_icao, date_name |
7765 | 7765 | ORDER BY date_count DESC |
7766 | 7766 | LIMIT 10 OFFSET 0"; |
7767 | 7767 | } else { |
7768 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
7768 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
7769 | 7769 | FROM spotter_output |
7770 | 7770 | WHERE spotter_output.airline_icao <> '' |
7771 | 7771 | GROUP BY spotter_output.airline_icao, date_name |
@@ -7780,7 +7780,7 @@ discard block |
||
7780 | 7780 | $date_array = array(); |
7781 | 7781 | $temp_array = array(); |
7782 | 7782 | |
7783 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7783 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7784 | 7784 | { |
7785 | 7785 | $temp_array['date_name'] = $row['date_name']; |
7786 | 7786 | $temp_array['date_count'] = $row['date_count']; |
@@ -7806,7 +7806,7 @@ discard block |
||
7806 | 7806 | $datetime = new DateTime(); |
7807 | 7807 | $offset = $datetime->format('P'); |
7808 | 7808 | } else $offset = '+00:00'; |
7809 | - $filter_query = $this->getFilter($filters,true,true); |
|
7809 | + $filter_query = $this->getFilter($filters, true, true); |
|
7810 | 7810 | if ($globalDBdriver == 'mysql') { |
7811 | 7811 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
7812 | 7812 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -7827,7 +7827,7 @@ discard block |
||
7827 | 7827 | $date_array = array(); |
7828 | 7828 | $temp_array = array(); |
7829 | 7829 | |
7830 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7830 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7831 | 7831 | { |
7832 | 7832 | $temp_array['date_name'] = $row['date_name']; |
7833 | 7833 | $temp_array['date_count'] = $row['date_count']; |
@@ -7852,7 +7852,7 @@ discard block |
||
7852 | 7852 | $datetime = new DateTime(); |
7853 | 7853 | $offset = $datetime->format('P'); |
7854 | 7854 | } else $offset = '+00:00'; |
7855 | - $filter_query = $this->getFilter($filters,true,true); |
|
7855 | + $filter_query = $this->getFilter($filters, true, true); |
|
7856 | 7856 | if ($globalDBdriver == 'mysql') { |
7857 | 7857 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
7858 | 7858 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -7873,7 +7873,7 @@ discard block |
||
7873 | 7873 | $date_array = array(); |
7874 | 7874 | $temp_array = array(); |
7875 | 7875 | |
7876 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7876 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7877 | 7877 | { |
7878 | 7878 | $temp_array['date_name'] = $row['date_name']; |
7879 | 7879 | $temp_array['date_count'] = $row['date_count']; |
@@ -7894,7 +7894,7 @@ discard block |
||
7894 | 7894 | public function countAllDatesLastMonthByAirlines($filters = array()) |
7895 | 7895 | { |
7896 | 7896 | global $globalTimezone, $globalDBdriver; |
7897 | - $filter_query = $this->getFilter($filters,true,true); |
|
7897 | + $filter_query = $this->getFilter($filters, true, true); |
|
7898 | 7898 | if ($globalTimezone != '') { |
7899 | 7899 | date_default_timezone_set($globalTimezone); |
7900 | 7900 | $datetime = new DateTime(); |
@@ -7902,13 +7902,13 @@ discard block |
||
7902 | 7902 | } else $offset = '+00:00'; |
7903 | 7903 | |
7904 | 7904 | if ($globalDBdriver == 'mysql') { |
7905 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
7905 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
7906 | 7906 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH) |
7907 | 7907 | GROUP BY spotter_output.airline_icao, date_name |
7908 | 7908 | ORDER BY spotter_output.date ASC"; |
7909 | 7909 | $query_data = array(':offset' => $offset); |
7910 | 7910 | } else { |
7911 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
7911 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
7912 | 7912 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS' |
7913 | 7913 | GROUP BY spotter_output.airline_icao, date_name |
7914 | 7914 | ORDER BY date_name ASC"; |
@@ -7921,7 +7921,7 @@ discard block |
||
7921 | 7921 | $date_array = array(); |
7922 | 7922 | $temp_array = array(); |
7923 | 7923 | |
7924 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7924 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7925 | 7925 | { |
7926 | 7926 | $temp_array['date_name'] = $row['date_name']; |
7927 | 7927 | $temp_array['date_count'] = $row['date_count']; |
@@ -7968,7 +7968,7 @@ discard block |
||
7968 | 7968 | $date_array = array(); |
7969 | 7969 | $temp_array = array(); |
7970 | 7970 | |
7971 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7971 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7972 | 7972 | { |
7973 | 7973 | $temp_array['month_name'] = $row['month_name']; |
7974 | 7974 | $temp_array['year_name'] = $row['year_name']; |
@@ -7989,7 +7989,7 @@ discard block |
||
7989 | 7989 | public function countAllMonthsByAirlines($filters = array()) |
7990 | 7990 | { |
7991 | 7991 | global $globalTimezone, $globalDBdriver; |
7992 | - $filter_query = $this->getFilter($filters,true,true); |
|
7992 | + $filter_query = $this->getFilter($filters, true, true); |
|
7993 | 7993 | if ($globalTimezone != '') { |
7994 | 7994 | date_default_timezone_set($globalTimezone); |
7995 | 7995 | $datetime = new DateTime(); |
@@ -7997,12 +7997,12 @@ discard block |
||
7997 | 7997 | } else $offset = '+00:00'; |
7998 | 7998 | |
7999 | 7999 | if ($globalDBdriver == 'mysql') { |
8000 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
8000 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
8001 | 8001 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
8002 | 8002 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8003 | 8003 | ORDER BY date_count DESC"; |
8004 | 8004 | } else { |
8005 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
8005 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
8006 | 8006 | FROM spotter_output |
8007 | 8007 | WHERE spotter_output.airline_icao <> '' |
8008 | 8008 | GROUP BY spotter_output.airline_icao, year_name, month_name |
@@ -8016,7 +8016,7 @@ discard block |
||
8016 | 8016 | $date_array = array(); |
8017 | 8017 | $temp_array = array(); |
8018 | 8018 | |
8019 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8019 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8020 | 8020 | { |
8021 | 8021 | $temp_array['month_name'] = $row['month_name']; |
8022 | 8022 | $temp_array['year_name'] = $row['year_name']; |
@@ -8043,14 +8043,14 @@ discard block |
||
8043 | 8043 | $datetime = new DateTime(); |
8044 | 8044 | $offset = $datetime->format('P'); |
8045 | 8045 | } else $offset = '+00:00'; |
8046 | - $filter_query = $this->getFilter($filters,true,true); |
|
8046 | + $filter_query = $this->getFilter($filters, true, true); |
|
8047 | 8047 | if ($globalDBdriver == 'mysql') { |
8048 | - $query = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
8048 | + $query = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
8049 | 8049 | FROM spotter_output s".$filter_query." s.airline_type = 'military' |
8050 | 8050 | GROUP BY year_name, month_name |
8051 | 8051 | ORDER BY date_count DESC"; |
8052 | 8052 | } else { |
8053 | - $query = "SELECT EXTRACT(YEAR FROM s.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM s.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
8053 | + $query = "SELECT EXTRACT(YEAR FROM s.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM s.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
8054 | 8054 | FROM spotter_output s".$filter_query." s.airline_type = 'military' |
8055 | 8055 | GROUP BY year_name, month_name |
8056 | 8056 | ORDER BY date_count DESC"; |
@@ -8062,7 +8062,7 @@ discard block |
||
8062 | 8062 | $date_array = array(); |
8063 | 8063 | $temp_array = array(); |
8064 | 8064 | |
8065 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8065 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8066 | 8066 | { |
8067 | 8067 | $temp_array['month_name'] = $row['month_name']; |
8068 | 8068 | $temp_array['year_name'] = $row['year_name']; |
@@ -8088,15 +8088,15 @@ discard block |
||
8088 | 8088 | $datetime = new DateTime(); |
8089 | 8089 | $offset = $datetime->format('P'); |
8090 | 8090 | } else $offset = '+00:00'; |
8091 | - $filter_query = $this->getFilter($filters,true,true); |
|
8091 | + $filter_query = $this->getFilter($filters, true, true); |
|
8092 | 8092 | |
8093 | 8093 | if ($globalDBdriver == 'mysql') { |
8094 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
8094 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
8095 | 8095 | FROM spotter_output".$filter_query." owner_name <> '' |
8096 | 8096 | GROUP BY year_name, month_name |
8097 | 8097 | ORDER BY date_count DESC"; |
8098 | 8098 | } else { |
8099 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
8099 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
8100 | 8100 | FROM spotter_output".$filter_query." owner_name <> '' |
8101 | 8101 | GROUP BY year_name, month_name |
8102 | 8102 | ORDER BY date_count DESC"; |
@@ -8108,7 +8108,7 @@ discard block |
||
8108 | 8108 | $date_array = array(); |
8109 | 8109 | $temp_array = array(); |
8110 | 8110 | |
8111 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8111 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8112 | 8112 | { |
8113 | 8113 | $temp_array['month_name'] = $row['month_name']; |
8114 | 8114 | $temp_array['year_name'] = $row['year_name']; |
@@ -8129,7 +8129,7 @@ discard block |
||
8129 | 8129 | public function countAllMonthsOwnersByAirlines($filters = array()) |
8130 | 8130 | { |
8131 | 8131 | global $globalTimezone, $globalDBdriver; |
8132 | - $filter_query = $this->getFilter($filters,true,true); |
|
8132 | + $filter_query = $this->getFilter($filters, true, true); |
|
8133 | 8133 | if ($globalTimezone != '') { |
8134 | 8134 | date_default_timezone_set($globalTimezone); |
8135 | 8135 | $datetime = new DateTime(); |
@@ -8137,12 +8137,12 @@ discard block |
||
8137 | 8137 | } else $offset = '+00:00'; |
8138 | 8138 | |
8139 | 8139 | if ($globalDBdriver == 'mysql') { |
8140 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
8140 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
8141 | 8141 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
8142 | 8142 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8143 | 8143 | ORDER BY date_count DESC"; |
8144 | 8144 | } else { |
8145 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
8145 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
8146 | 8146 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
8147 | 8147 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8148 | 8148 | ORDER BY date_count DESC"; |
@@ -8154,7 +8154,7 @@ discard block |
||
8154 | 8154 | $date_array = array(); |
8155 | 8155 | $temp_array = array(); |
8156 | 8156 | |
8157 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8157 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8158 | 8158 | { |
8159 | 8159 | $temp_array['month_name'] = $row['month_name']; |
8160 | 8160 | $temp_array['year_name'] = $row['year_name']; |
@@ -8181,15 +8181,15 @@ discard block |
||
8181 | 8181 | $datetime = new DateTime(); |
8182 | 8182 | $offset = $datetime->format('P'); |
8183 | 8183 | } else $offset = '+00:00'; |
8184 | - $filter_query = $this->getFilter($filters,true,true); |
|
8184 | + $filter_query = $this->getFilter($filters, true, true); |
|
8185 | 8185 | |
8186 | 8186 | if ($globalDBdriver == 'mysql') { |
8187 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
8187 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
8188 | 8188 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
8189 | 8189 | GROUP BY year_name, month_name |
8190 | 8190 | ORDER BY date_count DESC"; |
8191 | 8191 | } else { |
8192 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
8192 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
8193 | 8193 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
8194 | 8194 | GROUP BY year_name, month_name |
8195 | 8195 | ORDER BY date_count DESC"; |
@@ -8201,7 +8201,7 @@ discard block |
||
8201 | 8201 | $date_array = array(); |
8202 | 8202 | $temp_array = array(); |
8203 | 8203 | |
8204 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8204 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8205 | 8205 | { |
8206 | 8206 | $temp_array['month_name'] = $row['month_name']; |
8207 | 8207 | $temp_array['year_name'] = $row['year_name']; |
@@ -8222,7 +8222,7 @@ discard block |
||
8222 | 8222 | public function countAllMonthsPilotsByAirlines($filters = array()) |
8223 | 8223 | { |
8224 | 8224 | global $globalTimezone, $globalDBdriver; |
8225 | - $filter_query = $this->getFilter($filters,true,true); |
|
8225 | + $filter_query = $this->getFilter($filters, true, true); |
|
8226 | 8226 | if ($globalTimezone != '') { |
8227 | 8227 | date_default_timezone_set($globalTimezone); |
8228 | 8228 | $datetime = new DateTime(); |
@@ -8230,12 +8230,12 @@ discard block |
||
8230 | 8230 | } else $offset = '+00:00'; |
8231 | 8231 | |
8232 | 8232 | if ($globalDBdriver == 'mysql') { |
8233 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
8233 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
8234 | 8234 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
8235 | 8235 | GROUP BY spotter_output.airline_icao,year_name, month_name |
8236 | 8236 | ORDER BY date_count DESC"; |
8237 | 8237 | } else { |
8238 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
8238 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
8239 | 8239 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
8240 | 8240 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8241 | 8241 | ORDER BY date_count DESC"; |
@@ -8247,7 +8247,7 @@ discard block |
||
8247 | 8247 | $date_array = array(); |
8248 | 8248 | $temp_array = array(); |
8249 | 8249 | |
8250 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8250 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8251 | 8251 | { |
8252 | 8252 | $temp_array['month_name'] = $row['month_name']; |
8253 | 8253 | $temp_array['year_name'] = $row['year_name']; |
@@ -8269,7 +8269,7 @@ discard block |
||
8269 | 8269 | public function countAllMonthsAirlines($filters = array()) |
8270 | 8270 | { |
8271 | 8271 | global $globalTimezone, $globalDBdriver; |
8272 | - $filter_query = $this->getFilter($filters,true,true); |
|
8272 | + $filter_query = $this->getFilter($filters, true, true); |
|
8273 | 8273 | if ($globalTimezone != '') { |
8274 | 8274 | date_default_timezone_set($globalTimezone); |
8275 | 8275 | $datetime = new DateTime(); |
@@ -8277,12 +8277,12 @@ discard block |
||
8277 | 8277 | } else $offset = '+00:00'; |
8278 | 8278 | |
8279 | 8279 | if ($globalDBdriver == 'mysql') { |
8280 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
8280 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
8281 | 8281 | FROM spotter_output".$filter_query." airline_icao <> '' |
8282 | 8282 | GROUP BY year_name, month_name |
8283 | 8283 | ORDER BY date_count DESC"; |
8284 | 8284 | } else { |
8285 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
8285 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
8286 | 8286 | FROM spotter_output".$filter_query." airline_icao <> '' |
8287 | 8287 | GROUP BY year_name, month_name |
8288 | 8288 | ORDER BY date_count DESC"; |
@@ -8294,7 +8294,7 @@ discard block |
||
8294 | 8294 | $date_array = array(); |
8295 | 8295 | $temp_array = array(); |
8296 | 8296 | |
8297 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8297 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8298 | 8298 | { |
8299 | 8299 | $temp_array['month_name'] = $row['month_name']; |
8300 | 8300 | $temp_array['year_name'] = $row['year_name']; |
@@ -8320,15 +8320,15 @@ discard block |
||
8320 | 8320 | $datetime = new DateTime(); |
8321 | 8321 | $offset = $datetime->format('P'); |
8322 | 8322 | } else $offset = '+00:00'; |
8323 | - $filter_query = $this->getFilter($filters,true,true); |
|
8323 | + $filter_query = $this->getFilter($filters, true, true); |
|
8324 | 8324 | |
8325 | 8325 | if ($globalDBdriver == 'mysql') { |
8326 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
8326 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
8327 | 8327 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
8328 | 8328 | GROUP BY year_name, month_name |
8329 | 8329 | ORDER BY date_count DESC"; |
8330 | 8330 | } else { |
8331 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
8331 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
8332 | 8332 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
8333 | 8333 | GROUP BY year_name, month_name |
8334 | 8334 | ORDER BY date_count DESC"; |
@@ -8340,7 +8340,7 @@ discard block |
||
8340 | 8340 | $date_array = array(); |
8341 | 8341 | $temp_array = array(); |
8342 | 8342 | |
8343 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8343 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8344 | 8344 | { |
8345 | 8345 | $temp_array['month_name'] = $row['month_name']; |
8346 | 8346 | $temp_array['year_name'] = $row['year_name']; |
@@ -8362,7 +8362,7 @@ discard block |
||
8362 | 8362 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
8363 | 8363 | { |
8364 | 8364 | global $globalTimezone, $globalDBdriver; |
8365 | - $filter_query = $this->getFilter($filters,true,true); |
|
8365 | + $filter_query = $this->getFilter($filters, true, true); |
|
8366 | 8366 | if ($globalTimezone != '') { |
8367 | 8367 | date_default_timezone_set($globalTimezone); |
8368 | 8368 | $datetime = new DateTime(); |
@@ -8370,12 +8370,12 @@ discard block |
||
8370 | 8370 | } else $offset = '+00:00'; |
8371 | 8371 | |
8372 | 8372 | if ($globalDBdriver == 'mysql') { |
8373 | - $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
8373 | + $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
8374 | 8374 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
8375 | 8375 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8376 | 8376 | ORDER BY date_count DESC"; |
8377 | 8377 | } else { |
8378 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
8378 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
8379 | 8379 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
8380 | 8380 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8381 | 8381 | ORDER BY date_count DESC"; |
@@ -8387,7 +8387,7 @@ discard block |
||
8387 | 8387 | $date_array = array(); |
8388 | 8388 | $temp_array = array(); |
8389 | 8389 | |
8390 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8390 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8391 | 8391 | { |
8392 | 8392 | $temp_array['month_name'] = $row['month_name']; |
8393 | 8393 | $temp_array['year_name'] = $row['year_name']; |
@@ -8414,15 +8414,15 @@ discard block |
||
8414 | 8414 | $datetime = new DateTime(); |
8415 | 8415 | $offset = $datetime->format('P'); |
8416 | 8416 | } else $offset = '+00:00'; |
8417 | - $filter_query = $this->getFilter($filters,true,true); |
|
8417 | + $filter_query = $this->getFilter($filters, true, true); |
|
8418 | 8418 | |
8419 | 8419 | if ($globalDBdriver == 'mysql') { |
8420 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8420 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8421 | 8421 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
8422 | 8422 | GROUP BY year_name, month_name |
8423 | 8423 | ORDER BY date_count DESC"; |
8424 | 8424 | } else { |
8425 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8425 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8426 | 8426 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
8427 | 8427 | GROUP BY year_name, month_name |
8428 | 8428 | ORDER BY date_count DESC"; |
@@ -8434,7 +8434,7 @@ discard block |
||
8434 | 8434 | $date_array = array(); |
8435 | 8435 | $temp_array = array(); |
8436 | 8436 | |
8437 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8437 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8438 | 8438 | { |
8439 | 8439 | $temp_array['month_name'] = $row['month_name']; |
8440 | 8440 | $temp_array['year_name'] = $row['year_name']; |
@@ -8456,7 +8456,7 @@ discard block |
||
8456 | 8456 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
8457 | 8457 | { |
8458 | 8458 | global $globalTimezone, $globalDBdriver; |
8459 | - $filter_query = $this->getFilter($filters,true,true); |
|
8459 | + $filter_query = $this->getFilter($filters, true, true); |
|
8460 | 8460 | if ($globalTimezone != '') { |
8461 | 8461 | date_default_timezone_set($globalTimezone); |
8462 | 8462 | $datetime = new DateTime(); |
@@ -8464,12 +8464,12 @@ discard block |
||
8464 | 8464 | } else $offset = '+00:00'; |
8465 | 8465 | |
8466 | 8466 | if ($globalDBdriver == 'mysql') { |
8467 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8467 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8468 | 8468 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
8469 | 8469 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8470 | 8470 | ORDER BY date_count DESC"; |
8471 | 8471 | } else { |
8472 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8472 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8473 | 8473 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
8474 | 8474 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8475 | 8475 | ORDER BY date_count DESC"; |
@@ -8481,7 +8481,7 @@ discard block |
||
8481 | 8481 | $date_array = array(); |
8482 | 8482 | $temp_array = array(); |
8483 | 8483 | |
8484 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8484 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8485 | 8485 | { |
8486 | 8486 | $temp_array['month_name'] = $row['month_name']; |
8487 | 8487 | $temp_array['year_name'] = $row['year_name']; |
@@ -8509,7 +8509,7 @@ discard block |
||
8509 | 8509 | $datetime = new DateTime(); |
8510 | 8510 | $offset = $datetime->format('P'); |
8511 | 8511 | } else $offset = '+00:00'; |
8512 | - $filter_query = $this->getFilter($filters,true,true); |
|
8512 | + $filter_query = $this->getFilter($filters, true, true); |
|
8513 | 8513 | if ($globalDBdriver == 'mysql') { |
8514 | 8514 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
8515 | 8515 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -8530,7 +8530,7 @@ discard block |
||
8530 | 8530 | $date_array = array(); |
8531 | 8531 | $temp_array = array(); |
8532 | 8532 | |
8533 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8533 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8534 | 8534 | { |
8535 | 8535 | $temp_array['year_name'] = $row['year_name']; |
8536 | 8536 | $temp_array['month_name'] = $row['month_name']; |
@@ -8550,7 +8550,7 @@ discard block |
||
8550 | 8550 | * @return Array the hour list |
8551 | 8551 | * |
8552 | 8552 | */ |
8553 | - public function countAllHours($orderby,$filters = array()) |
|
8553 | + public function countAllHours($orderby, $filters = array()) |
|
8554 | 8554 | { |
8555 | 8555 | global $globalTimezone, $globalDBdriver; |
8556 | 8556 | if ($globalTimezone != '') { |
@@ -8598,7 +8598,7 @@ discard block |
||
8598 | 8598 | $hour_array = array(); |
8599 | 8599 | $temp_array = array(); |
8600 | 8600 | |
8601 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8601 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8602 | 8602 | { |
8603 | 8603 | $temp_array['hour_name'] = $row['hour_name']; |
8604 | 8604 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8618,7 +8618,7 @@ discard block |
||
8618 | 8618 | public function countAllHoursByAirlines($orderby, $filters = array()) |
8619 | 8619 | { |
8620 | 8620 | global $globalTimezone, $globalDBdriver; |
8621 | - $filter_query = $this->getFilter($filters,true,true); |
|
8621 | + $filter_query = $this->getFilter($filters, true, true); |
|
8622 | 8622 | if ($globalTimezone != '') { |
8623 | 8623 | date_default_timezone_set($globalTimezone); |
8624 | 8624 | $datetime = new DateTime(); |
@@ -8636,7 +8636,7 @@ discard block |
||
8636 | 8636 | } |
8637 | 8637 | |
8638 | 8638 | if ($globalDBdriver == 'mysql') { |
8639 | - $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8639 | + $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8640 | 8640 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
8641 | 8641 | GROUP BY spotter_output.airline_icao, hour_name |
8642 | 8642 | ".$orderby_sql; |
@@ -8649,7 +8649,7 @@ discard block |
||
8649 | 8649 | */ |
8650 | 8650 | $query_data = array(':offset' => $offset); |
8651 | 8651 | } else { |
8652 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8652 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8653 | 8653 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
8654 | 8654 | GROUP BY spotter_output.airline_icao, hour_name |
8655 | 8655 | ".$orderby_sql; |
@@ -8662,7 +8662,7 @@ discard block |
||
8662 | 8662 | $hour_array = array(); |
8663 | 8663 | $temp_array = array(); |
8664 | 8664 | |
8665 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8665 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8666 | 8666 | { |
8667 | 8667 | $temp_array['hour_name'] = $row['hour_name']; |
8668 | 8668 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8685,34 +8685,34 @@ discard block |
||
8685 | 8685 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
8686 | 8686 | { |
8687 | 8687 | global $globalTimezone, $globalDBdriver; |
8688 | - $filter_query = $this->getFilter($filters,true,true); |
|
8688 | + $filter_query = $this->getFilter($filters, true, true); |
|
8689 | 8689 | if ($globalTimezone != '') { |
8690 | 8690 | date_default_timezone_set($globalTimezone); |
8691 | 8691 | $datetime = new DateTime(); |
8692 | 8692 | $offset = $datetime->format('P'); |
8693 | 8693 | } else $offset = '+00:00'; |
8694 | 8694 | |
8695 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
8695 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
8696 | 8696 | |
8697 | 8697 | if ($globalDBdriver == 'mysql') { |
8698 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8698 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8699 | 8699 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
8700 | 8700 | GROUP BY hour_name |
8701 | 8701 | ORDER BY hour_name ASC"; |
8702 | 8702 | } else { |
8703 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8703 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8704 | 8704 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
8705 | 8705 | GROUP BY hour_name |
8706 | 8706 | ORDER BY hour_name ASC"; |
8707 | 8707 | } |
8708 | 8708 | |
8709 | 8709 | $sth = $this->db->prepare($query); |
8710 | - $sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset)); |
|
8710 | + $sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset)); |
|
8711 | 8711 | |
8712 | 8712 | $hour_array = array(); |
8713 | 8713 | $temp_array = array(); |
8714 | 8714 | |
8715 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8715 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8716 | 8716 | { |
8717 | 8717 | $temp_array['hour_name'] = $row['hour_name']; |
8718 | 8718 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8735,8 +8735,8 @@ discard block |
||
8735 | 8735 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
8736 | 8736 | { |
8737 | 8737 | global $globalTimezone, $globalDBdriver; |
8738 | - $filter_query = $this->getFilter($filters,true,true); |
|
8739 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
8738 | + $filter_query = $this->getFilter($filters, true, true); |
|
8739 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
8740 | 8740 | if ($globalTimezone != '') { |
8741 | 8741 | date_default_timezone_set($globalTimezone); |
8742 | 8742 | $datetime = new DateTime(); |
@@ -8744,24 +8744,24 @@ discard block |
||
8744 | 8744 | } else $offset = '+00:00'; |
8745 | 8745 | |
8746 | 8746 | if ($globalDBdriver == 'mysql') { |
8747 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8747 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8748 | 8748 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
8749 | 8749 | GROUP BY hour_name |
8750 | 8750 | ORDER BY hour_name ASC"; |
8751 | 8751 | } else { |
8752 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8752 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8753 | 8753 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
8754 | 8754 | GROUP BY hour_name |
8755 | 8755 | ORDER BY hour_name ASC"; |
8756 | 8756 | } |
8757 | 8757 | |
8758 | 8758 | $sth = $this->db->prepare($query); |
8759 | - $sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset)); |
|
8759 | + $sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset)); |
|
8760 | 8760 | |
8761 | 8761 | $hour_array = array(); |
8762 | 8762 | $temp_array = array(); |
8763 | 8763 | |
8764 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8764 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8765 | 8765 | { |
8766 | 8766 | $temp_array['hour_name'] = $row['hour_name']; |
8767 | 8767 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8782,8 +8782,8 @@ discard block |
||
8782 | 8782 | public function countAllHoursByRegistration($registration, $filters = array()) |
8783 | 8783 | { |
8784 | 8784 | global $globalTimezone, $globalDBdriver; |
8785 | - $filter_query = $this->getFilter($filters,true,true); |
|
8786 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
8785 | + $filter_query = $this->getFilter($filters, true, true); |
|
8786 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
8787 | 8787 | if ($globalTimezone != '') { |
8788 | 8788 | date_default_timezone_set($globalTimezone); |
8789 | 8789 | $datetime = new DateTime(); |
@@ -8791,24 +8791,24 @@ discard block |
||
8791 | 8791 | } else $offset = '+00:00'; |
8792 | 8792 | |
8793 | 8793 | if ($globalDBdriver == 'mysql') { |
8794 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8794 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8795 | 8795 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
8796 | 8796 | GROUP BY hour_name |
8797 | 8797 | ORDER BY hour_name ASC"; |
8798 | 8798 | } else { |
8799 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8799 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8800 | 8800 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
8801 | 8801 | GROUP BY hour_name |
8802 | 8802 | ORDER BY hour_name ASC"; |
8803 | 8803 | } |
8804 | 8804 | |
8805 | 8805 | $sth = $this->db->prepare($query); |
8806 | - $sth->execute(array(':registration' => $registration,':offset' => $offset)); |
|
8806 | + $sth->execute(array(':registration' => $registration, ':offset' => $offset)); |
|
8807 | 8807 | |
8808 | 8808 | $hour_array = array(); |
8809 | 8809 | $temp_array = array(); |
8810 | 8810 | |
8811 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8811 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8812 | 8812 | { |
8813 | 8813 | $temp_array['hour_name'] = $row['hour_name']; |
8814 | 8814 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8829,8 +8829,8 @@ discard block |
||
8829 | 8829 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
8830 | 8830 | { |
8831 | 8831 | global $globalTimezone, $globalDBdriver; |
8832 | - $filter_query = $this->getFilter($filters,true,true); |
|
8833 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
8832 | + $filter_query = $this->getFilter($filters, true, true); |
|
8833 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
8834 | 8834 | if ($globalTimezone != '') { |
8835 | 8835 | date_default_timezone_set($globalTimezone); |
8836 | 8836 | $datetime = new DateTime(); |
@@ -8838,24 +8838,24 @@ discard block |
||
8838 | 8838 | } else $offset = '+00:00'; |
8839 | 8839 | |
8840 | 8840 | if ($globalDBdriver == 'mysql') { |
8841 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8841 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8842 | 8842 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
8843 | 8843 | GROUP BY hour_name |
8844 | 8844 | ORDER BY hour_name ASC"; |
8845 | 8845 | } else { |
8846 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8846 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8847 | 8847 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
8848 | 8848 | GROUP BY hour_name |
8849 | 8849 | ORDER BY hour_name ASC"; |
8850 | 8850 | } |
8851 | 8851 | |
8852 | 8852 | $sth = $this->db->prepare($query); |
8853 | - $sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset)); |
|
8853 | + $sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset)); |
|
8854 | 8854 | |
8855 | 8855 | $hour_array = array(); |
8856 | 8856 | $temp_array = array(); |
8857 | 8857 | |
8858 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8858 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8859 | 8859 | { |
8860 | 8860 | $temp_array['hour_name'] = $row['hour_name']; |
8861 | 8861 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8874,11 +8874,11 @@ discard block |
||
8874 | 8874 | * @return Array the hour list |
8875 | 8875 | * |
8876 | 8876 | */ |
8877 | - public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
|
8877 | + public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array()) |
|
8878 | 8878 | { |
8879 | 8879 | global $globalTimezone, $globalDBdriver; |
8880 | - $filter_query = $this->getFilter($filters,true,true); |
|
8881 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
8880 | + $filter_query = $this->getFilter($filters, true, true); |
|
8881 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
8882 | 8882 | if ($globalTimezone != '') { |
8883 | 8883 | date_default_timezone_set($globalTimezone); |
8884 | 8884 | $datetime = new DateTime(); |
@@ -8886,24 +8886,24 @@ discard block |
||
8886 | 8886 | } else $offset = '+00:00'; |
8887 | 8887 | |
8888 | 8888 | if ($globalDBdriver == 'mysql') { |
8889 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8889 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8890 | 8890 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
8891 | 8891 | GROUP BY hour_name |
8892 | 8892 | ORDER BY hour_name ASC"; |
8893 | 8893 | } else { |
8894 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8894 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8895 | 8895 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
8896 | 8896 | GROUP BY hour_name |
8897 | 8897 | ORDER BY hour_name ASC"; |
8898 | 8898 | } |
8899 | 8899 | |
8900 | 8900 | $sth = $this->db->prepare($query); |
8901 | - $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset)); |
|
8901 | + $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset)); |
|
8902 | 8902 | |
8903 | 8903 | $hour_array = array(); |
8904 | 8904 | $temp_array = array(); |
8905 | 8905 | |
8906 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8906 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8907 | 8907 | { |
8908 | 8908 | $temp_array['hour_name'] = $row['hour_name']; |
8909 | 8909 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8925,8 +8925,8 @@ discard block |
||
8925 | 8925 | public function countAllHoursByDate($date, $filters = array()) |
8926 | 8926 | { |
8927 | 8927 | global $globalTimezone, $globalDBdriver; |
8928 | - $filter_query = $this->getFilter($filters,true,true); |
|
8929 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
8928 | + $filter_query = $this->getFilter($filters, true, true); |
|
8929 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
8930 | 8930 | if ($globalTimezone != '') { |
8931 | 8931 | date_default_timezone_set($globalTimezone); |
8932 | 8932 | $datetime = new DateTime($date); |
@@ -8934,12 +8934,12 @@ discard block |
||
8934 | 8934 | } else $offset = '+00:00'; |
8935 | 8935 | |
8936 | 8936 | if ($globalDBdriver == 'mysql') { |
8937 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8937 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8938 | 8938 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
8939 | 8939 | GROUP BY hour_name |
8940 | 8940 | ORDER BY hour_name ASC"; |
8941 | 8941 | } else { |
8942 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8942 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8943 | 8943 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
8944 | 8944 | GROUP BY hour_name |
8945 | 8945 | ORDER BY hour_name ASC"; |
@@ -8951,7 +8951,7 @@ discard block |
||
8951 | 8951 | $hour_array = array(); |
8952 | 8952 | $temp_array = array(); |
8953 | 8953 | |
8954 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8954 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8955 | 8955 | { |
8956 | 8956 | $temp_array['hour_name'] = $row['hour_name']; |
8957 | 8957 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8973,8 +8973,8 @@ discard block |
||
8973 | 8973 | public function countAllHoursByIdent($ident, $filters = array()) |
8974 | 8974 | { |
8975 | 8975 | global $globalTimezone, $globalDBdriver; |
8976 | - $filter_query = $this->getFilter($filters,true,true); |
|
8977 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
8976 | + $filter_query = $this->getFilter($filters, true, true); |
|
8977 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
8978 | 8978 | if ($globalTimezone != '') { |
8979 | 8979 | date_default_timezone_set($globalTimezone); |
8980 | 8980 | $datetime = new DateTime(); |
@@ -8982,12 +8982,12 @@ discard block |
||
8982 | 8982 | } else $offset = '+00:00'; |
8983 | 8983 | |
8984 | 8984 | if ($globalDBdriver == 'mysql') { |
8985 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8985 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8986 | 8986 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
8987 | 8987 | GROUP BY hour_name |
8988 | 8988 | ORDER BY hour_name ASC"; |
8989 | 8989 | } else { |
8990 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8990 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8991 | 8991 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
8992 | 8992 | GROUP BY hour_name |
8993 | 8993 | ORDER BY hour_name ASC"; |
@@ -8995,12 +8995,12 @@ discard block |
||
8995 | 8995 | |
8996 | 8996 | |
8997 | 8997 | $sth = $this->db->prepare($query); |
8998 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
8998 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
8999 | 8999 | |
9000 | 9000 | $hour_array = array(); |
9001 | 9001 | $temp_array = array(); |
9002 | 9002 | |
9003 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9003 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9004 | 9004 | { |
9005 | 9005 | $temp_array['hour_name'] = $row['hour_name']; |
9006 | 9006 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9019,12 +9019,12 @@ discard block |
||
9019 | 9019 | * @return Array the hour list |
9020 | 9020 | * |
9021 | 9021 | */ |
9022 | - public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
|
9022 | + public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
9023 | 9023 | { |
9024 | 9024 | global $globalTimezone, $globalDBdriver; |
9025 | - $filter_query = $this->getFilter($filters,true,true); |
|
9026 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
9027 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
9025 | + $filter_query = $this->getFilter($filters, true, true); |
|
9026 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
9027 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
9028 | 9028 | if ($globalTimezone != '') { |
9029 | 9029 | date_default_timezone_set($globalTimezone); |
9030 | 9030 | $datetime = new DateTime(); |
@@ -9032,24 +9032,24 @@ discard block |
||
9032 | 9032 | } else $offset = '+00:00'; |
9033 | 9033 | |
9034 | 9034 | if ($globalDBdriver == 'mysql') { |
9035 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9035 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9036 | 9036 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
9037 | 9037 | GROUP BY hour_name |
9038 | 9038 | ORDER BY hour_name ASC"; |
9039 | 9039 | } else { |
9040 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9040 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9041 | 9041 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
9042 | 9042 | GROUP BY hour_name |
9043 | 9043 | ORDER BY hour_name ASC"; |
9044 | 9044 | } |
9045 | 9045 | |
9046 | 9046 | $sth = $this->db->prepare($query); |
9047 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset)); |
|
9047 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset)); |
|
9048 | 9048 | |
9049 | 9049 | $hour_array = array(); |
9050 | 9050 | $temp_array = array(); |
9051 | 9051 | |
9052 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9052 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9053 | 9053 | { |
9054 | 9054 | $temp_array['hour_name'] = $row['hour_name']; |
9055 | 9055 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9070,8 +9070,8 @@ discard block |
||
9070 | 9070 | public function countAllHoursByCountry($country, $filters = array()) |
9071 | 9071 | { |
9072 | 9072 | global $globalTimezone, $globalDBdriver; |
9073 | - $filter_query = $this->getFilter($filters,true,true); |
|
9074 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
9073 | + $filter_query = $this->getFilter($filters, true, true); |
|
9074 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
9075 | 9075 | if ($globalTimezone != '') { |
9076 | 9076 | date_default_timezone_set($globalTimezone); |
9077 | 9077 | $datetime = new DateTime(); |
@@ -9079,24 +9079,24 @@ discard block |
||
9079 | 9079 | } else $offset = '+00:00'; |
9080 | 9080 | |
9081 | 9081 | if ($globalDBdriver == 'mysql') { |
9082 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9082 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9083 | 9083 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
9084 | 9084 | GROUP BY hour_name |
9085 | 9085 | ORDER BY hour_name ASC"; |
9086 | 9086 | } else { |
9087 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9087 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9088 | 9088 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
9089 | 9089 | GROUP BY hour_name |
9090 | 9090 | ORDER BY hour_name ASC"; |
9091 | 9091 | } |
9092 | 9092 | |
9093 | 9093 | $sth = $this->db->prepare($query); |
9094 | - $sth->execute(array(':country' => $country,':offset' => $offset)); |
|
9094 | + $sth->execute(array(':country' => $country, ':offset' => $offset)); |
|
9095 | 9095 | |
9096 | 9096 | $hour_array = array(); |
9097 | 9097 | $temp_array = array(); |
9098 | 9098 | |
9099 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9099 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9100 | 9100 | { |
9101 | 9101 | $temp_array['hour_name'] = $row['hour_name']; |
9102 | 9102 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9118,8 +9118,8 @@ discard block |
||
9118 | 9118 | */ |
9119 | 9119 | public function countOverallAircrafts($filters = array()) |
9120 | 9120 | { |
9121 | - $filter_query = $this->getFilter($filters,true,true); |
|
9122 | - $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
9121 | + $filter_query = $this->getFilter($filters, true, true); |
|
9122 | + $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
9123 | 9123 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
9124 | 9124 | $sth = $this->db->prepare($query); |
9125 | 9125 | $sth->execute(); |
@@ -9134,8 +9134,8 @@ discard block |
||
9134 | 9134 | */ |
9135 | 9135 | public function countOverallArrival($filters = array()) |
9136 | 9136 | { |
9137 | - $filter_query = $this->getFilter($filters,true,true); |
|
9138 | - $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
9137 | + $filter_query = $this->getFilter($filters, true, true); |
|
9138 | + $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
9139 | 9139 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''"; |
9140 | 9140 | |
9141 | 9141 | $sth = $this->db->prepare($query); |
@@ -9151,8 +9151,8 @@ discard block |
||
9151 | 9151 | */ |
9152 | 9152 | public function countOverallPilots($filters = array()) |
9153 | 9153 | { |
9154 | - $filter_query = $this->getFilter($filters,true,true); |
|
9155 | - $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
9154 | + $filter_query = $this->getFilter($filters, true, true); |
|
9155 | + $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
9156 | 9156 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''"; |
9157 | 9157 | $sth = $this->db->prepare($query); |
9158 | 9158 | $sth->execute(); |
@@ -9167,8 +9167,8 @@ discard block |
||
9167 | 9167 | */ |
9168 | 9168 | public function countOverallOwners($filters = array()) |
9169 | 9169 | { |
9170 | - $filter_query = $this->getFilter($filters,true,true); |
|
9171 | - $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
9170 | + $filter_query = $this->getFilter($filters, true, true); |
|
9171 | + $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
9172 | 9172 | FROM spotter_output".$filter_query." spotter_output.owner_name <> ''"; |
9173 | 9173 | $sth = $this->db->prepare($query); |
9174 | 9174 | $sth->execute(); |
@@ -9201,8 +9201,8 @@ discard block |
||
9201 | 9201 | */ |
9202 | 9202 | public function countOverallMilitaryFlights($filters = array()) |
9203 | 9203 | { |
9204 | - $filter_query = $this->getFilter($filters,true,true); |
|
9205 | - $query = "SELECT COUNT(s.spotter_id) AS flight_count |
|
9204 | + $filter_query = $this->getFilter($filters, true, true); |
|
9205 | + $query = "SELECT COUNT(s.spotter_id) AS flight_count |
|
9206 | 9206 | FROM spotter_output s, airlines a".$filter_query." s.airline_icao = a.icao AND a.type = 'military'"; |
9207 | 9207 | |
9208 | 9208 | $sth = $this->db->prepare($query); |
@@ -9239,7 +9239,7 @@ discard block |
||
9239 | 9239 | public function countAllHoursFromToday($filters = array()) |
9240 | 9240 | { |
9241 | 9241 | global $globalTimezone, $globalDBdriver; |
9242 | - $filter_query = $this->getFilter($filters,true,true); |
|
9242 | + $filter_query = $this->getFilter($filters, true, true); |
|
9243 | 9243 | if ($globalTimezone != '') { |
9244 | 9244 | date_default_timezone_set($globalTimezone); |
9245 | 9245 | $datetime = new DateTime(); |
@@ -9247,12 +9247,12 @@ discard block |
||
9247 | 9247 | } else $offset = '+00:00'; |
9248 | 9248 | |
9249 | 9249 | if ($globalDBdriver == 'mysql') { |
9250 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9250 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9251 | 9251 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE() |
9252 | 9252 | GROUP BY hour_name |
9253 | 9253 | ORDER BY hour_name ASC"; |
9254 | 9254 | } else { |
9255 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9255 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9256 | 9256 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
9257 | 9257 | GROUP BY hour_name |
9258 | 9258 | ORDER BY hour_name ASC"; |
@@ -9264,7 +9264,7 @@ discard block |
||
9264 | 9264 | $hour_array = array(); |
9265 | 9265 | $temp_array = array(); |
9266 | 9266 | |
9267 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9267 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9268 | 9268 | { |
9269 | 9269 | $temp_array['hour_name'] = $row['hour_name']; |
9270 | 9270 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9283,14 +9283,14 @@ discard block |
||
9283 | 9283 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
9284 | 9284 | { |
9285 | 9285 | global $global_query, $globalDBdriver, $globalTimezone; |
9286 | - $filter_query = $this->getFilter($filters,true,true); |
|
9286 | + $filter_query = $this->getFilter($filters, true, true); |
|
9287 | 9287 | date_default_timezone_set('UTC'); |
9288 | 9288 | $limit_query = ''; |
9289 | 9289 | if ($limit != "") |
9290 | 9290 | { |
9291 | 9291 | $limit_array = explode(",", $limit); |
9292 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
9293 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
9292 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
9293 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
9294 | 9294 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
9295 | 9295 | { |
9296 | 9296 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -9343,7 +9343,7 @@ discard block |
||
9343 | 9343 | GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH') |
9344 | 9344 | HAVING count(spotter_output.ident) > 5$orderby_query"; |
9345 | 9345 | //echo $query; |
9346 | - $spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone)); |
|
9346 | + $spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone)); |
|
9347 | 9347 | /* |
9348 | 9348 | $sth = $this->db->prepare($query); |
9349 | 9349 | $sth->execute(array(':timezone' => $globalTimezone)); |
@@ -9362,9 +9362,9 @@ discard block |
||
9362 | 9362 | */ |
9363 | 9363 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
9364 | 9364 | { |
9365 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
9365 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
9366 | 9366 | |
9367 | - $query = "SELECT spotter_output.spotter_id |
|
9367 | + $query = "SELECT spotter_output.spotter_id |
|
9368 | 9368 | FROM spotter_output |
9369 | 9369 | WHERE spotter_output.flightaware_id = '".$flightaware_id."'"; |
9370 | 9370 | |
@@ -9372,7 +9372,7 @@ discard block |
||
9372 | 9372 | $sth = $this->db->prepare($query); |
9373 | 9373 | $sth->execute(); |
9374 | 9374 | |
9375 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9375 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9376 | 9376 | { |
9377 | 9377 | return $row['spotter_id']; |
9378 | 9378 | } |
@@ -9397,23 +9397,23 @@ discard block |
||
9397 | 9397 | } |
9398 | 9398 | |
9399 | 9399 | $current_date = date("Y-m-d H:i:s"); |
9400 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
9400 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
9401 | 9401 | |
9402 | 9402 | $diff = abs(strtotime($current_date) - strtotime($date)); |
9403 | 9403 | |
9404 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
9404 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
9405 | 9405 | $years = $time_array['years']; |
9406 | 9406 | |
9407 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
9407 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
9408 | 9408 | $months = $time_array['months']; |
9409 | 9409 | |
9410 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
9410 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
9411 | 9411 | $days = $time_array['days']; |
9412 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
9412 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
9413 | 9413 | $hours = $time_array['hours']; |
9414 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
9414 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
9415 | 9415 | $minutes = $time_array['minutes']; |
9416 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
9416 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
9417 | 9417 | |
9418 | 9418 | return $time_array; |
9419 | 9419 | } |
@@ -9439,63 +9439,63 @@ discard block |
||
9439 | 9439 | $temp_array['direction_degree'] = $direction; |
9440 | 9440 | $temp_array['direction_shortname'] = "N"; |
9441 | 9441 | $temp_array['direction_fullname'] = "North"; |
9442 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
9442 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
9443 | 9443 | $temp_array['direction_degree'] = $direction; |
9444 | 9444 | $temp_array['direction_shortname'] = "NNE"; |
9445 | 9445 | $temp_array['direction_fullname'] = "North-Northeast"; |
9446 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
9446 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
9447 | 9447 | $temp_array['direction_degree'] = $direction; |
9448 | 9448 | $temp_array['direction_shortname'] = "NE"; |
9449 | 9449 | $temp_array['direction_fullname'] = "Northeast"; |
9450 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
9450 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
9451 | 9451 | $temp_array['direction_degree'] = $direction; |
9452 | 9452 | $temp_array['direction_shortname'] = "ENE"; |
9453 | 9453 | $temp_array['direction_fullname'] = "East-Northeast"; |
9454 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
9454 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
9455 | 9455 | $temp_array['direction_degree'] = $direction; |
9456 | 9456 | $temp_array['direction_shortname'] = "E"; |
9457 | 9457 | $temp_array['direction_fullname'] = "East"; |
9458 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
9458 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
9459 | 9459 | $temp_array['direction_degree'] = $direction; |
9460 | 9460 | $temp_array['direction_shortname'] = "ESE"; |
9461 | 9461 | $temp_array['direction_fullname'] = "East-Southeast"; |
9462 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
9462 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
9463 | 9463 | $temp_array['direction_degree'] = $direction; |
9464 | 9464 | $temp_array['direction_shortname'] = "SE"; |
9465 | 9465 | $temp_array['direction_fullname'] = "Southeast"; |
9466 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
9466 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
9467 | 9467 | $temp_array['direction_degree'] = $direction; |
9468 | 9468 | $temp_array['direction_shortname'] = "SSE"; |
9469 | 9469 | $temp_array['direction_fullname'] = "South-Southeast"; |
9470 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
9470 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
9471 | 9471 | $temp_array['direction_degree'] = $direction; |
9472 | 9472 | $temp_array['direction_shortname'] = "S"; |
9473 | 9473 | $temp_array['direction_fullname'] = "South"; |
9474 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
9474 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
9475 | 9475 | $temp_array['direction_degree'] = $direction; |
9476 | 9476 | $temp_array['direction_shortname'] = "SSW"; |
9477 | 9477 | $temp_array['direction_fullname'] = "South-Southwest"; |
9478 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
9478 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
9479 | 9479 | $temp_array['direction_degree'] = $direction; |
9480 | 9480 | $temp_array['direction_shortname'] = "SW"; |
9481 | 9481 | $temp_array['direction_fullname'] = "Southwest"; |
9482 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
9482 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
9483 | 9483 | $temp_array['direction_degree'] = $direction; |
9484 | 9484 | $temp_array['direction_shortname'] = "WSW"; |
9485 | 9485 | $temp_array['direction_fullname'] = "West-Southwest"; |
9486 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
9486 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
9487 | 9487 | $temp_array['direction_degree'] = $direction; |
9488 | 9488 | $temp_array['direction_shortname'] = "W"; |
9489 | 9489 | $temp_array['direction_fullname'] = "West"; |
9490 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
9490 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
9491 | 9491 | $temp_array['direction_degree'] = $direction; |
9492 | 9492 | $temp_array['direction_shortname'] = "WNW"; |
9493 | 9493 | $temp_array['direction_fullname'] = "West-Northwest"; |
9494 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
9494 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
9495 | 9495 | $temp_array['direction_degree'] = $direction; |
9496 | 9496 | $temp_array['direction_shortname'] = "NW"; |
9497 | 9497 | $temp_array['direction_fullname'] = "Northwest"; |
9498 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
9498 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
9499 | 9499 | $temp_array['direction_degree'] = $direction; |
9500 | 9500 | $temp_array['direction_shortname'] = "NNW"; |
9501 | 9501 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -9548,9 +9548,9 @@ discard block |
||
9548 | 9548 | */ |
9549 | 9549 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
9550 | 9550 | { |
9551 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
9551 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
9552 | 9552 | |
9553 | - $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
9553 | + $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
9554 | 9554 | |
9555 | 9555 | $sth = $this->db->prepare($query); |
9556 | 9556 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9573,9 +9573,9 @@ discard block |
||
9573 | 9573 | */ |
9574 | 9574 | public function getAircraftTypeBymodeS($aircraft_modes) |
9575 | 9575 | { |
9576 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
9576 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
9577 | 9577 | |
9578 | - $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
9578 | + $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
9579 | 9579 | |
9580 | 9580 | $sth = $this->db->prepare($query); |
9581 | 9581 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9596,11 +9596,11 @@ discard block |
||
9596 | 9596 | * @param Float $longitude longitute of the flight |
9597 | 9597 | * @return String the countrie |
9598 | 9598 | */ |
9599 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
9599 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
9600 | 9600 | { |
9601 | 9601 | global $globalDBdriver, $globalDebug; |
9602 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
9603 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
9602 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
9603 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
9604 | 9604 | |
9605 | 9605 | $Connection = new Connection($this->db); |
9606 | 9606 | if (!$Connection->tableExists('countries')) return ''; |
@@ -9640,19 +9640,19 @@ discard block |
||
9640 | 9640 | */ |
9641 | 9641 | public function convertAircraftRegistration($registration) |
9642 | 9642 | { |
9643 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
9643 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
9644 | 9644 | $registration_prefix = ''; |
9645 | 9645 | $registration_1 = substr($registration, 0, 1); |
9646 | 9646 | $registration_2 = substr($registration, 0, 2); |
9647 | 9647 | |
9648 | 9648 | //first get the prefix based on two characters |
9649 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
9649 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
9650 | 9650 | |
9651 | 9651 | |
9652 | 9652 | $sth = $this->db->prepare($query); |
9653 | 9653 | $sth->execute(array(':registration_2' => $registration_2)); |
9654 | 9654 | |
9655 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9655 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9656 | 9656 | { |
9657 | 9657 | $registration_prefix = $row['registration_prefix']; |
9658 | 9658 | } |
@@ -9660,11 +9660,11 @@ discard block |
||
9660 | 9660 | //if we didn't find a two chracter prefix lets just search the one with one character |
9661 | 9661 | if ($registration_prefix == '') |
9662 | 9662 | { |
9663 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
9663 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
9664 | 9664 | $sth = $this->db->prepare($query); |
9665 | 9665 | $sth->execute(array(':registration_1' => $registration_1)); |
9666 | 9666 | |
9667 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9667 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9668 | 9668 | { |
9669 | 9669 | $registration_prefix = $row['registration_prefix']; |
9670 | 9670 | } |
@@ -9678,7 +9678,7 @@ discard block |
||
9678 | 9678 | } else { |
9679 | 9679 | $registration = preg_replace("/^(.{1})/", "$1-", $registration); |
9680 | 9680 | } |
9681 | - } else if(strlen($registration_prefix) == 2){ |
|
9681 | + } else if (strlen($registration_prefix) == 2) { |
|
9682 | 9682 | if (0 === strpos($registration, 'N')) { |
9683 | 9683 | $registration = preg_replace("/^(.{2})/", "$1", $registration); |
9684 | 9684 | } else { |
@@ -9697,17 +9697,17 @@ discard block |
||
9697 | 9697 | */ |
9698 | 9698 | public function countryFromAircraftRegistration($registration) |
9699 | 9699 | { |
9700 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
9700 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
9701 | 9701 | |
9702 | 9702 | $registration_prefix = ''; |
9703 | - $registration_test = explode('-',$registration); |
|
9703 | + $registration_test = explode('-', $registration); |
|
9704 | 9704 | $country = ''; |
9705 | 9705 | if ($registration_test[0] != $registration) { |
9706 | 9706 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
9707 | 9707 | |
9708 | 9708 | $sth = $this->db->prepare($query); |
9709 | 9709 | $sth->execute(array(':registration_1' => $registration_test[0])); |
9710 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9710 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9711 | 9711 | { |
9712 | 9712 | //$registration_prefix = $row['registration_prefix']; |
9713 | 9713 | $country = $row['country']; |
@@ -9718,13 +9718,13 @@ discard block |
||
9718 | 9718 | |
9719 | 9719 | $country = ''; |
9720 | 9720 | //first get the prefix based on two characters |
9721 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
9721 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
9722 | 9722 | |
9723 | 9723 | |
9724 | 9724 | $sth = $this->db->prepare($query); |
9725 | 9725 | $sth->execute(array(':registration_2' => $registration_2)); |
9726 | 9726 | |
9727 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9727 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9728 | 9728 | { |
9729 | 9729 | $registration_prefix = $row['registration_prefix']; |
9730 | 9730 | $country = $row['country']; |
@@ -9733,12 +9733,12 @@ discard block |
||
9733 | 9733 | //if we didn't find a two chracter prefix lets just search the one with one character |
9734 | 9734 | if ($registration_prefix == "") |
9735 | 9735 | { |
9736 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
9736 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
9737 | 9737 | |
9738 | 9738 | $sth = $this->db->prepare($query); |
9739 | 9739 | $sth->execute(array(':registration_1' => $registration_1)); |
9740 | 9740 | |
9741 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9741 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9742 | 9742 | { |
9743 | 9743 | //$registration_prefix = $row['registration_prefix']; |
9744 | 9744 | $country = $row['country']; |
@@ -9755,9 +9755,9 @@ discard block |
||
9755 | 9755 | * @param String $flightaware_id flightaware_id from spotter_output table |
9756 | 9756 | * @param String $highlight New highlight value |
9757 | 9757 | */ |
9758 | - public function setHighlightFlight($flightaware_id,$highlight) { |
|
9758 | + public function setHighlightFlight($flightaware_id, $highlight) { |
|
9759 | 9759 | |
9760 | - $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
9760 | + $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
9761 | 9761 | $sth = $this->db->prepare($query); |
9762 | 9762 | $sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight)); |
9763 | 9763 | } |
@@ -9786,7 +9786,7 @@ discard block |
||
9786 | 9786 | |
9787 | 9787 | $bitly_data = json_decode($bitly_data); |
9788 | 9788 | $bitly_url = ''; |
9789 | - if ($bitly_data->status_txt = "OK"){ |
|
9789 | + if ($bitly_data->status_txt = "OK") { |
|
9790 | 9790 | $bitly_url = $bitly_data->data->url; |
9791 | 9791 | } |
9792 | 9792 | |
@@ -9796,7 +9796,7 @@ discard block |
||
9796 | 9796 | |
9797 | 9797 | public function getOrderBy() |
9798 | 9798 | { |
9799 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
9799 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
9800 | 9800 | |
9801 | 9801 | return $orderby; |
9802 | 9802 | |
@@ -9930,14 +9930,14 @@ discard block |
||
9930 | 9930 | } |
9931 | 9931 | $sth = $this->db->prepare($query); |
9932 | 9932 | $sth->execute(); |
9933 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9933 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9934 | 9934 | { |
9935 | 9935 | $departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']); |
9936 | 9936 | $arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']); |
9937 | 9937 | if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) { |
9938 | - $update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
9938 | + $update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
9939 | 9939 | $sthu = $this->db->prepare($update_query); |
9940 | - $sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
9940 | + $sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
9941 | 9941 | } |
9942 | 9942 | } |
9943 | 9943 | |
@@ -9950,7 +9950,7 @@ discard block |
||
9950 | 9950 | } |
9951 | 9951 | $sth = $this->db->prepare($query); |
9952 | 9952 | $sth->execute(); |
9953 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9953 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9954 | 9954 | { |
9955 | 9955 | if (is_numeric(substr($row['ident'], -1, 1))) |
9956 | 9956 | { |
@@ -9959,11 +9959,11 @@ discard block |
||
9959 | 9959 | elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
9960 | 9960 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
9961 | 9961 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
9962 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
9962 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
9963 | 9963 | if (isset($airline_array[0]['name'])) { |
9964 | - $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
9964 | + $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
9965 | 9965 | $sthu = $this->db->prepare($update_query); |
9966 | - $sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
9966 | + $sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
9967 | 9967 | } |
9968 | 9968 | } |
9969 | 9969 | } |
@@ -9983,18 +9983,18 @@ discard block |
||
9983 | 9983 | } |
9984 | 9984 | $sth = $this->db->prepare($query); |
9985 | 9985 | $sth->execute(); |
9986 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9986 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9987 | 9987 | { |
9988 | 9988 | if ($row['aircraft_icao'] != '') { |
9989 | 9989 | $aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']); |
9990 | - if ($row['registration'] != ""){ |
|
9990 | + if ($row['registration'] != "") { |
|
9991 | 9991 | $image_array = $Image->getSpotterImage($row['registration']); |
9992 | 9992 | if (count($image_array) == 0) { |
9993 | 9993 | $Image->addSpotterImage($row['registration']); |
9994 | 9994 | } |
9995 | 9995 | } |
9996 | 9996 | if (count($aircraft_name) > 0) { |
9997 | - $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
9997 | + $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
9998 | 9998 | $sthu = $this->db->prepare($update_query); |
9999 | 9999 | $sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id'])); |
10000 | 10000 | } |
@@ -10009,10 +10009,10 @@ discard block |
||
10009 | 10009 | $query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output"; |
10010 | 10010 | $sth = $this->db->prepare($query); |
10011 | 10011 | $sth->execute(); |
10012 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10012 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10013 | 10013 | { |
10014 | 10014 | if ($row['last_latitude'] != '' && $row['last_longitude'] != '') { |
10015 | - $closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist); |
|
10015 | + $closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist); |
|
10016 | 10016 | $airport_icao = ''; |
10017 | 10017 | if (isset($closestAirports[0])) { |
10018 | 10018 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
@@ -10026,7 +10026,7 @@ discard block |
||
10026 | 10026 | break; |
10027 | 10027 | } |
10028 | 10028 | } |
10029 | - } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
|
10029 | + } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) { |
|
10030 | 10030 | $airport_icao = $closestAirports[0]['icao']; |
10031 | 10031 | if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
10032 | 10032 | } else { |
@@ -10037,28 +10037,28 @@ discard block |
||
10037 | 10037 | } |
10038 | 10038 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
10039 | 10039 | if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
10040 | - $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
10040 | + $update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
10041 | 10041 | $sthu = $this->db->prepare($update_query); |
10042 | - $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
|
10042 | + $sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id'])); |
|
10043 | 10043 | } |
10044 | 10044 | } |
10045 | 10045 | } |
10046 | 10046 | } |
10047 | 10047 | |
10048 | - public function closestAirports($origLat,$origLon,$dist = 10) { |
|
10048 | + public function closestAirports($origLat, $origLon, $dist = 10) { |
|
10049 | 10049 | global $globalDBdriver; |
10050 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
10050 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
10051 | 10051 | /* |
10052 | 10052 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
10053 | 10053 | FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
10054 | 10054 | having distance < $dist ORDER BY distance limit 100;"; |
10055 | 10055 | */ |
10056 | 10056 | if ($globalDBdriver == 'mysql') { |
10057 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
10057 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
10058 | 10058 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
10059 | 10059 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
10060 | 10060 | } else { |
10061 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
10061 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
10062 | 10062 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
10063 | 10063 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
10064 | 10064 | } |