@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | $this->db = $Connection->db(); |
19 | 19 | } |
20 | 20 | |
21 | - public function addLastStatsUpdate($type,$stats_date) { |
|
21 | + public function addLastStatsUpdate($type, $stats_date) { |
|
22 | 22 | $query = "DELETE FROM config WHERE name = :type; |
23 | 23 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
24 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
24 | + $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
25 | 25 | try { |
26 | 26 | $sth = $this->db->prepare($query); |
27 | 27 | $sth->execute($query_values); |
28 | - } catch(PDOException $e) { |
|
28 | + } catch (PDOException $e) { |
|
29 | 29 | return "error : ".$e->getMessage(); |
30 | 30 | } |
31 | 31 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | try { |
36 | 36 | $sth = $this->db->prepare($query); |
37 | 37 | $sth->execute(array(':type' => $type)); |
38 | - } catch(PDOException $e) { |
|
38 | + } catch (PDOException $e) { |
|
39 | 39 | echo "error : ".$e->getMessage(); |
40 | 40 | } |
41 | 41 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | try { |
57 | 57 | $sth = $this->db->prepare($query); |
58 | 58 | $sth->execute(array(':filter_name' => $filter_name)); |
59 | - } catch(PDOException $e) { |
|
59 | + } catch (PDOException $e) { |
|
60 | 60 | return "error : ".$e->getMessage(); |
61 | 61 | } |
62 | 62 | } |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | try { |
70 | 70 | $sth = $this->db->prepare($query); |
71 | 71 | $sth->execute(); |
72 | - } catch(PDOException $e) { |
|
72 | + } catch (PDOException $e) { |
|
73 | 73 | return "error : ".$e->getMessage(); |
74 | 74 | } |
75 | 75 | $query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
76 | 76 | try { |
77 | 77 | $sth = $this->db->prepare($query); |
78 | 78 | $sth->execute(array(':filter_name' => $filter_name)); |
79 | - } catch(PDOException $e) { |
|
79 | + } catch (PDOException $e) { |
|
80 | 80 | return "error : ".$e->getMessage(); |
81 | 81 | } |
82 | 82 | } |
@@ -88,77 +88,77 @@ discard block |
||
88 | 88 | try { |
89 | 89 | $sth = $this->db->prepare($query); |
90 | 90 | $sth->execute(array(':filter_name' => $filter_name)); |
91 | - } catch(PDOException $e) { |
|
91 | + } catch (PDOException $e) { |
|
92 | 92 | echo "error : ".$e->getMessage(); |
93 | 93 | } |
94 | 94 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
95 | 95 | if (empty($all)) { |
96 | 96 | $filters = array(); |
97 | 97 | if ($filter_name != '') { |
98 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
98 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
99 | 99 | } |
100 | 100 | $Spotter = new Spotter($this->db); |
101 | - $all = $Spotter->getAllAirlineNames('',NULL,$filters); |
|
101 | + $all = $Spotter->getAllAirlineNames('', NULL, $filters); |
|
102 | 102 | } |
103 | 103 | return $all; |
104 | 104 | } |
105 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
105 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
106 | 106 | if ($filter_name == '') $filter_name = $this->filter_name; |
107 | 107 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
108 | 108 | try { |
109 | 109 | $sth = $this->db->prepare($query); |
110 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
111 | - } catch(PDOException $e) { |
|
110 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
111 | + } catch (PDOException $e) { |
|
112 | 112 | echo "error : ".$e->getMessage(); |
113 | 113 | } |
114 | 114 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
115 | 115 | return $all; |
116 | 116 | } |
117 | - public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
117 | + public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
|
118 | 118 | if ($filter_name == '') $filter_name = $this->filter_name; |
119 | 119 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
120 | 120 | try { |
121 | 121 | $sth = $this->db->prepare($query); |
122 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
123 | - } catch(PDOException $e) { |
|
122 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
123 | + } catch (PDOException $e) { |
|
124 | 124 | echo "error : ".$e->getMessage(); |
125 | 125 | } |
126 | 126 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
127 | 127 | return $all; |
128 | 128 | } |
129 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
129 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
130 | 130 | if ($filter_name == '') $filter_name = $this->filter_name; |
131 | 131 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
132 | 132 | try { |
133 | 133 | $sth = $this->db->prepare($query); |
134 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
135 | - } catch(PDOException $e) { |
|
134 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
135 | + } catch (PDOException $e) { |
|
136 | 136 | echo "error : ".$e->getMessage(); |
137 | 137 | } |
138 | 138 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
139 | 139 | return $all; |
140 | 140 | } |
141 | 141 | |
142 | - public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
|
142 | + public function getAllOwnerNames($stats_airline = '', $filter_name = '') { |
|
143 | 143 | if ($filter_name == '') $filter_name = $this->filter_name; |
144 | 144 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
145 | 145 | try { |
146 | 146 | $sth = $this->db->prepare($query); |
147 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
148 | - } catch(PDOException $e) { |
|
147 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
148 | + } catch (PDOException $e) { |
|
149 | 149 | echo "error : ".$e->getMessage(); |
150 | 150 | } |
151 | 151 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
152 | 152 | return $all; |
153 | 153 | } |
154 | 154 | |
155 | - public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
|
155 | + public function getAllPilotNames($stats_airline = '', $filter_name = '') { |
|
156 | 156 | if ($filter_name == '') $filter_name = $this->filter_name; |
157 | 157 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
158 | 158 | try { |
159 | 159 | $sth = $this->db->prepare($query); |
160 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
161 | - } catch(PDOException $e) { |
|
160 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
161 | + } catch (PDOException $e) { |
|
162 | 162 | echo "error : ".$e->getMessage(); |
163 | 163 | } |
164 | 164 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -166,23 +166,23 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | |
169 | - public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
169 | + public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
170 | 170 | global $globalStatsFilters; |
171 | 171 | if ($filter_name == '') $filter_name = $this->filter_name; |
172 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
172 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
173 | 173 | $Spotter = new Spotter($this->db); |
174 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
174 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
175 | 175 | $alliance_airlines = array(); |
176 | 176 | foreach ($airlines as $airline) { |
177 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
177 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
178 | 178 | } |
179 | 179 | if ($year == '' && $month == '') { |
180 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
181 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
180 | + if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
181 | + else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
182 | 182 | try { |
183 | 183 | $sth = $this->db->prepare($query); |
184 | 184 | $sth->execute(array(':filter_name' => $filter_name)); |
185 | - } catch(PDOException $e) { |
|
185 | + } catch (PDOException $e) { |
|
186 | 186 | echo "error : ".$e->getMessage(); |
187 | 187 | } |
188 | 188 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -193,29 +193,29 @@ discard block |
||
193 | 193 | else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
194 | 194 | try { |
195 | 195 | $sth = $this->db->prepare($query); |
196 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
197 | - } catch(PDOException $e) { |
|
196 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
197 | + } catch (PDOException $e) { |
|
198 | 198 | echo "error : ".$e->getMessage(); |
199 | 199 | } |
200 | 200 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
201 | 201 | } else $all = array(); |
202 | 202 | } |
203 | 203 | if (empty($all)) { |
204 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
205 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
204 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
205 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
206 | 206 | } else { |
207 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
207 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
208 | 208 | } |
209 | 209 | if ($filter_name != '') { |
210 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
210 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
211 | 211 | } |
212 | 212 | $Spotter = new Spotter($this->db); |
213 | 213 | //$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
214 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
214 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
215 | 215 | } |
216 | 216 | return $all; |
217 | 217 | } |
218 | - public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
|
218 | + public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
|
219 | 219 | global $globalStatsFilters; |
220 | 220 | if ($filter_name == '') $filter_name = $this->filter_name; |
221 | 221 | if ($year == '' && $month == '') { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | try { |
225 | 225 | $sth = $this->db->prepare($query); |
226 | 226 | $sth->execute(array(':filter_name' => $filter_name)); |
227 | - } catch(PDOException $e) { |
|
227 | + } catch (PDOException $e) { |
|
228 | 228 | echo "error : ".$e->getMessage(); |
229 | 229 | } |
230 | 230 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -232,32 +232,32 @@ discard block |
||
232 | 232 | if (empty($all)) { |
233 | 233 | $Spotter = new Spotter($this->db); |
234 | 234 | $filters = array(); |
235 | - $filters = array('year' => $year,'month' => $month); |
|
235 | + $filters = array('year' => $year, 'month' => $month); |
|
236 | 236 | if ($filter_name != '') { |
237 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
237 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
238 | 238 | } |
239 | 239 | //$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
240 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
240 | + $all = $Spotter->countAllAirlineCountries($limit, $filters); |
|
241 | 241 | } |
242 | 242 | return $all; |
243 | 243 | } |
244 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
244 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
245 | 245 | global $globalStatsFilters; |
246 | 246 | if ($filter_name == '') $filter_name = $this->filter_name; |
247 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
247 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
248 | 248 | $Spotter = new Spotter($this->db); |
249 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
249 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
250 | 250 | $alliance_airlines = array(); |
251 | 251 | foreach ($airlines as $airline) { |
252 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
252 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
253 | 253 | } |
254 | 254 | if ($year == '' && $month == '') { |
255 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
256 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
255 | + if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
256 | + else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
257 | 257 | try { |
258 | 258 | $sth = $this->db->prepare($query); |
259 | 259 | $sth->execute(array(':filter_name' => $filter_name)); |
260 | - } catch(PDOException $e) { |
|
260 | + } catch (PDOException $e) { |
|
261 | 261 | echo "error : ".$e->getMessage(); |
262 | 262 | } |
263 | 263 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -268,21 +268,21 @@ discard block |
||
268 | 268 | else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
269 | 269 | try { |
270 | 270 | $sth = $this->db->prepare($query); |
271 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
272 | - } catch(PDOException $e) { |
|
271 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
272 | + } catch (PDOException $e) { |
|
273 | 273 | echo "error : ".$e->getMessage(); |
274 | 274 | } |
275 | 275 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
276 | 276 | } else $all = array(); |
277 | 277 | } |
278 | 278 | if (empty($all)) { |
279 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
280 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
279 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
280 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
281 | 281 | } else { |
282 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
282 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
283 | 283 | } |
284 | 284 | if ($filter_name != '') { |
285 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
285 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
286 | 286 | } |
287 | 287 | $Spotter = new Spotter($this->db); |
288 | 288 | //$all = $Spotter->countAllAircraftManufacturers($filters,$year,$month); |
@@ -291,23 +291,23 @@ discard block |
||
291 | 291 | return $all; |
292 | 292 | } |
293 | 293 | |
294 | - public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
294 | + public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
295 | 295 | global $globalStatsFilters; |
296 | 296 | if ($filter_name == '') $filter_name = $this->filter_name; |
297 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
297 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
298 | 298 | $Spotter = new Spotter($this->db); |
299 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
299 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
300 | 300 | $alliance_airlines = array(); |
301 | 301 | foreach ($airlines as $airline) { |
302 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
302 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
303 | 303 | } |
304 | 304 | if ($year == '' && $month == '') { |
305 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
306 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
305 | + if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
306 | + else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
307 | 307 | try { |
308 | 308 | $sth = $this->db->prepare($query); |
309 | 309 | $sth->execute(array(':filter_name' => $filter_name)); |
310 | - } catch(PDOException $e) { |
|
310 | + } catch (PDOException $e) { |
|
311 | 311 | echo "error : ".$e->getMessage(); |
312 | 312 | } |
313 | 313 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -318,61 +318,61 @@ discard block |
||
318 | 318 | else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
319 | 319 | try { |
320 | 320 | $sth = $this->db->prepare($query); |
321 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
322 | - } catch(PDOException $e) { |
|
321 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
322 | + } catch (PDOException $e) { |
|
323 | 323 | echo "error : ".$e->getMessage(); |
324 | 324 | } |
325 | 325 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
326 | 326 | } else $all = array(); |
327 | 327 | } |
328 | 328 | if (empty($all)) { |
329 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
330 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
329 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
330 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
331 | 331 | } else { |
332 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
332 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
333 | 333 | } |
334 | 334 | if ($filter_name != '') { |
335 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
335 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
336 | 336 | } |
337 | 337 | $Spotter = new Spotter($this->db); |
338 | 338 | //$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
339 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
339 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
340 | 340 | } |
341 | 341 | return $all; |
342 | 342 | } |
343 | 343 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
344 | 344 | global $globalStatsFilters; |
345 | 345 | if ($filter_name == '') $filter_name = $this->filter_name; |
346 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
346 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
347 | 347 | $Spotter = new Spotter($this->db); |
348 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
348 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
349 | 349 | $alliance_airlines = array(); |
350 | 350 | foreach ($airlines as $airline) { |
351 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
351 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
352 | 352 | } |
353 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
354 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
353 | + if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
354 | + else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
355 | 355 | $query_values = array(':filter_name' => $filter_name); |
356 | 356 | } else { |
357 | 357 | if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
358 | 358 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
359 | - $query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
359 | + $query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
360 | 360 | } |
361 | 361 | try { |
362 | 362 | $sth = $this->db->prepare($query); |
363 | 363 | $sth->execute($query_values); |
364 | - } catch(PDOException $e) { |
|
364 | + } catch (PDOException $e) { |
|
365 | 365 | echo "error : ".$e->getMessage(); |
366 | 366 | } |
367 | 367 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
368 | 368 | if (empty($all)) { |
369 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
370 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
369 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
370 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
371 | 371 | } else { |
372 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
372 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
373 | 373 | } |
374 | 374 | if ($filter_name != '') { |
375 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
375 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
376 | 376 | } |
377 | 377 | $Spotter = new Spotter($this->db); |
378 | 378 | //$all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | return $all; |
382 | 382 | } |
383 | 383 | |
384 | - public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
|
384 | + public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') { |
|
385 | 385 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
386 | 386 | if ($filter_name == '') $filter_name = $this->filter_name; |
387 | 387 | if ($year == '' && $month == '') { |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | if (isset($forsource)) { |
391 | 391 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
392 | 392 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
393 | - $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
|
393 | + $query_values = array(':filter_name' => $filter_name, ':forsource' => $forsource); |
|
394 | 394 | } else { |
395 | 395 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
396 | 396 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | try { |
400 | 400 | $sth = $this->db->prepare($query); |
401 | 401 | $sth->execute($query_values); |
402 | - } catch(PDOException $e) { |
|
402 | + } catch (PDOException $e) { |
|
403 | 403 | echo "error : ".$e->getMessage(); |
404 | 404 | } |
405 | 405 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -407,32 +407,32 @@ discard block |
||
407 | 407 | if (empty($all)) { |
408 | 408 | $Spotter = new Spotter($this->db); |
409 | 409 | $filters = array(); |
410 | - $filters = array('year' => $year,'month' => $month); |
|
410 | + $filters = array('year' => $year, 'month' => $month); |
|
411 | 411 | if ($filter_name != '') { |
412 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
412 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
413 | 413 | } |
414 | 414 | //$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
415 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
415 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
|
416 | 416 | } |
417 | 417 | return $all; |
418 | 418 | } |
419 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
419 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
420 | 420 | global $globalStatsFilters; |
421 | 421 | if ($filter_name == '') $filter_name = $this->filter_name; |
422 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
422 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
423 | 423 | $Spotter = new Spotter($this->db); |
424 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
424 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
425 | 425 | $alliance_airlines = array(); |
426 | 426 | foreach ($airlines as $airline) { |
427 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
427 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
428 | 428 | } |
429 | 429 | if ($year == '' && $month == '') { |
430 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
431 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
430 | + if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
431 | + else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
432 | 432 | try { |
433 | 433 | $sth = $this->db->prepare($query); |
434 | 434 | $sth->execute(array(':filter_name' => $filter_name)); |
435 | - } catch(PDOException $e) { |
|
435 | + } catch (PDOException $e) { |
|
436 | 436 | echo "error : ".$e->getMessage(); |
437 | 437 | } |
438 | 438 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -443,45 +443,45 @@ discard block |
||
443 | 443 | else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
444 | 444 | try { |
445 | 445 | $sth = $this->db->prepare($query); |
446 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
447 | - } catch(PDOException $e) { |
|
446 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
447 | + } catch (PDOException $e) { |
|
448 | 448 | echo "error : ".$e->getMessage(); |
449 | 449 | } |
450 | 450 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
451 | 451 | } else $all = array(); |
452 | 452 | } |
453 | 453 | if (empty($all)) { |
454 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
455 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
454 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
455 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
456 | 456 | } else { |
457 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
457 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
458 | 458 | } |
459 | 459 | if ($filter_name != '') { |
460 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
460 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
461 | 461 | } |
462 | 462 | $Spotter = new Spotter($this->db); |
463 | 463 | //$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
464 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
464 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
465 | 465 | } |
466 | 466 | return $all; |
467 | 467 | } |
468 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
468 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
469 | 469 | global $globalStatsFilters; |
470 | 470 | if ($filter_name == '') $filter_name = $this->filter_name; |
471 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
471 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
472 | 472 | $Spotter = new Spotter($this->db); |
473 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
473 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
474 | 474 | $alliance_airlines = array(); |
475 | 475 | foreach ($airlines as $airline) { |
476 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
476 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
477 | 477 | } |
478 | 478 | if ($year == '' && $month == '') { |
479 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
480 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
479 | + if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
480 | + else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
481 | 481 | try { |
482 | 482 | $sth = $this->db->prepare($query); |
483 | 483 | $sth->execute(array(':filter_name' => $filter_name)); |
484 | - } catch(PDOException $e) { |
|
484 | + } catch (PDOException $e) { |
|
485 | 485 | echo "error : ".$e->getMessage(); |
486 | 486 | } |
487 | 487 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -492,46 +492,46 @@ discard block |
||
492 | 492 | else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
493 | 493 | try { |
494 | 494 | $sth = $this->db->prepare($query); |
495 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
496 | - } catch(PDOException $e) { |
|
495 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
496 | + } catch (PDOException $e) { |
|
497 | 497 | echo "error : ".$e->getMessage(); |
498 | 498 | } |
499 | 499 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
500 | 500 | } else $all = array(); |
501 | 501 | } |
502 | 502 | if (empty($all)) { |
503 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
504 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
503 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
504 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
505 | 505 | } else { |
506 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
506 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
507 | 507 | } |
508 | 508 | if ($filter_name != '') { |
509 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
509 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
510 | 510 | } |
511 | 511 | $Spotter = new Spotter($this->db); |
512 | 512 | //$all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month); |
513 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
513 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
514 | 514 | } |
515 | 515 | return $all; |
516 | 516 | } |
517 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
517 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
518 | 518 | $Connection = new Connection(); |
519 | 519 | if ($filter_name == '') $filter_name = $this->filter_name; |
520 | 520 | if ($Connection->tableExists('countries')) { |
521 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
521 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
522 | 522 | $Spotter = new Spotter($this->db); |
523 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
523 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
524 | 524 | if ($year == '' && $month == '') { |
525 | 525 | $alliance_airlines = array(); |
526 | 526 | foreach ($airlines as $airline) { |
527 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
527 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
528 | 528 | } |
529 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
530 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
529 | + if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
530 | + else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
531 | 531 | try { |
532 | 532 | $sth = $this->db->prepare($query); |
533 | 533 | $sth->execute(array(':filter_name' => $filter_name)); |
534 | - } catch(PDOException $e) { |
|
534 | + } catch (PDOException $e) { |
|
535 | 535 | echo "error : ".$e->getMessage(); |
536 | 536 | } |
537 | 537 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
544 | 544 | try { |
545 | 545 | $sth = $this->db->prepare($query); |
546 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
547 | - } catch(PDOException $e) { |
|
546 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
547 | + } catch (PDOException $e) { |
|
548 | 548 | echo "error : ".$e->getMessage(); |
549 | 549 | } |
550 | 550 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | return array(); |
562 | 562 | } |
563 | 563 | } |
564 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
|
564 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
565 | 565 | global $globalStatsFilters; |
566 | 566 | if ($filter_name == '') $filter_name = $this->filter_name; |
567 | 567 | if ($year == '' && $month == '') { |
@@ -569,41 +569,41 @@ discard block |
||
569 | 569 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
570 | 570 | try { |
571 | 571 | $sth = $this->db->prepare($query); |
572 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
573 | - } catch(PDOException $e) { |
|
572 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
573 | + } catch (PDOException $e) { |
|
574 | 574 | echo "error : ".$e->getMessage(); |
575 | 575 | } |
576 | 576 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
577 | 577 | } else $all = array(); |
578 | 578 | if (empty($all)) { |
579 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
579 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
580 | 580 | if ($filter_name != '') { |
581 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
581 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
582 | 582 | } |
583 | 583 | $Spotter = new Spotter($this->db); |
584 | 584 | //$all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month); |
585 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
585 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
586 | 586 | } |
587 | 587 | return $all; |
588 | 588 | } |
589 | 589 | |
590 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
590 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
591 | 591 | global $globalStatsFilters; |
592 | 592 | if ($filter_name == '') $filter_name = $this->filter_name; |
593 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
593 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
594 | 594 | $Spotter = new Spotter($this->db); |
595 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
595 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
596 | 596 | if ($year == '' && $month == '') { |
597 | 597 | $alliance_airlines = array(); |
598 | 598 | foreach ($airlines as $airline) { |
599 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
599 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
600 | 600 | } |
601 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
602 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
601 | + if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
602 | + else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
603 | 603 | try { |
604 | 604 | $sth = $this->db->prepare($query); |
605 | 605 | $sth->execute(array(':filter_name' => $filter_name)); |
606 | - } catch(PDOException $e) { |
|
606 | + } catch (PDOException $e) { |
|
607 | 607 | echo "error : ".$e->getMessage(); |
608 | 608 | } |
609 | 609 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -614,45 +614,45 @@ discard block |
||
614 | 614 | else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
615 | 615 | try { |
616 | 616 | $sth = $this->db->prepare($query); |
617 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
618 | - } catch(PDOException $e) { |
|
617 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
618 | + } catch (PDOException $e) { |
|
619 | 619 | echo "error : ".$e->getMessage(); |
620 | 620 | } |
621 | 621 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
622 | 622 | } else $all = array(); |
623 | 623 | } |
624 | 624 | if (empty($all)) { |
625 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
626 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
625 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
626 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
627 | 627 | } else { |
628 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
628 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
629 | 629 | } |
630 | 630 | if ($filter_name != '') { |
631 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
631 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
632 | 632 | } |
633 | 633 | $Spotter = new Spotter($this->db); |
634 | 634 | //$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
635 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
635 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
636 | 636 | } |
637 | 637 | return $all; |
638 | 638 | } |
639 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
639 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
640 | 640 | global $globalStatsFilters; |
641 | 641 | if ($filter_name == '') $filter_name = $this->filter_name; |
642 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
642 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
643 | 643 | $Spotter = new Spotter($this->db); |
644 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
644 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
645 | 645 | if ($year == '' && $month == '') { |
646 | 646 | $alliance_airlines = array(); |
647 | 647 | foreach ($airlines as $airline) { |
648 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
648 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
649 | 649 | } |
650 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
651 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
650 | + if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
651 | + else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
652 | 652 | try { |
653 | 653 | $sth = $this->db->prepare($query); |
654 | 654 | $sth->execute(array(':filter_name' => $filter_name)); |
655 | - } catch(PDOException $e) { |
|
655 | + } catch (PDOException $e) { |
|
656 | 656 | echo "error : ".$e->getMessage(); |
657 | 657 | } |
658 | 658 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -663,27 +663,27 @@ discard block |
||
663 | 663 | else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
664 | 664 | try { |
665 | 665 | $sth = $this->db->prepare($query); |
666 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
667 | - } catch(PDOException $e) { |
|
666 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
667 | + } catch (PDOException $e) { |
|
668 | 668 | echo "error : ".$e->getMessage(); |
669 | 669 | } |
670 | 670 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
671 | 671 | } else $all = array(); |
672 | 672 | } |
673 | 673 | if (empty($all)) { |
674 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
675 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
674 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
675 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
676 | 676 | } else { |
677 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
677 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
678 | 678 | } |
679 | 679 | if ($filter_name != '') { |
680 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
680 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
681 | 681 | } |
682 | 682 | $Spotter = new Spotter($this->db); |
683 | 683 | // $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
684 | 684 | // $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
685 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
686 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
685 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
686 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
687 | 687 | $all = array(); |
688 | 688 | foreach ($pall as $value) { |
689 | 689 | $icao = $value['airport_departure_icao']; |
@@ -699,27 +699,27 @@ discard block |
||
699 | 699 | foreach ($all as $key => $row) { |
700 | 700 | $count[$key] = $row['airport_departure_icao_count']; |
701 | 701 | } |
702 | - array_multisort($count,SORT_DESC,$all); |
|
702 | + array_multisort($count, SORT_DESC, $all); |
|
703 | 703 | } |
704 | 704 | return $all; |
705 | 705 | } |
706 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
706 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
707 | 707 | global $globalStatsFilters; |
708 | 708 | if ($filter_name == '') $filter_name = $this->filter_name; |
709 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
709 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
710 | 710 | $Spotter = new Spotter($this->db); |
711 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
711 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
712 | 712 | if ($year == '' && $month == '') { |
713 | 713 | $alliance_airlines = array(); |
714 | 714 | foreach ($airlines as $airline) { |
715 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
715 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
716 | 716 | } |
717 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
718 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
717 | + if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
718 | + else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
719 | 719 | try { |
720 | 720 | $sth = $this->db->prepare($query); |
721 | 721 | $sth->execute(array(':filter_name' => $filter_name)); |
722 | - } catch(PDOException $e) { |
|
722 | + } catch (PDOException $e) { |
|
723 | 723 | echo "error : ".$e->getMessage(); |
724 | 724 | } |
725 | 725 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -730,27 +730,27 @@ discard block |
||
730 | 730 | else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
731 | 731 | try { |
732 | 732 | $sth = $this->db->prepare($query); |
733 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
734 | - } catch(PDOException $e) { |
|
733 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
734 | + } catch (PDOException $e) { |
|
735 | 735 | echo "error : ".$e->getMessage(); |
736 | 736 | } |
737 | 737 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
738 | 738 | } else $all = array(); |
739 | 739 | } |
740 | 740 | if (empty($all)) { |
741 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
742 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
741 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
742 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
743 | 743 | } else { |
744 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
744 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
745 | 745 | } |
746 | 746 | if ($filter_name != '') { |
747 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
747 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
748 | 748 | } |
749 | 749 | $Spotter = new Spotter($this->db); |
750 | 750 | // $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month); |
751 | 751 | // $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
752 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
753 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
752 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
753 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
754 | 754 | $all = array(); |
755 | 755 | foreach ($pall as $value) { |
756 | 756 | $icao = $value['airport_arrival_icao']; |
@@ -766,26 +766,26 @@ discard block |
||
766 | 766 | foreach ($all as $key => $row) { |
767 | 767 | $count[$key] = $row['airport_arrival_icao_count']; |
768 | 768 | } |
769 | - array_multisort($count,SORT_DESC,$all); |
|
769 | + array_multisort($count, SORT_DESC, $all); |
|
770 | 770 | } |
771 | 771 | return $all; |
772 | 772 | } |
773 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
773 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
774 | 774 | global $globalDBdriver, $globalStatsFilters; |
775 | 775 | if ($filter_name == '') $filter_name = $this->filter_name; |
776 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
776 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
777 | 777 | $Spotter = new Spotter($this->db); |
778 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
778 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
779 | 779 | $alliance_airlines = array(); |
780 | 780 | foreach ($airlines as $airline) { |
781 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
781 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
782 | 782 | } |
783 | 783 | if ($globalDBdriver == 'mysql') { |
784 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
785 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
784 | + if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
785 | + else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
786 | 786 | } else { |
787 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
788 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
787 | + if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
788 | + else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
789 | 789 | } |
790 | 790 | $query_data = array(':filter_name' => $filter_name); |
791 | 791 | } else { |
@@ -796,23 +796,23 @@ discard block |
||
796 | 796 | if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
797 | 797 | else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
798 | 798 | } |
799 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
799 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
800 | 800 | } |
801 | 801 | try { |
802 | 802 | $sth = $this->db->prepare($query); |
803 | 803 | $sth->execute($query_data); |
804 | - } catch(PDOException $e) { |
|
804 | + } catch (PDOException $e) { |
|
805 | 805 | echo "error : ".$e->getMessage(); |
806 | 806 | } |
807 | 807 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
808 | 808 | if (empty($all)) { |
809 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
810 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
809 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
810 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
811 | 811 | } else { |
812 | 812 | $filters = array('airlines' => array($stats_airline)); |
813 | 813 | } |
814 | 814 | if ($filter_name != '') { |
815 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
815 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
816 | 816 | } |
817 | 817 | $Spotter = new Spotter($this->db); |
818 | 818 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -820,57 +820,57 @@ discard block |
||
820 | 820 | return $all; |
821 | 821 | } |
822 | 822 | |
823 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
823 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
824 | 824 | global $globalStatsFilters; |
825 | 825 | if ($filter_name == '') $filter_name = $this->filter_name; |
826 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
826 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
827 | 827 | $Spotter = new Spotter($this->db); |
828 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
828 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
829 | 829 | $alliance_airlines = array(); |
830 | 830 | foreach ($airlines as $airline) { |
831 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
831 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
832 | 832 | } |
833 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
833 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
834 | 834 | $query_data = array(':filter_name' => $filter_name); |
835 | 835 | } else { |
836 | 836 | $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"; |
837 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
837 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
838 | 838 | } |
839 | 839 | try { |
840 | 840 | $sth = $this->db->prepare($query); |
841 | 841 | $sth->execute($query_data); |
842 | - } catch(PDOException $e) { |
|
842 | + } catch (PDOException $e) { |
|
843 | 843 | echo "error : ".$e->getMessage(); |
844 | 844 | } |
845 | 845 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
846 | 846 | if (empty($all)) { |
847 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
848 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
847 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
848 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
849 | 849 | } else { |
850 | 850 | $filters = array('airlines' => array($stats_airline)); |
851 | 851 | } |
852 | 852 | if ($filter_name != '') { |
853 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
853 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
854 | 854 | } |
855 | 855 | $Spotter = new Spotter($this->db); |
856 | 856 | $all = $Spotter->countAllDatesLastMonth($filters); |
857 | 857 | } |
858 | 858 | return $all; |
859 | 859 | } |
860 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
860 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
861 | 861 | global $globalDBdriver, $globalStatsFilters; |
862 | 862 | if ($filter_name == '') $filter_name = $this->filter_name; |
863 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
863 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
864 | 864 | $Spotter = new Spotter($this->db); |
865 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
865 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
866 | 866 | $alliance_airlines = array(); |
867 | 867 | foreach ($airlines as $airline) { |
868 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
868 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
869 | 869 | } |
870 | 870 | if ($globalDBdriver == 'mysql') { |
871 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
871 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
872 | 872 | } else { |
873 | - $query = "SELECT flight_date as date_name, SUM(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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
873 | + $query = "SELECT flight_date as date_name, SUM(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 IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
874 | 874 | } |
875 | 875 | $query_data = array(':filter_name' => $filter_name); |
876 | 876 | } else { |
@@ -879,60 +879,60 @@ discard block |
||
879 | 879 | } else { |
880 | 880 | $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"; |
881 | 881 | } |
882 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
882 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
883 | 883 | } |
884 | 884 | try { |
885 | 885 | $sth = $this->db->prepare($query); |
886 | 886 | $sth->execute($query_data); |
887 | - } catch(PDOException $e) { |
|
887 | + } catch (PDOException $e) { |
|
888 | 888 | echo "error : ".$e->getMessage(); |
889 | 889 | } |
890 | 890 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
891 | 891 | if (empty($all)) { |
892 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
893 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
892 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
893 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
894 | 894 | } else { |
895 | 895 | $filters = array('airlines' => array($stats_airline)); |
896 | 896 | } |
897 | 897 | if ($filter_name != '') { |
898 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
898 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
899 | 899 | } |
900 | 900 | $Spotter = new Spotter($this->db); |
901 | 901 | $all = $Spotter->countAllDatesLast7Days($filters); |
902 | 902 | } |
903 | 903 | return $all; |
904 | 904 | } |
905 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
905 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
906 | 906 | global $globalStatsFilters; |
907 | 907 | if ($filter_name == '') $filter_name = $this->filter_name; |
908 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
908 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
909 | 909 | $Spotter = new Spotter($this->db); |
910 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
910 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
911 | 911 | $alliance_airlines = array(); |
912 | 912 | foreach ($airlines as $airline) { |
913 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
913 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
914 | 914 | } |
915 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC"; |
|
915 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC"; |
|
916 | 916 | $query_data = array(':filter_name' => $filter_name); |
917 | 917 | } else { |
918 | 918 | $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 ORDER BY date_count DESC"; |
919 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
919 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
920 | 920 | } |
921 | 921 | try { |
922 | 922 | $sth = $this->db->prepare($query); |
923 | 923 | $sth->execute($query_data); |
924 | - } catch(PDOException $e) { |
|
924 | + } catch (PDOException $e) { |
|
925 | 925 | echo "error : ".$e->getMessage(); |
926 | 926 | } |
927 | 927 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
928 | 928 | if (empty($all)) { |
929 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
930 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
929 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
930 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
931 | 931 | } else { |
932 | 932 | $filters = array('airlines' => array($stats_airline)); |
933 | 933 | } |
934 | 934 | if ($filter_name != '') { |
935 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
935 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
936 | 936 | } |
937 | 937 | $Spotter = new Spotter($this->db); |
938 | 938 | $all = $Spotter->countAllDates($filters); |
@@ -947,34 +947,34 @@ discard block |
||
947 | 947 | try { |
948 | 948 | $sth = $this->db->prepare($query); |
949 | 949 | $sth->execute($query_data); |
950 | - } catch(PDOException $e) { |
|
950 | + } catch (PDOException $e) { |
|
951 | 951 | echo "error : ".$e->getMessage(); |
952 | 952 | } |
953 | 953 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
954 | 954 | if (empty($all)) { |
955 | 955 | $filters = array(); |
956 | 956 | if ($filter_name != '') { |
957 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
957 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
958 | 958 | } |
959 | 959 | $Spotter = new Spotter($this->db); |
960 | 960 | $all = $Spotter->countAllDatesByAirlines($filters); |
961 | 961 | } |
962 | 962 | return $all; |
963 | 963 | } |
964 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
964 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
965 | 965 | global $globalStatsFilters, $globalDBdriver; |
966 | 966 | if ($filter_name == '') $filter_name = $this->filter_name; |
967 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
967 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
968 | 968 | $Spotter = new Spotter($this->db); |
969 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
969 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
970 | 970 | $alliance_airlines = array(); |
971 | 971 | foreach ($airlines as $airline) { |
972 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
972 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
973 | 973 | } |
974 | 974 | if ($globalDBdriver == 'mysql') { |
975 | - $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
975 | + $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
976 | 976 | } else { |
977 | - $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
977 | + $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
978 | 978 | } |
979 | 979 | $query_data = array(':filter_name' => $filter_name); |
980 | 980 | } else { |
@@ -988,18 +988,18 @@ discard block |
||
988 | 988 | try { |
989 | 989 | $sth = $this->db->prepare($query); |
990 | 990 | $sth->execute($query_data); |
991 | - } catch(PDOException $e) { |
|
991 | + } catch (PDOException $e) { |
|
992 | 992 | echo "error : ".$e->getMessage(); |
993 | 993 | } |
994 | 994 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
995 | 995 | if (empty($all)) { |
996 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
997 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
996 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
997 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
998 | 998 | } else { |
999 | 999 | $filters = array('airlines' => array($stats_airline)); |
1000 | 1000 | } |
1001 | 1001 | if ($filter_name != '') { |
1002 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1002 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1003 | 1003 | } |
1004 | 1004 | $Spotter = new Spotter($this->db); |
1005 | 1005 | $all = $Spotter->countAllMonths($filters); |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | try { |
1017 | 1017 | $sth = $this->db->prepare($query); |
1018 | 1018 | $sth->execute(); |
1019 | - } catch(PDOException $e) { |
|
1019 | + } catch (PDOException $e) { |
|
1020 | 1020 | echo "error : ".$e->getMessage(); |
1021 | 1021 | } |
1022 | 1022 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | try { |
1037 | 1037 | $sth = $this->db->prepare($query); |
1038 | 1038 | $sth->execute(); |
1039 | - } catch(PDOException $e) { |
|
1039 | + } catch (PDOException $e) { |
|
1040 | 1040 | echo "error : ".$e->getMessage(); |
1041 | 1041 | } |
1042 | 1042 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1053,32 +1053,32 @@ discard block |
||
1053 | 1053 | try { |
1054 | 1054 | $sth = $this->db->prepare($query); |
1055 | 1055 | $sth->execute(array(':filter_name' => $filter_name)); |
1056 | - } catch(PDOException $e) { |
|
1056 | + } catch (PDOException $e) { |
|
1057 | 1057 | echo "error : ".$e->getMessage(); |
1058 | 1058 | } |
1059 | 1059 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1060 | 1060 | if (empty($all)) { |
1061 | 1061 | $filters = array(); |
1062 | 1062 | if ($filter_name != '') { |
1063 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1063 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1064 | 1064 | } |
1065 | 1065 | $Spotter = new Spotter($this->db); |
1066 | 1066 | $all = $Spotter->countAllMilitaryMonths($filters); |
1067 | 1067 | } |
1068 | 1068 | return $all; |
1069 | 1069 | } |
1070 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
1070 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
1071 | 1071 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
1072 | 1072 | if ($filter_name == '') $filter_name = $this->filter_name; |
1073 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1073 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1074 | 1074 | $Spotter = new Spotter($this->db); |
1075 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1075 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1076 | 1076 | $alliance_airlines = array(); |
1077 | 1077 | foreach ($airlines as $airline) { |
1078 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1078 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1079 | 1079 | } |
1080 | - if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1081 | - else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1080 | + if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1081 | + else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1082 | 1082 | $query_data = array(':filter_name' => $filter_name); |
1083 | 1083 | } else { |
1084 | 1084 | if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1096,37 +1096,37 @@ discard block |
||
1096 | 1096 | try { |
1097 | 1097 | $sth = $this->db->prepare($query); |
1098 | 1098 | $sth->execute($query_data); |
1099 | - } catch(PDOException $e) { |
|
1099 | + } catch (PDOException $e) { |
|
1100 | 1100 | echo "error : ".$e->getMessage(); |
1101 | 1101 | } |
1102 | 1102 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1103 | 1103 | if (empty($all)) { |
1104 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1105 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1104 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1105 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1106 | 1106 | } else { |
1107 | 1107 | $filters = array('airlines' => array($stats_airline)); |
1108 | 1108 | } |
1109 | 1109 | if ($filter_name != '') { |
1110 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1110 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1111 | 1111 | } |
1112 | 1112 | $Spotter = new Spotter($this->db); |
1113 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
1113 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
1114 | 1114 | } |
1115 | 1115 | return $all; |
1116 | 1116 | } |
1117 | - public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
1117 | + public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1118 | 1118 | global $globalStatsFilters; |
1119 | 1119 | if ($filter_name == '') $filter_name = $this->filter_name; |
1120 | 1120 | if ($year == '') $year = date('Y'); |
1121 | - $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1121 | + $all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1122 | 1122 | if (empty($all)) { |
1123 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1124 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1123 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1124 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1125 | 1125 | } else { |
1126 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1126 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1127 | 1127 | } |
1128 | 1128 | if ($filter_name != '') { |
1129 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1129 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1130 | 1130 | } |
1131 | 1131 | $Spotter = new Spotter($this->db); |
1132 | 1132 | //$all = $Spotter->countOverallFlights($filters,$year,$month); |
@@ -1134,16 +1134,16 @@ discard block |
||
1134 | 1134 | } |
1135 | 1135 | return $all; |
1136 | 1136 | } |
1137 | - public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
|
1137 | + public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') { |
|
1138 | 1138 | global $globalStatsFilters; |
1139 | 1139 | if ($filter_name == '') $filter_name = $this->filter_name; |
1140 | 1140 | if ($year == '') $year = date('Y'); |
1141 | - $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
|
1141 | + $all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month); |
|
1142 | 1142 | if (empty($all)) { |
1143 | 1143 | $filters = array(); |
1144 | - $filters = array('year' => $year,'month' => $month); |
|
1144 | + $filters = array('year' => $year, 'month' => $month); |
|
1145 | 1145 | if ($filter_name != '') { |
1146 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1146 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1147 | 1147 | } |
1148 | 1148 | $Spotter = new Spotter($this->db); |
1149 | 1149 | //$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
@@ -1151,19 +1151,19 @@ discard block |
||
1151 | 1151 | } |
1152 | 1152 | return $all; |
1153 | 1153 | } |
1154 | - public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
|
1154 | + public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1155 | 1155 | global $globalStatsFilters; |
1156 | 1156 | if ($filter_name == '') $filter_name = $this->filter_name; |
1157 | 1157 | if ($year == '') $year = date('Y'); |
1158 | - $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1158 | + $all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1159 | 1159 | if (empty($all)) { |
1160 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1161 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1160 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1161 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1162 | 1162 | } else { |
1163 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1163 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1164 | 1164 | } |
1165 | 1165 | if ($filter_name != '') { |
1166 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1166 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1167 | 1167 | } |
1168 | 1168 | $Spotter = new Spotter($this->db); |
1169 | 1169 | //$all = $Spotter->countOverallArrival($filters,$year,$month); |
@@ -1171,48 +1171,48 @@ discard block |
||
1171 | 1171 | } |
1172 | 1172 | return $all; |
1173 | 1173 | } |
1174 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
1174 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1175 | 1175 | global $globalStatsFilters; |
1176 | 1176 | if ($filter_name == '') $filter_name = $this->filter_name; |
1177 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1177 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1178 | 1178 | $Spotter = new Spotter($this->db); |
1179 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1179 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1180 | 1180 | if ($year == '' && $month == '') { |
1181 | 1181 | $alliance_airlines = array(); |
1182 | 1182 | foreach ($airlines as $airline) { |
1183 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1183 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1184 | 1184 | } |
1185 | - $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1185 | + $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1186 | 1186 | try { |
1187 | 1187 | $sth = $this->db->prepare($query); |
1188 | 1188 | $sth->execute(array(':filter_name' => $filter_name)); |
1189 | - } catch(PDOException $e) { |
|
1189 | + } catch (PDOException $e) { |
|
1190 | 1190 | echo "error : ".$e->getMessage(); |
1191 | 1191 | } |
1192 | 1192 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1193 | 1193 | $all = $result[0]['nb']; |
1194 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1194 | + } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1195 | 1195 | } else { |
1196 | 1196 | if ($year == '' && $month == '') { |
1197 | 1197 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
1198 | 1198 | try { |
1199 | 1199 | $sth = $this->db->prepare($query); |
1200 | - $sth->execute(array(':filter_name' => $filter_name,':stats_airline' => $stats_airline)); |
|
1201 | - } catch(PDOException $e) { |
|
1200 | + $sth->execute(array(':filter_name' => $filter_name, ':stats_airline' => $stats_airline)); |
|
1201 | + } catch (PDOException $e) { |
|
1202 | 1202 | echo "error : ".$e->getMessage(); |
1203 | 1203 | } |
1204 | 1204 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1205 | 1205 | $all = $result[0]['nb']; |
1206 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1206 | + } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1207 | 1207 | } |
1208 | 1208 | if (empty($all)) { |
1209 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1210 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1209 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1210 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1211 | 1211 | } else { |
1212 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1212 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1213 | 1213 | } |
1214 | 1214 | if ($filter_name != '') { |
1215 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1215 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1216 | 1216 | } |
1217 | 1217 | $Spotter = new Spotter($this->db); |
1218 | 1218 | //$all = $Spotter->countOverallAircrafts($filters,$year,$month); |
@@ -1220,7 +1220,7 @@ discard block |
||
1220 | 1220 | } |
1221 | 1221 | return $all; |
1222 | 1222 | } |
1223 | - public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
|
1223 | + public function countOverallAirlines($filter_name = '', $year = '', $month = '') { |
|
1224 | 1224 | global $globalStatsFilters; |
1225 | 1225 | if ($filter_name == '') $filter_name = $this->filter_name; |
1226 | 1226 | if ($year == '' && $month == '') { |
@@ -1228,17 +1228,17 @@ discard block |
||
1228 | 1228 | try { |
1229 | 1229 | $sth = $this->db->prepare($query); |
1230 | 1230 | $sth->execute(array(':filter_name' => $filter_name)); |
1231 | - } catch(PDOException $e) { |
|
1231 | + } catch (PDOException $e) { |
|
1232 | 1232 | echo "error : ".$e->getMessage(); |
1233 | 1233 | } |
1234 | 1234 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1235 | 1235 | $all = $result[0]['nb_airline']; |
1236 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
1236 | + } else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month); |
|
1237 | 1237 | if (empty($all)) { |
1238 | 1238 | $filters = array(); |
1239 | - $filters = array('year' => $year,'month' => $month); |
|
1239 | + $filters = array('year' => $year, 'month' => $month); |
|
1240 | 1240 | if ($filter_name != '') { |
1241 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1241 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1242 | 1242 | } |
1243 | 1243 | $Spotter = new Spotter($this->db); |
1244 | 1244 | //$all = $Spotter->countOverallAirlines($filters,$year,$month); |
@@ -1246,29 +1246,29 @@ discard block |
||
1246 | 1246 | } |
1247 | 1247 | return $all; |
1248 | 1248 | } |
1249 | - public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
1249 | + public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1250 | 1250 | global $globalStatsFilters; |
1251 | 1251 | if ($filter_name == '') $filter_name = $this->filter_name; |
1252 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1252 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1253 | 1253 | $Spotter = new Spotter($this->db); |
1254 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1254 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1255 | 1255 | if ($year == '' && $month == '') { |
1256 | 1256 | $alliance_airlines = array(); |
1257 | 1257 | foreach ($airlines as $airline) { |
1258 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1258 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1259 | 1259 | } |
1260 | - $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1260 | + $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1261 | 1261 | $query_values = array(':filter_name' => $filter_name); |
1262 | 1262 | try { |
1263 | 1263 | $sth = $this->db->prepare($query); |
1264 | 1264 | $sth->execute($query_values); |
1265 | - } catch(PDOException $e) { |
|
1265 | + } catch (PDOException $e) { |
|
1266 | 1266 | echo "error : ".$e->getMessage(); |
1267 | 1267 | } |
1268 | 1268 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1269 | 1269 | $all = $result[0]['nb']; |
1270 | 1270 | } else { |
1271 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1271 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1272 | 1272 | } |
1273 | 1273 | } else { |
1274 | 1274 | if ($year == '' && $month == '') { |
@@ -1277,23 +1277,23 @@ discard block |
||
1277 | 1277 | try { |
1278 | 1278 | $sth = $this->db->prepare($query); |
1279 | 1279 | $sth->execute($query_values); |
1280 | - } catch(PDOException $e) { |
|
1280 | + } catch (PDOException $e) { |
|
1281 | 1281 | echo "error : ".$e->getMessage(); |
1282 | 1282 | } |
1283 | 1283 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1284 | 1284 | $all = $result[0]['nb']; |
1285 | 1285 | } else { |
1286 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1286 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1287 | 1287 | } |
1288 | 1288 | } |
1289 | 1289 | if (empty($all)) { |
1290 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1291 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1290 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1291 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1292 | 1292 | } else { |
1293 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1293 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1294 | 1294 | } |
1295 | 1295 | if ($filter_name != '') { |
1296 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1296 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1297 | 1297 | } |
1298 | 1298 | $Spotter = new Spotter($this->db); |
1299 | 1299 | //$all = $Spotter->countOverallOwners($filters,$year,$month); |
@@ -1301,7 +1301,7 @@ discard block |
||
1301 | 1301 | } |
1302 | 1302 | return $all; |
1303 | 1303 | } |
1304 | - public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
1304 | + public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1305 | 1305 | global $globalStatsFilters; |
1306 | 1306 | if ($filter_name == '') $filter_name = $this->filter_name; |
1307 | 1307 | //if ($year == '') $year = date('Y'); |
@@ -1311,18 +1311,18 @@ discard block |
||
1311 | 1311 | try { |
1312 | 1312 | $sth = $this->db->prepare($query); |
1313 | 1313 | $sth->execute($query_values); |
1314 | - } catch(PDOException $e) { |
|
1314 | + } catch (PDOException $e) { |
|
1315 | 1315 | echo "error : ".$e->getMessage(); |
1316 | 1316 | } |
1317 | 1317 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1318 | 1318 | $all = $result[0]['nb']; |
1319 | 1319 | } else { |
1320 | - $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1320 | + $all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1321 | 1321 | } |
1322 | 1322 | if (empty($all)) { |
1323 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1323 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1324 | 1324 | if ($filter_name != '') { |
1325 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1325 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1326 | 1326 | } |
1327 | 1327 | $Spotter = new Spotter($this->db); |
1328 | 1328 | //$all = $Spotter->countOverallPilots($filters,$year,$month); |
@@ -1331,104 +1331,104 @@ discard block |
||
1331 | 1331 | return $all; |
1332 | 1332 | } |
1333 | 1333 | |
1334 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
1334 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
1335 | 1335 | if ($filter_name == '') $filter_name = $this->filter_name; |
1336 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1336 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1337 | 1337 | $Spotter = new Spotter($this->db); |
1338 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1338 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1339 | 1339 | $alliance_airlines = array(); |
1340 | 1340 | foreach ($airlines as $airline) { |
1341 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1341 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1342 | 1342 | } |
1343 | - $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY date"; |
|
1344 | - $query_values = array(':airport_icao' => $airport_icao,':filter_name' => $filter_name); |
|
1343 | + $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY date"; |
|
1344 | + $query_values = array(':airport_icao' => $airport_icao, ':filter_name' => $filter_name); |
|
1345 | 1345 | } else { |
1346 | 1346 | $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"; |
1347 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1347 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1348 | 1348 | } |
1349 | 1349 | try { |
1350 | 1350 | $sth = $this->db->prepare($query); |
1351 | 1351 | $sth->execute($query_values); |
1352 | - } catch(PDOException $e) { |
|
1352 | + } catch (PDOException $e) { |
|
1353 | 1353 | echo "error : ".$e->getMessage(); |
1354 | 1354 | } |
1355 | 1355 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1356 | 1356 | return $all; |
1357 | 1357 | } |
1358 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
1358 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
1359 | 1359 | if ($filter_name == '') $filter_name = $this->filter_name; |
1360 | 1360 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
1361 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1361 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1362 | 1362 | try { |
1363 | 1363 | $sth = $this->db->prepare($query); |
1364 | 1364 | $sth->execute($query_values); |
1365 | - } catch(PDOException $e) { |
|
1365 | + } catch (PDOException $e) { |
|
1366 | 1366 | echo "error : ".$e->getMessage(); |
1367 | 1367 | } |
1368 | 1368 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1369 | 1369 | return $all; |
1370 | 1370 | } |
1371 | - public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
|
1371 | + public function deleteStatsByType($type, $stats_airline = '', $filter_name = '') { |
|
1372 | 1372 | if ($filter_name == '') $filter_name = $this->filter_name; |
1373 | 1373 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1374 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1374 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1375 | 1375 | try { |
1376 | 1376 | $sth = $this->db->prepare($query); |
1377 | 1377 | $sth->execute($query_values); |
1378 | - } catch(PDOException $e) { |
|
1378 | + } catch (PDOException $e) { |
|
1379 | 1379 | echo "error : ".$e->getMessage(); |
1380 | 1380 | } |
1381 | 1381 | } |
1382 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
|
1382 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') { |
|
1383 | 1383 | if ($filter_name == '') $filter_name = $this->filter_name; |
1384 | 1384 | global $globalArchiveMonths, $globalDBdriver; |
1385 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1385 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1386 | 1386 | $Spotter = new Spotter($this->db); |
1387 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1387 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1388 | 1388 | $alliance_airlines = array(); |
1389 | 1389 | foreach ($airlines as $airline) { |
1390 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1390 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1391 | 1391 | } |
1392 | 1392 | if ($globalDBdriver == 'mysql') { |
1393 | 1393 | if ($month == '') { |
1394 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1394 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1395 | 1395 | $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name); |
1396 | 1396 | } else { |
1397 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1398 | - $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month); |
|
1397 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1398 | + $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month); |
|
1399 | 1399 | } |
1400 | 1400 | } else { |
1401 | 1401 | if ($month == '') { |
1402 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1402 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1403 | 1403 | $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name); |
1404 | 1404 | } else { |
1405 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1406 | - $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month); |
|
1405 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1406 | + $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month); |
|
1407 | 1407 | } |
1408 | 1408 | } |
1409 | 1409 | } else { |
1410 | 1410 | if ($globalDBdriver == 'mysql') { |
1411 | 1411 | if ($month == '') { |
1412 | 1412 | $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"; |
1413 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1413 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1414 | 1414 | } else { |
1415 | 1415 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1416 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
1416 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
1417 | 1417 | } |
1418 | 1418 | } else { |
1419 | 1419 | if ($month == '') { |
1420 | 1420 | $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"; |
1421 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1421 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1422 | 1422 | } else { |
1423 | 1423 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1424 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
1424 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
1425 | 1425 | } |
1426 | 1426 | } |
1427 | 1427 | } |
1428 | 1428 | try { |
1429 | 1429 | $sth = $this->db->prepare($query); |
1430 | 1430 | $sth->execute($query_values); |
1431 | - } catch(PDOException $e) { |
|
1431 | + } catch (PDOException $e) { |
|
1432 | 1432 | echo "error : ".$e->getMessage(); |
1433 | 1433 | } |
1434 | 1434 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1437,17 +1437,17 @@ discard block |
||
1437 | 1437 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
1438 | 1438 | global $globalArchiveMonths, $globalDBdriver; |
1439 | 1439 | if ($filter_name == '') $filter_name = $this->filter_name; |
1440 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1440 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1441 | 1441 | $Spotter = new Spotter($this->db); |
1442 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1442 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1443 | 1443 | $alliance_airlines = array(); |
1444 | 1444 | foreach ($airlines as $airline) { |
1445 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1445 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1446 | 1446 | } |
1447 | 1447 | if ($globalDBdriver == 'mysql') { |
1448 | - $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 IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1448 | + $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 IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1449 | 1449 | } else { |
1450 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1450 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1451 | 1451 | } |
1452 | 1452 | $query_values = array(':type' => $type, ':filter_name' => $filter_name); |
1453 | 1453 | } else { |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | try { |
1462 | 1462 | $sth = $this->db->prepare($query); |
1463 | 1463 | $sth->execute($query_values); |
1464 | - } catch(PDOException $e) { |
|
1464 | + } catch (PDOException $e) { |
|
1465 | 1465 | echo "error : ".$e->getMessage(); |
1466 | 1466 | } |
1467 | 1467 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1470,17 +1470,17 @@ discard block |
||
1470 | 1470 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
1471 | 1471 | global $globalArchiveMonths, $globalDBdriver; |
1472 | 1472 | if ($filter_name == '') $filter_name = $this->filter_name; |
1473 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1473 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1474 | 1474 | $Spotter = new Spotter($this->db); |
1475 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1475 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1476 | 1476 | $alliance_airlines = array(); |
1477 | 1477 | foreach ($airlines as $airline) { |
1478 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1478 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1479 | 1479 | } |
1480 | 1480 | if ($globalDBdriver == 'mysql') { |
1481 | - $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1481 | + $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1482 | 1482 | } else { |
1483 | - $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1483 | + $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1484 | 1484 | } |
1485 | 1485 | } else { |
1486 | 1486 | if ($globalDBdriver == 'mysql') { |
@@ -1492,7 +1492,7 @@ discard block |
||
1492 | 1492 | try { |
1493 | 1493 | $sth = $this->db->prepare($query); |
1494 | 1494 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
1495 | - } catch(PDOException $e) { |
|
1495 | + } catch (PDOException $e) { |
|
1496 | 1496 | echo "error : ".$e->getMessage(); |
1497 | 1497 | } |
1498 | 1498 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | try { |
1510 | 1510 | $sth = $this->db->prepare($query); |
1511 | 1511 | $sth->execute(array(':filter_name' => $filter_name)); |
1512 | - } catch(PDOException $e) { |
|
1512 | + } catch (PDOException $e) { |
|
1513 | 1513 | echo "error : ".$e->getMessage(); |
1514 | 1514 | } |
1515 | 1515 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1526,20 +1526,20 @@ discard block |
||
1526 | 1526 | try { |
1527 | 1527 | $sth = $this->db->prepare($query); |
1528 | 1528 | $sth->execute(array(':filter_name' => $filter_name)); |
1529 | - } catch(PDOException $e) { |
|
1529 | + } catch (PDOException $e) { |
|
1530 | 1530 | echo "error : ".$e->getMessage(); |
1531 | 1531 | } |
1532 | 1532 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1533 | 1533 | return $all[0]['total']; |
1534 | 1534 | } |
1535 | - public function getStatsOwner($owner_name,$filter_name = '') { |
|
1535 | + public function getStatsOwner($owner_name, $filter_name = '') { |
|
1536 | 1536 | global $globalArchiveMonths, $globalDBdriver; |
1537 | 1537 | if ($filter_name == '') $filter_name = $this->filter_name; |
1538 | 1538 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
1539 | 1539 | try { |
1540 | 1540 | $sth = $this->db->prepare($query); |
1541 | - $sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name)); |
|
1542 | - } catch(PDOException $e) { |
|
1541 | + $sth->execute(array(':filter_name' => $filter_name, ':owner_name' => $owner_name)); |
|
1542 | + } catch (PDOException $e) { |
|
1543 | 1543 | echo "error : ".$e->getMessage(); |
1544 | 1544 | } |
1545 | 1545 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1557,20 +1557,20 @@ discard block |
||
1557 | 1557 | try { |
1558 | 1558 | $sth = $this->db->prepare($query); |
1559 | 1559 | $sth->execute(array(':filter_name' => $filter_name)); |
1560 | - } catch(PDOException $e) { |
|
1560 | + } catch (PDOException $e) { |
|
1561 | 1561 | echo "error : ".$e->getMessage(); |
1562 | 1562 | } |
1563 | 1563 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1564 | 1564 | return $all[0]['total']; |
1565 | 1565 | } |
1566 | - public function getStatsPilot($pilot,$filter_name = '') { |
|
1566 | + public function getStatsPilot($pilot, $filter_name = '') { |
|
1567 | 1567 | global $globalArchiveMonths, $globalDBdriver; |
1568 | 1568 | if ($filter_name == '') $filter_name = $this->filter_name; |
1569 | 1569 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
1570 | 1570 | try { |
1571 | 1571 | $sth = $this->db->prepare($query); |
1572 | - $sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot)); |
|
1573 | - } catch(PDOException $e) { |
|
1572 | + $sth->execute(array(':filter_name' => $filter_name, ':pilot' => $pilot)); |
|
1573 | + } catch (PDOException $e) { |
|
1574 | 1574 | echo "error : ".$e->getMessage(); |
1575 | 1575 | } |
1576 | 1576 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | else return 0; |
1579 | 1579 | } |
1580 | 1580 | |
1581 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1581 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
1582 | 1582 | global $globalDBdriver; |
1583 | 1583 | if ($filter_name == '') $filter_name = $this->filter_name; |
1584 | 1584 | if ($globalDBdriver == 'mysql') { |
@@ -1586,15 +1586,15 @@ discard block |
||
1586 | 1586 | } else { |
1587 | 1587 | $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);"; |
1588 | 1588 | } |
1589 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1589 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1590 | 1590 | try { |
1591 | 1591 | $sth = $this->db->prepare($query); |
1592 | 1592 | $sth->execute($query_values); |
1593 | - } catch(PDOException $e) { |
|
1593 | + } catch (PDOException $e) { |
|
1594 | 1594 | return "error : ".$e->getMessage(); |
1595 | 1595 | } |
1596 | 1596 | } |
1597 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1597 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
1598 | 1598 | global $globalDBdriver; |
1599 | 1599 | if ($filter_name == '') $filter_name = $this->filter_name; |
1600 | 1600 | if ($globalDBdriver == 'mysql') { |
@@ -1603,11 +1603,11 @@ discard block |
||
1603 | 1603 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
1604 | 1604 | $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);"; |
1605 | 1605 | } |
1606 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1606 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1607 | 1607 | try { |
1608 | 1608 | $sth = $this->db->prepare($query); |
1609 | 1609 | $sth->execute($query_values); |
1610 | - } catch(PDOException $e) { |
|
1610 | + } catch (PDOException $e) { |
|
1611 | 1611 | return "error : ".$e->getMessage(); |
1612 | 1612 | } |
1613 | 1613 | } |
@@ -1631,75 +1631,75 @@ discard block |
||
1631 | 1631 | } |
1632 | 1632 | */ |
1633 | 1633 | |
1634 | - public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
|
1634 | + public function getStatsSource($stats_type, $year = '', $month = '', $day = '') { |
|
1635 | 1635 | global $globalDBdriver; |
1636 | 1636 | $query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
1637 | 1637 | $query_values = array(); |
1638 | 1638 | if ($globalDBdriver == 'mysql') { |
1639 | 1639 | if ($year != '') { |
1640 | 1640 | $query .= ' AND YEAR(stats_date) = :year'; |
1641 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1641 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1642 | 1642 | } |
1643 | 1643 | if ($month != '') { |
1644 | 1644 | $query .= ' AND MONTH(stats_date) = :month'; |
1645 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1645 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1646 | 1646 | } |
1647 | 1647 | if ($day != '') { |
1648 | 1648 | $query .= ' AND DAY(stats_date) = :day'; |
1649 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1649 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1650 | 1650 | } |
1651 | 1651 | } else { |
1652 | 1652 | if ($year != '') { |
1653 | 1653 | $query .= ' AND EXTRACT(YEAR FROM stats_date) = :year'; |
1654 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1654 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1655 | 1655 | } |
1656 | 1656 | if ($month != '') { |
1657 | 1657 | $query .= ' AND EXTRACT(MONTH FROM stats_date) = :month'; |
1658 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1658 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1659 | 1659 | } |
1660 | 1660 | if ($day != '') { |
1661 | 1661 | $query .= ' AND EXTRACT(DAY FROM stats_date) = :day'; |
1662 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1662 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1663 | 1663 | } |
1664 | 1664 | } |
1665 | 1665 | $query .= " ORDER BY source_name"; |
1666 | - $query_values = array_merge($query_values,array(':stats_type' => $stats_type)); |
|
1666 | + $query_values = array_merge($query_values, array(':stats_type' => $stats_type)); |
|
1667 | 1667 | try { |
1668 | 1668 | $sth = $this->db->prepare($query); |
1669 | 1669 | $sth->execute($query_values); |
1670 | - } catch(PDOException $e) { |
|
1670 | + } catch (PDOException $e) { |
|
1671 | 1671 | echo "error : ".$e->getMessage(); |
1672 | 1672 | } |
1673 | 1673 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1674 | 1674 | return $all; |
1675 | 1675 | } |
1676 | 1676 | |
1677 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
1677 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
1678 | 1678 | global $globalDBdriver; |
1679 | 1679 | if ($globalDBdriver == 'mysql') { |
1680 | 1680 | $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"; |
1681 | 1681 | } else { |
1682 | 1682 | $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);"; |
1683 | 1683 | } |
1684 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
1684 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
1685 | 1685 | try { |
1686 | 1686 | $sth = $this->db->prepare($query); |
1687 | 1687 | $sth->execute($query_values); |
1688 | - } catch(PDOException $e) { |
|
1688 | + } catch (PDOException $e) { |
|
1689 | 1689 | return "error : ".$e->getMessage(); |
1690 | 1690 | } |
1691 | 1691 | } |
1692 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
1692 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
1693 | 1693 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
1694 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1694 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1695 | 1695 | try { |
1696 | 1696 | $sth = $this->db->prepare($query); |
1697 | 1697 | $sth->execute($query_values); |
1698 | - } catch(PDOException $e) { |
|
1698 | + } catch (PDOException $e) { |
|
1699 | 1699 | return "error : ".$e->getMessage(); |
1700 | 1700 | } |
1701 | 1701 | } |
1702 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
|
1702 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1703 | 1703 | global $globalDBdriver; |
1704 | 1704 | if ($globalDBdriver == 'mysql') { |
1705 | 1705 | if ($reset) { |
@@ -1714,15 +1714,15 @@ discard block |
||
1714 | 1714 | $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);"; |
1715 | 1715 | } |
1716 | 1716 | } |
1717 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1717 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1718 | 1718 | try { |
1719 | 1719 | $sth = $this->db->prepare($query); |
1720 | 1720 | $sth->execute($query_values); |
1721 | - } catch(PDOException $e) { |
|
1721 | + } catch (PDOException $e) { |
|
1722 | 1722 | return "error : ".$e->getMessage(); |
1723 | 1723 | } |
1724 | 1724 | } |
1725 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
|
1725 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1726 | 1726 | global $globalDBdriver; |
1727 | 1727 | if ($globalDBdriver == 'mysql') { |
1728 | 1728 | if ($reset) { |
@@ -1737,15 +1737,15 @@ discard block |
||
1737 | 1737 | $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);"; |
1738 | 1738 | } |
1739 | 1739 | } |
1740 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1740 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1741 | 1741 | try { |
1742 | 1742 | $sth = $this->db->prepare($query); |
1743 | 1743 | $sth->execute($query_values); |
1744 | - } catch(PDOException $e) { |
|
1744 | + } catch (PDOException $e) { |
|
1745 | 1745 | return "error : ".$e->getMessage(); |
1746 | 1746 | } |
1747 | 1747 | } |
1748 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1748 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1749 | 1749 | global $globalDBdriver; |
1750 | 1750 | if ($globalDBdriver == 'mysql') { |
1751 | 1751 | if ($reset) { |
@@ -1760,15 +1760,15 @@ discard block |
||
1760 | 1760 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline; INSERT INTO stats_country (iso2,iso3,name,cnt,stats_airline,filter_name) SELECT :iso2,:iso3,:name,:cnt,:airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline);"; |
1761 | 1761 | } |
1762 | 1762 | } |
1763 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
1763 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name, ':airline' => $airline_icao); |
|
1764 | 1764 | try { |
1765 | 1765 | $sth = $this->db->prepare($query); |
1766 | 1766 | $sth->execute($query_values); |
1767 | - } catch(PDOException $e) { |
|
1767 | + } catch (PDOException $e) { |
|
1768 | 1768 | return "error : ".$e->getMessage(); |
1769 | 1769 | } |
1770 | 1770 | } |
1771 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1771 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1772 | 1772 | global $globalDBdriver; |
1773 | 1773 | if ($globalDBdriver == 'mysql') { |
1774 | 1774 | if ($reset) { |
@@ -1783,15 +1783,15 @@ discard block |
||
1783 | 1783 | $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);"; |
1784 | 1784 | } |
1785 | 1785 | } |
1786 | - $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); |
|
1786 | + $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); |
|
1787 | 1787 | try { |
1788 | 1788 | $sth = $this->db->prepare($query); |
1789 | 1789 | $sth->execute($query_values); |
1790 | - } catch(PDOException $e) { |
|
1790 | + } catch (PDOException $e) { |
|
1791 | 1791 | return "error : ".$e->getMessage(); |
1792 | 1792 | } |
1793 | 1793 | } |
1794 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
|
1794 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) { |
|
1795 | 1795 | global $globalDBdriver; |
1796 | 1796 | if ($globalDBdriver == 'mysql') { |
1797 | 1797 | if ($reset) { |
@@ -1806,15 +1806,15 @@ discard block |
||
1806 | 1806 | $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);"; |
1807 | 1807 | } |
1808 | 1808 | } |
1809 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1809 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1810 | 1810 | try { |
1811 | 1811 | $sth = $this->db->prepare($query); |
1812 | 1812 | $sth->execute($query_values); |
1813 | - } catch(PDOException $e) { |
|
1813 | + } catch (PDOException $e) { |
|
1814 | 1814 | return "error : ".$e->getMessage(); |
1815 | 1815 | } |
1816 | 1816 | } |
1817 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
|
1817 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) { |
|
1818 | 1818 | global $globalDBdriver; |
1819 | 1819 | if ($globalDBdriver == 'mysql') { |
1820 | 1820 | if ($reset) { |
@@ -1829,15 +1829,15 @@ discard block |
||
1829 | 1829 | $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);"; |
1830 | 1830 | } |
1831 | 1831 | } |
1832 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1832 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1833 | 1833 | try { |
1834 | 1834 | $sth = $this->db->prepare($query); |
1835 | 1835 | $sth->execute($query_values); |
1836 | - } catch(PDOException $e) { |
|
1836 | + } catch (PDOException $e) { |
|
1837 | 1837 | return "error : ".$e->getMessage(); |
1838 | 1838 | } |
1839 | 1839 | } |
1840 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
|
1840 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) { |
|
1841 | 1841 | global $globalDBdriver; |
1842 | 1842 | if ($globalDBdriver == 'mysql') { |
1843 | 1843 | if ($reset) { |
@@ -1852,15 +1852,15 @@ discard block |
||
1852 | 1852 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; |
1853 | 1853 | } |
1854 | 1854 | } |
1855 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
1855 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source); |
|
1856 | 1856 | try { |
1857 | 1857 | $sth = $this->db->prepare($query); |
1858 | 1858 | $sth->execute($query_values); |
1859 | - } catch(PDOException $e) { |
|
1859 | + } catch (PDOException $e) { |
|
1860 | 1860 | return "error : ".$e->getMessage(); |
1861 | 1861 | } |
1862 | 1862 | } |
1863 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1863 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1864 | 1864 | global $globalDBdriver; |
1865 | 1865 | if ($airport_icao != '') { |
1866 | 1866 | if ($globalDBdriver == 'mysql') { |
@@ -1876,16 +1876,16 @@ discard block |
||
1876 | 1876 | $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);"; |
1877 | 1877 | } |
1878 | 1878 | } |
1879 | - $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); |
|
1879 | + $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); |
|
1880 | 1880 | try { |
1881 | 1881 | $sth = $this->db->prepare($query); |
1882 | 1882 | $sth->execute($query_values); |
1883 | - } catch(PDOException $e) { |
|
1883 | + } catch (PDOException $e) { |
|
1884 | 1884 | return "error : ".$e->getMessage(); |
1885 | 1885 | } |
1886 | 1886 | } |
1887 | 1887 | } |
1888 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1888 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1889 | 1889 | global $globalDBdriver; |
1890 | 1890 | if ($airport_icao != '') { |
1891 | 1891 | if ($globalDBdriver == 'mysql') { |
@@ -1893,16 +1893,16 @@ discard block |
||
1893 | 1893 | } else { |
1894 | 1894 | $query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1895 | 1895 | } |
1896 | - $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); |
|
1896 | + $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); |
|
1897 | 1897 | try { |
1898 | 1898 | $sth = $this->db->prepare($query); |
1899 | 1899 | $sth->execute($query_values); |
1900 | - } catch(PDOException $e) { |
|
1900 | + } catch (PDOException $e) { |
|
1901 | 1901 | return "error : ".$e->getMessage(); |
1902 | 1902 | } |
1903 | 1903 | } |
1904 | 1904 | } |
1905 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1905 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1906 | 1906 | global $globalDBdriver; |
1907 | 1907 | if ($airport_icao != '') { |
1908 | 1908 | if ($globalDBdriver == 'mysql') { |
@@ -1918,16 +1918,16 @@ discard block |
||
1918 | 1918 | $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);"; |
1919 | 1919 | } |
1920 | 1920 | } |
1921 | - $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); |
|
1921 | + $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); |
|
1922 | 1922 | try { |
1923 | 1923 | $sth = $this->db->prepare($query); |
1924 | 1924 | $sth->execute($query_values); |
1925 | - } catch(PDOException $e) { |
|
1925 | + } catch (PDOException $e) { |
|
1926 | 1926 | return "error : ".$e->getMessage(); |
1927 | 1927 | } |
1928 | 1928 | } |
1929 | 1929 | } |
1930 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1930 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1931 | 1931 | global $globalDBdriver; |
1932 | 1932 | if ($airport_icao != '') { |
1933 | 1933 | if ($globalDBdriver == 'mysql') { |
@@ -1935,11 +1935,11 @@ discard block |
||
1935 | 1935 | } else { |
1936 | 1936 | $query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1937 | 1937 | } |
1938 | - $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); |
|
1938 | + $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); |
|
1939 | 1939 | try { |
1940 | 1940 | $sth = $this->db->prepare($query); |
1941 | 1941 | $sth->execute($query_values); |
1942 | - } catch(PDOException $e) { |
|
1942 | + } catch (PDOException $e) { |
|
1943 | 1943 | return "error : ".$e->getMessage(); |
1944 | 1944 | } |
1945 | 1945 | } |
@@ -1951,7 +1951,7 @@ discard block |
||
1951 | 1951 | try { |
1952 | 1952 | $sth = $this->db->prepare($query); |
1953 | 1953 | $sth->execute($query_values); |
1954 | - } catch(PDOException $e) { |
|
1954 | + } catch (PDOException $e) { |
|
1955 | 1955 | return "error : ".$e->getMessage(); |
1956 | 1956 | } |
1957 | 1957 | } |
@@ -1961,7 +1961,7 @@ discard block |
||
1961 | 1961 | try { |
1962 | 1962 | $sth = $this->db->prepare($query); |
1963 | 1963 | $sth->execute($query_values); |
1964 | - } catch(PDOException $e) { |
|
1964 | + } catch (PDOException $e) { |
|
1965 | 1965 | return "error : ".$e->getMessage(); |
1966 | 1966 | } |
1967 | 1967 | } |
@@ -1971,13 +1971,13 @@ discard block |
||
1971 | 1971 | try { |
1972 | 1972 | $sth = $this->db->prepare($query); |
1973 | 1973 | $sth->execute($query_values); |
1974 | - } catch(PDOException $e) { |
|
1974 | + } catch (PDOException $e) { |
|
1975 | 1975 | return "error : ".$e->getMessage(); |
1976 | 1976 | } |
1977 | 1977 | } |
1978 | 1978 | |
1979 | 1979 | public function addOldStats() { |
1980 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear, $globalAccidents; |
|
1980 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear, $globalAccidents; |
|
1981 | 1981 | $Common = new Common(); |
1982 | 1982 | $Connection = new Connection(); |
1983 | 1983 | date_default_timezone_set('UTC'); |
@@ -1995,41 +1995,41 @@ discard block |
||
1995 | 1995 | $Spotter = new Spotter($this->db); |
1996 | 1996 | |
1997 | 1997 | if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
1998 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1998 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
1999 | 1999 | foreach ($alldata as $number) { |
2000 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
|
2000 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset); |
|
2001 | 2001 | } |
2002 | 2002 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
2003 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
2003 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
2004 | 2004 | foreach ($alldata as $number) { |
2005 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
|
2005 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset); |
|
2006 | 2006 | } |
2007 | 2007 | if ($globalDebug) echo 'Count all registrations...'."\n"; |
2008 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
2008 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
2009 | 2009 | foreach ($alldata as $number) { |
2010 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
|
2010 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset); |
|
2011 | 2011 | } |
2012 | 2012 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
2013 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
2013 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
2014 | 2014 | foreach ($alldata as $number) { |
2015 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
2015 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
2016 | 2016 | } |
2017 | 2017 | if ($globalDebug) echo 'Count all owners...'."\n"; |
2018 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
2018 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
2019 | 2019 | foreach ($alldata as $number) { |
2020 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
|
2020 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset); |
|
2021 | 2021 | } |
2022 | 2022 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
2023 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
2023 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
2024 | 2024 | foreach ($alldata as $number) { |
2025 | 2025 | if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name']; |
2026 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
|
2026 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset); |
|
2027 | 2027 | } |
2028 | 2028 | |
2029 | 2029 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
2030 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
2030 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
2031 | 2031 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
2032 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
2032 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
2033 | 2033 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
2034 | 2034 | $alldata = array(); |
2035 | 2035 | foreach ($pall as $value) { |
@@ -2046,14 +2046,14 @@ discard block |
||
2046 | 2046 | foreach ($alldata as $key => $row) { |
2047 | 2047 | $count[$key] = $row['airport_departure_icao_count']; |
2048 | 2048 | } |
2049 | - array_multisort($count,SORT_DESC,$alldata); |
|
2049 | + array_multisort($count, SORT_DESC, $alldata); |
|
2050 | 2050 | foreach ($alldata as $number) { |
2051 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
|
2051 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', '', $reset); |
|
2052 | 2052 | } |
2053 | 2053 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
2054 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
2054 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
2055 | 2055 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
2056 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
2056 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
2057 | 2057 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
2058 | 2058 | $alldata = array(); |
2059 | 2059 | foreach ($pall as $value) { |
@@ -2070,18 +2070,18 @@ discard block |
||
2070 | 2070 | foreach ($alldata as $key => $row) { |
2071 | 2071 | $count[$key] = $row['airport_arrival_icao_count']; |
2072 | 2072 | } |
2073 | - array_multisort($count,SORT_DESC,$alldata); |
|
2073 | + array_multisort($count, SORT_DESC, $alldata); |
|
2074 | 2074 | foreach ($alldata as $number) { |
2075 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
|
2075 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', '', $reset); |
|
2076 | 2076 | } |
2077 | 2077 | if ($Connection->tableExists('countries')) { |
2078 | 2078 | if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
2079 | 2079 | //$SpotterArchive = new SpotterArchive(); |
2080 | 2080 | //$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
2081 | 2081 | $Spotter = new Spotter($this->db); |
2082 | - $alldata = $Spotter->countAllFlightOverCountries(false,0,$last_update_day); |
|
2082 | + $alldata = $Spotter->countAllFlightOverCountries(false, 0, $last_update_day); |
|
2083 | 2083 | foreach ($alldata as $number) { |
2084 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'','',$reset); |
|
2084 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', '', $reset); |
|
2085 | 2085 | } |
2086 | 2086 | } |
2087 | 2087 | |
@@ -2091,12 +2091,12 @@ discard block |
||
2091 | 2091 | $this->deleteStatsByType('fatalities_byyear'); |
2092 | 2092 | $alldata = $Accident->countFatalitiesByYear(); |
2093 | 2093 | foreach ($alldata as $number) { |
2094 | - $this->addStat('fatalities_byyear',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,1,1,$number['year']))); |
|
2094 | + $this->addStat('fatalities_byyear', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, 1, 1, $number['year']))); |
|
2095 | 2095 | } |
2096 | 2096 | $this->deleteStatsByType('fatalities_bymonth'); |
2097 | 2097 | $alldata = $Accident->countFatalitiesLast12Months(); |
2098 | 2098 | foreach ($alldata as $number) { |
2099 | - $this->addStat('fatalities_bymonth',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month'],1,$number['year']))); |
|
2099 | + $this->addStat('fatalities_bymonth', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month'], 1, $number['year']))); |
|
2100 | 2100 | } |
2101 | 2101 | } |
2102 | 2102 | |
@@ -2110,37 +2110,37 @@ discard block |
||
2110 | 2110 | $lastyear = false; |
2111 | 2111 | foreach ($alldata as $number) { |
2112 | 2112 | if ($number['year_name'] != date('Y')) $lastyear = true; |
2113 | - $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']))); |
|
2113 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2114 | 2114 | } |
2115 | 2115 | if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
2116 | 2116 | $alldata = $Spotter->countAllMilitaryMonths($filter_last_month); |
2117 | 2117 | foreach ($alldata as $number) { |
2118 | - $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']))); |
|
2118 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2119 | 2119 | } |
2120 | 2120 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
2121 | 2121 | $alldata = $Spotter->countAllMonthsOwners($filter_last_month); |
2122 | 2122 | foreach ($alldata as $number) { |
2123 | - $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']))); |
|
2123 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2124 | 2124 | } |
2125 | 2125 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
2126 | 2126 | $alldata = $Spotter->countAllMonthsPilots($filter_last_month); |
2127 | 2127 | foreach ($alldata as $number) { |
2128 | - $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']))); |
|
2128 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2129 | 2129 | } |
2130 | 2130 | if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
2131 | 2131 | $alldata = $Spotter->countAllMonthsAirlines($filter_last_month); |
2132 | 2132 | foreach ($alldata as $number) { |
2133 | - $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']))); |
|
2133 | + $this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2134 | 2134 | } |
2135 | 2135 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
2136 | 2136 | $alldata = $Spotter->countAllMonthsAircrafts($filter_last_month); |
2137 | 2137 | foreach ($alldata as $number) { |
2138 | - $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']))); |
|
2138 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2139 | 2139 | } |
2140 | 2140 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
2141 | 2141 | $alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month); |
2142 | 2142 | foreach ($alldata as $number) { |
2143 | - $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']))); |
|
2143 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2144 | 2144 | } |
2145 | 2145 | if ($globalDebug) echo 'Airports data...'."\n"; |
2146 | 2146 | if ($globalDebug) echo '...Departure'."\n"; |
@@ -2185,7 +2185,7 @@ discard block |
||
2185 | 2185 | } |
2186 | 2186 | $alldata = $pall; |
2187 | 2187 | foreach ($alldata as $number) { |
2188 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
2188 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
2189 | 2189 | } |
2190 | 2190 | echo '...Arrival'."\n"; |
2191 | 2191 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -2226,7 +2226,7 @@ discard block |
||
2226 | 2226 | } |
2227 | 2227 | $alldata = $pall; |
2228 | 2228 | foreach ($alldata as $number) { |
2229 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
2229 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
2230 | 2230 | } |
2231 | 2231 | |
2232 | 2232 | echo 'Flights data...'."\n"; |
@@ -2234,28 +2234,28 @@ discard block |
||
2234 | 2234 | echo '-> countAllDatesLastMonth...'."\n"; |
2235 | 2235 | $alldata = $Spotter->countAllDatesLastMonth($filter_last_month); |
2236 | 2236 | foreach ($alldata as $number) { |
2237 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
2237 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
2238 | 2238 | } |
2239 | 2239 | echo '-> countAllDates...'."\n"; |
2240 | 2240 | $previousdata = $this->countAllDates(); |
2241 | 2241 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
2242 | 2242 | $this->deleteStatFlight('date'); |
2243 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter_last_month)); |
|
2243 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter_last_month)); |
|
2244 | 2244 | $values = array(); |
2245 | 2245 | foreach ($alldata as $cnt) { |
2246 | 2246 | $values[] = $cnt['date_count']; |
2247 | 2247 | } |
2248 | - array_multisort($values,SORT_DESC,$alldata); |
|
2249 | - array_splice($alldata,11); |
|
2248 | + array_multisort($values, SORT_DESC, $alldata); |
|
2249 | + array_splice($alldata, 11); |
|
2250 | 2250 | foreach ($alldata as $number) { |
2251 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
2251 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
2252 | 2252 | } |
2253 | 2253 | |
2254 | 2254 | $this->deleteStatFlight('hour'); |
2255 | 2255 | echo '-> countAllHours...'."\n"; |
2256 | - $alldata = $Spotter->countAllHours('hour',$filter_last_month); |
|
2256 | + $alldata = $Spotter->countAllHours('hour', $filter_last_month); |
|
2257 | 2257 | foreach ($alldata as $number) { |
2258 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
2258 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
2259 | 2259 | } |
2260 | 2260 | |
2261 | 2261 | // Count by airlines |
@@ -2264,42 +2264,42 @@ discard block |
||
2264 | 2264 | if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
2265 | 2265 | $SpotterArchive = new SpotterArchive(); |
2266 | 2266 | //$Spotter = new Spotter($this->db); |
2267 | - $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
|
2267 | + $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false, 0, $last_update_day); |
|
2268 | 2268 | //$alldata = $Spotter->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
2269 | 2269 | foreach ($alldata as $number) { |
2270 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
|
2270 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], $number['airline_icao'], '', $reset); |
|
2271 | 2271 | } |
2272 | 2272 | } |
2273 | 2273 | if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
2274 | 2274 | $Spotter = new Spotter($this->db); |
2275 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
2275 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
2276 | 2276 | foreach ($alldata as $number) { |
2277 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
|
2277 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset); |
|
2278 | 2278 | } |
2279 | 2279 | if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
2280 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
2280 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
2281 | 2281 | foreach ($alldata as $number) { |
2282 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
|
2282 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset); |
|
2283 | 2283 | } |
2284 | 2284 | if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
2285 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
2285 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
2286 | 2286 | foreach ($alldata as $number) { |
2287 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
2287 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
2288 | 2288 | } |
2289 | 2289 | if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
2290 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
2290 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
2291 | 2291 | foreach ($alldata as $number) { |
2292 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
|
2292 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset); |
|
2293 | 2293 | } |
2294 | 2294 | if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
2295 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
2295 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
2296 | 2296 | foreach ($alldata as $number) { |
2297 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
|
2297 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset); |
|
2298 | 2298 | } |
2299 | 2299 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
2300 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2300 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
2301 | 2301 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
2302 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2302 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
2303 | 2303 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
2304 | 2304 | //$alldata = array(); |
2305 | 2305 | foreach ($dall as $value) { |
@@ -2319,12 +2319,12 @@ discard block |
||
2319 | 2319 | } |
2320 | 2320 | $alldata = $pall; |
2321 | 2321 | foreach ($alldata as $number) { |
2322 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
|
2322 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao'], '', $reset); |
|
2323 | 2323 | } |
2324 | 2324 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
2325 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2325 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
2326 | 2326 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
2327 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2327 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
2328 | 2328 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
2329 | 2329 | //$alldata = array(); |
2330 | 2330 | foreach ($dall as $value) { |
@@ -2344,7 +2344,7 @@ discard block |
||
2344 | 2344 | } |
2345 | 2345 | $alldata = $pall; |
2346 | 2346 | foreach ($alldata as $number) { |
2347 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
2347 | + if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao'], '', $reset); |
|
2348 | 2348 | } |
2349 | 2349 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
2350 | 2350 | $Spotter = new Spotter($this->db); |
@@ -2352,27 +2352,27 @@ discard block |
||
2352 | 2352 | $lastyear = false; |
2353 | 2353 | foreach ($alldata as $number) { |
2354 | 2354 | if ($number['year_name'] != date('Y')) $lastyear = true; |
2355 | - $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']); |
|
2355 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2356 | 2356 | } |
2357 | 2357 | if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
2358 | 2358 | $alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month); |
2359 | 2359 | foreach ($alldata as $number) { |
2360 | - $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']); |
|
2360 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2361 | 2361 | } |
2362 | 2362 | if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
2363 | 2363 | $alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month); |
2364 | 2364 | foreach ($alldata as $number) { |
2365 | - $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']); |
|
2365 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2366 | 2366 | } |
2367 | 2367 | if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
2368 | 2368 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month); |
2369 | 2369 | foreach ($alldata as $number) { |
2370 | - $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']); |
|
2370 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2371 | 2371 | } |
2372 | 2372 | if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
2373 | 2373 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month); |
2374 | 2374 | foreach ($alldata as $number) { |
2375 | - $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']); |
|
2375 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2376 | 2376 | } |
2377 | 2377 | if ($globalDebug) echo '...Departure'."\n"; |
2378 | 2378 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -2395,7 +2395,7 @@ discard block |
||
2395 | 2395 | } |
2396 | 2396 | $alldata = $pall; |
2397 | 2397 | foreach ($alldata as $number) { |
2398 | - $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']); |
|
2398 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']); |
|
2399 | 2399 | } |
2400 | 2400 | if ($globalDebug) echo '...Arrival'."\n"; |
2401 | 2401 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -2418,32 +2418,32 @@ discard block |
||
2418 | 2418 | } |
2419 | 2419 | $alldata = $pall; |
2420 | 2420 | foreach ($alldata as $number) { |
2421 | - $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']); |
|
2421 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']); |
|
2422 | 2422 | } |
2423 | 2423 | |
2424 | 2424 | if ($globalDebug) echo 'Flights data...'."\n"; |
2425 | 2425 | if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
2426 | 2426 | $alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month); |
2427 | 2427 | foreach ($alldata as $number) { |
2428 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
2428 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
2429 | 2429 | } |
2430 | 2430 | if ($globalDebug) echo '-> countAllDates...'."\n"; |
2431 | 2431 | //$previousdata = $this->countAllDatesByAirlines(); |
2432 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month)); |
|
2432 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines($filter_last_month)); |
|
2433 | 2433 | $values = array(); |
2434 | 2434 | foreach ($alldata as $cnt) { |
2435 | 2435 | $values[] = $cnt['date_count']; |
2436 | 2436 | } |
2437 | - array_multisort($values,SORT_DESC,$alldata); |
|
2438 | - array_splice($alldata,11); |
|
2437 | + array_multisort($values, SORT_DESC, $alldata); |
|
2438 | + array_splice($alldata, 11); |
|
2439 | 2439 | foreach ($alldata as $number) { |
2440 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
2440 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
2441 | 2441 | } |
2442 | 2442 | |
2443 | 2443 | if ($globalDebug) echo '-> countAllHours...'."\n"; |
2444 | - $alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month); |
|
2444 | + $alldata = $Spotter->countAllHoursByAirlines('hour', $filter_last_month); |
|
2445 | 2445 | foreach ($alldata as $number) { |
2446 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
2446 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
2447 | 2447 | } |
2448 | 2448 | |
2449 | 2449 | // Stats by filters |
@@ -2466,7 +2466,7 @@ discard block |
||
2466 | 2466 | $last_update_day = date('Y').'-01-01 00:00:00'; |
2467 | 2467 | } |
2468 | 2468 | } |
2469 | - if (isset($filter['DeleteLastYearStats']) && date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2469 | + if (isset($filter['DeleteLastYearStats']) && date('Y', strtotime($last_update_day)) != date('Y')) { |
|
2470 | 2470 | $last_update_day = date('Y').'-01-01 00:00:00'; |
2471 | 2471 | $reset = true; |
2472 | 2472 | } |
@@ -2475,32 +2475,32 @@ discard block |
||
2475 | 2475 | // Count by filter |
2476 | 2476 | if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
2477 | 2477 | $Spotter = new Spotter($this->db); |
2478 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
2478 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
2479 | 2479 | foreach ($alldata as $number) { |
2480 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
|
2480 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset); |
|
2481 | 2481 | } |
2482 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
2482 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
2483 | 2483 | foreach ($alldata as $number) { |
2484 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
|
2484 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset); |
|
2485 | 2485 | } |
2486 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
2486 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
2487 | 2487 | foreach ($alldata as $number) { |
2488 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
|
2488 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset); |
|
2489 | 2489 | } |
2490 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
2490 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
2491 | 2491 | foreach ($alldata as $number) { |
2492 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
|
2492 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset); |
|
2493 | 2493 | } |
2494 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
2494 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
2495 | 2495 | foreach ($alldata as $number) { |
2496 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
|
2496 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset); |
|
2497 | 2497 | } |
2498 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
2498 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
2499 | 2499 | foreach ($alldata as $number) { |
2500 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
|
2500 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset); |
|
2501 | 2501 | } |
2502 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
2503 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
2502 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
2503 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
2504 | 2504 | $alldata = array(); |
2505 | 2505 | foreach ($pall as $value) { |
2506 | 2506 | $icao = $value['airport_departure_icao']; |
@@ -2516,12 +2516,12 @@ discard block |
||
2516 | 2516 | foreach ($alldata as $key => $row) { |
2517 | 2517 | $count[$key] = $row['airport_departure_icao_count']; |
2518 | 2518 | } |
2519 | - array_multisort($count,SORT_DESC,$alldata); |
|
2519 | + array_multisort($count, SORT_DESC, $alldata); |
|
2520 | 2520 | foreach ($alldata as $number) { |
2521 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
|
2521 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name, $reset); |
|
2522 | 2522 | } |
2523 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2524 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2523 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
2524 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
2525 | 2525 | $alldata = array(); |
2526 | 2526 | foreach ($pall as $value) { |
2527 | 2527 | $icao = $value['airport_arrival_icao']; |
@@ -2537,40 +2537,40 @@ discard block |
||
2537 | 2537 | foreach ($alldata as $key => $row) { |
2538 | 2538 | $count[$key] = $row['airport_arrival_icao_count']; |
2539 | 2539 | } |
2540 | - array_multisort($count,SORT_DESC,$alldata); |
|
2540 | + array_multisort($count, SORT_DESC, $alldata); |
|
2541 | 2541 | foreach ($alldata as $number) { |
2542 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset); |
|
2542 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name, $reset); |
|
2543 | 2543 | } |
2544 | 2544 | $Spotter = new Spotter($this->db); |
2545 | 2545 | $alldata = $Spotter->countAllMonths($filter); |
2546 | 2546 | $lastyear = false; |
2547 | 2547 | foreach ($alldata as $number) { |
2548 | 2548 | if ($number['year_name'] != date('Y')) $lastyear = true; |
2549 | - $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); |
|
2549 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2550 | 2550 | } |
2551 | 2551 | $alldata = $Spotter->countAllMonthsOwners($filter); |
2552 | 2552 | foreach ($alldata as $number) { |
2553 | - $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); |
|
2553 | + $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); |
|
2554 | 2554 | } |
2555 | 2555 | $alldata = $Spotter->countAllMonthsPilots($filter); |
2556 | 2556 | foreach ($alldata as $number) { |
2557 | - $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); |
|
2557 | + $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); |
|
2558 | 2558 | } |
2559 | 2559 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
2560 | 2560 | foreach ($alldata as $number) { |
2561 | - $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2561 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2562 | 2562 | } |
2563 | 2563 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
2564 | 2564 | foreach ($alldata as $number) { |
2565 | - $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); |
|
2565 | + $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); |
|
2566 | 2566 | } |
2567 | 2567 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
2568 | 2568 | foreach ($alldata as $number) { |
2569 | - $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); |
|
2569 | + $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); |
|
2570 | 2570 | } |
2571 | 2571 | echo '...Departure'."\n"; |
2572 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
2573 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
2572 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
2573 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
2574 | 2574 | foreach ($dall as $value) { |
2575 | 2575 | $icao = $value['departure_airport_icao']; |
2576 | 2576 | $ddate = $value['date']; |
@@ -2588,11 +2588,11 @@ discard block |
||
2588 | 2588 | } |
2589 | 2589 | $alldata = $pall; |
2590 | 2590 | foreach ($alldata as $number) { |
2591 | - $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); |
|
2591 | + $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); |
|
2592 | 2592 | } |
2593 | 2593 | echo '...Arrival'."\n"; |
2594 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
2595 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
2594 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
2595 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
2596 | 2596 | foreach ($dall as $value) { |
2597 | 2597 | $icao = $value['arrival_airport_icao']; |
2598 | 2598 | $ddate = $value['date']; |
@@ -2610,39 +2610,39 @@ discard block |
||
2610 | 2610 | } |
2611 | 2611 | $alldata = $pall; |
2612 | 2612 | foreach ($alldata as $number) { |
2613 | - $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); |
|
2613 | + $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); |
|
2614 | 2614 | } |
2615 | 2615 | echo 'Flights data...'."\n"; |
2616 | 2616 | echo '-> countAllDatesLastMonth...'."\n"; |
2617 | 2617 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
2618 | 2618 | foreach ($alldata as $number) { |
2619 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
2619 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2620 | 2620 | } |
2621 | 2621 | echo '-> countAllDates...'."\n"; |
2622 | - $previousdata = $this->countAllDates('',$filter_name); |
|
2623 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
2622 | + $previousdata = $this->countAllDates('', $filter_name); |
|
2623 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
2624 | 2624 | $values = array(); |
2625 | 2625 | foreach ($alldata as $cnt) { |
2626 | 2626 | $values[] = $cnt['date_count']; |
2627 | 2627 | } |
2628 | - array_multisort($values,SORT_DESC,$alldata); |
|
2629 | - array_splice($alldata,11); |
|
2628 | + array_multisort($values, SORT_DESC, $alldata); |
|
2629 | + array_splice($alldata, 11); |
|
2630 | 2630 | foreach ($alldata as $number) { |
2631 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
2631 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2632 | 2632 | } |
2633 | 2633 | |
2634 | 2634 | echo '-> countAllHours...'."\n"; |
2635 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
2635 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
2636 | 2636 | foreach ($alldata as $number) { |
2637 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
2637 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
2638 | 2638 | } |
2639 | 2639 | echo 'Insert last stats update date...'."\n"; |
2640 | 2640 | date_default_timezone_set('UTC'); |
2641 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
2641 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
|
2642 | 2642 | if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
2643 | - if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2643 | + if (date('Y', strtotime($last_update_day)) != date('Y')) { |
|
2644 | 2644 | $this->deleteOldStats($filter_name); |
2645 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
2645 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
|
2646 | 2646 | } |
2647 | 2647 | } |
2648 | 2648 | } |
@@ -2653,16 +2653,16 @@ discard block |
||
2653 | 2653 | // SUM all previous month to put as year |
2654 | 2654 | $previous_year = date('Y'); |
2655 | 2655 | $previous_year--; |
2656 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2657 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2658 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2659 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2656 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2657 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2658 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2659 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2660 | 2660 | $allairlines = $this->getAllAirlineNames(); |
2661 | 2661 | foreach ($allairlines as $data) { |
2662 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2663 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2664 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2665 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2662 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2663 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2664 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2665 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2666 | 2666 | } |
2667 | 2667 | |
2668 | 2668 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -2671,7 +2671,7 @@ discard block |
||
2671 | 2671 | try { |
2672 | 2672 | $sth = $this->db->prepare($query); |
2673 | 2673 | $sth->execute(); |
2674 | - } catch(PDOException $e) { |
|
2674 | + } catch (PDOException $e) { |
|
2675 | 2675 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2676 | 2676 | } |
2677 | 2677 | } |
@@ -2680,15 +2680,15 @@ discard block |
||
2680 | 2680 | try { |
2681 | 2681 | $sth = $this->db->prepare($query); |
2682 | 2682 | $sth->execute(); |
2683 | - } catch(PDOException $e) { |
|
2683 | + } catch (PDOException $e) { |
|
2684 | 2684 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2685 | 2685 | } |
2686 | 2686 | } |
2687 | 2687 | if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
2688 | 2688 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
2689 | - if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
2689 | + if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
|
2690 | 2690 | $this->deleteOldStats(); |
2691 | - $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
2691 | + $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
|
2692 | 2692 | $lastyearupdate = true; |
2693 | 2693 | } |
2694 | 2694 | } |
@@ -2710,7 +2710,7 @@ discard block |
||
2710 | 2710 | try { |
2711 | 2711 | $sth = $this->db->prepare($query); |
2712 | 2712 | $sth->execute(); |
2713 | - } catch(PDOException $e) { |
|
2713 | + } catch (PDOException $e) { |
|
2714 | 2714 | return "error : ".$e->getMessage(); |
2715 | 2715 | } |
2716 | 2716 | } |
@@ -2724,14 +2724,14 @@ discard block |
||
2724 | 2724 | try { |
2725 | 2725 | $sth = $this->db->prepare($query); |
2726 | 2726 | $sth->execute(); |
2727 | - } catch(PDOException $e) { |
|
2727 | + } catch (PDOException $e) { |
|
2728 | 2728 | return "error : ".$e->getMessage(); |
2729 | 2729 | } |
2730 | 2730 | } |
2731 | 2731 | if (!isset($lastyearupdate)) { |
2732 | 2732 | echo 'Insert last stats update date...'."\n"; |
2733 | 2733 | date_default_timezone_set('UTC'); |
2734 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
2734 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
2735 | 2735 | } |
2736 | 2736 | if ($globalStatsResetYear) { |
2737 | 2737 | require_once(dirname(__FILE__).'/../install/class.settings.php'); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | print '<div class="column">'; |
16 | 16 | print '<h1>'._("Airlines").'</h1>'; |
17 | 17 | if (isset($_POST['airline_type'])) { |
18 | - $airline_type = filter_input(INPUT_POST,'airline_type',FILTER_SANITIZE_STRING); |
|
18 | + $airline_type = filter_input(INPUT_POST, 'airline_type', FILTER_SANITIZE_STRING); |
|
19 | 19 | //$airline_names = $Spotter->getAllAirlineNames($airline_type); |
20 | 20 | } else { |
21 | 21 | //$airline_names = $Spotter->getAllAirlineNames(); |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | print '<div class="alphabet">'; |
28 | 28 | foreach ($alliances as $alliance) { |
29 | 29 | print '<div class="alphabet-airline alphabet-item">'; |
30 | - print '<a href="'.$globalURL.'/airline/alliance_'.str_replace(' ','_',$alliance['alliance']).'">'; |
|
31 | - if (@getimagesize('images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png') || @getimagesize($globalURL.'/images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png')) |
|
30 | + print '<a href="'.$globalURL.'/airline/alliance_'.str_replace(' ', '_', $alliance['alliance']).'">'; |
|
31 | + if (@getimagesize('images/airlines/'.str_replace(' ', '_', $alliance['alliance']).'.png') || @getimagesize($globalURL.'/images/airlines/'.str_replace(' ', '_', $alliance['alliance']).'.png')) |
|
32 | 32 | { |
33 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png" alt="'._("Click to see alliance activity").'" title="'._("Click to see alliance activity").'" /> '; |
|
33 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace(' ', '_', $alliance['alliance']).'.png" alt="'._("Click to see alliance activity").'" title="'._("Click to see alliance activity").'" /> '; |
|
34 | 34 | } else print $alliance['alliance']; |
35 | 35 | print '</a>'; |
36 | 36 | print '</div>'; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $Stats = new Stats(); |
54 | 54 | if (isset($_POST['airline_type'])) |
55 | 55 | { |
56 | - $airline_type = filter_input(INPUT_POST,'airline_type',FILTER_SANITIZE_STRING); |
|
56 | + $airline_type = filter_input(INPUT_POST, 'airline_type', FILTER_SANITIZE_STRING); |
|
57 | 57 | //$airline_names = $Stats->getAllAirlineNames($airline_type); |
58 | 58 | $airline_names = $Spotter->getAllAirlineNames($airline_type); |
59 | 59 | } else { |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | } |
67 | 67 | $previous = null; |
68 | 68 | print '<div class="alphabet-legend">'; |
69 | - foreach($airline_names as $value) |
|
69 | + foreach ($airline_names as $value) |
|
70 | 70 | { |
71 | 71 | //echo $value['airline_name']."\n"; |
72 | 72 | //echo mb_substr($value['airline_name'],0,1).' - '.$value['airline_name']."\n"; |
73 | - $firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8'); |
|
74 | - if($previous !== $firstLetter) |
|
73 | + $firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1), 'UTF-8'); |
|
74 | + if ($previous !== $firstLetter) |
|
75 | 75 | { |
76 | 76 | if ($previous !== null) print ' | '; |
77 | 77 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | } |
81 | 81 | print '</div>'; |
82 | 82 | $previous = null; |
83 | - foreach($airline_names as $value) { |
|
83 | + foreach ($airline_names as $value) { |
|
84 | 84 | $firstLetter = strtoupper(substr($value['airline_name'], 0, 1)); |
85 | 85 | if ($firstLetter != "") |
86 | 86 | { |
87 | - if($previous !== $firstLetter) |
|
87 | + if ($previous !== $firstLetter) |
|
88 | 88 | { |
89 | 89 | if ($previous !== null) print '</div>'; |
90 | 90 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | $Spotter = new Spotter(); |
24 | 24 | $alliances = $Spotter->getAllAllianceNames(); |
25 | 25 | if (!empty($alliances)) { |
26 | - foreach($alliances as $alliance) { |
|
27 | - if (isset($airline_icao) && str_replace('_',' ',str_replace('alliance_','',$airline_icao)) == $alliance['alliance']) { |
|
28 | - print '<option value="alliance_'.str_replace(' ','_',$alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>'; |
|
26 | + foreach ($alliances as $alliance) { |
|
27 | + if (isset($airline_icao) && str_replace('_', ' ', str_replace('alliance_', '', $airline_icao)) == $alliance['alliance']) { |
|
28 | + print '<option value="alliance_'.str_replace(' ', '_', $alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>'; |
|
29 | 29 | } else { |
30 | - print '<option value="alliance_'.str_replace(' ','_',$alliance['alliance']).'">'.$alliance['alliance'].'</option>'; |
|
30 | + print '<option value="alliance_'.str_replace(' ', '_', $alliance['alliance']).'">'.$alliance['alliance'].'</option>'; |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | print '<option disabled>──────────</option>'; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $Stats = new Stats(); |
36 | 36 | if (!isset($filter_name)) $filter_name = ''; |
37 | 37 | $airlines = $Stats->getAllAirlineNames($filter_name); |
38 | - foreach($airlines as $airline) { |
|
38 | + foreach ($airlines as $airline) { |
|
39 | 39 | if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) { |
40 | 40 | print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>'; |
41 | 41 | } else { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | if (!isset($type) || $type == 'aircraft') { |
59 | 59 | ?> |
60 | 60 | <li class="dropdown"> |
61 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
61 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
62 | 62 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
63 | 63 | </a> |
64 | 64 | <ul class="dropdown-menu"> |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | </ul> |
70 | 70 | </li> |
71 | 71 | <li class="dropdown"> |
72 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
72 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
73 | 73 | <?php echo _("Airline"); ?> <span class="caret"></span> |
74 | 74 | </a> |
75 | 75 | <ul class="dropdown-menu" role="menu"> |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | </ul> |
86 | 86 | </li> |
87 | 87 | <li class="dropdown"> |
88 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
88 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
89 | 89 | <?php echo _("Airport"); ?> <span class="caret"></span> |
90 | 90 | </a> |
91 | 91 | <ul class="dropdown-menu" role="menu"> |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | </ul> |
97 | 97 | </li> |
98 | 98 | <li class="dropdown"> |
99 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
99 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
100 | 100 | <?php echo _("Route"); ?> <span class="caret"></span> |
101 | 101 | </a> |
102 | 102 | <ul class="dropdown-menu" role="menu"> |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | </ul> |
106 | 106 | </li> |
107 | 107 | <li class="dropdown"> |
108 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
108 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
109 | 109 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
110 | 110 | </a> |
111 | 111 | <ul class="dropdown-menu" role="menu"> |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
118 | 118 | ?> |
119 | 119 | <li class="dropdown"> |
120 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
120 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
121 | 121 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
122 | 122 | </a> |
123 | 123 | <ul class="dropdown-menu" role="menu"> |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } elseif ($type == 'marine' || $type == 'tracker') { |
133 | 133 | ?> |
134 | 134 | <li class="dropdown"> |
135 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
135 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
136 | 136 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
137 | 137 | </a> |
138 | 138 | <ul class="dropdown-menu" role="menu"> |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if (!isset($type) || $type == 'aircraft') { |
155 | 155 | ?> |
156 | 156 | <li class="dropdown"> |
157 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
157 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
158 | 158 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
159 | 159 | </a> |
160 | 160 | <ul class="dropdown-menu"> |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | </ul> |
166 | 166 | </li> |
167 | 167 | <li class="dropdown"> |
168 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
168 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
169 | 169 | <?php echo _("Airline"); ?> <span class="caret"></span> |
170 | 170 | </a> |
171 | 171 | <ul class="dropdown-menu" role="menu"> |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | </ul> |
182 | 182 | </li> |
183 | 183 | <li class="dropdown"> |
184 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
184 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
185 | 185 | <?php echo _("Airport"); ?> <span class="caret"></span> |
186 | 186 | </a> |
187 | 187 | <ul class="dropdown-menu" role="menu"> |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | </li> |
194 | 194 | <!-- |
195 | 195 | <li class="dropdown"> |
196 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
196 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
197 | 197 | <?php echo _("Route"); ?> <span class="caret"></span> |
198 | 198 | </a> |
199 | 199 | <ul class="dropdown-menu" role="menu"> |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | --> |
205 | 205 | <!-- |
206 | 206 | <li class="dropdown"> |
207 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
207 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
208 | 208 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
209 | 209 | </a> |
210 | 210 | <ul class="dropdown-menu" role="menu"> |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | ?> |
219 | 219 | <!-- |
220 | 220 | <li class="dropdown"> |
221 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
221 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
222 | 222 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
223 | 223 | </a> |
224 | 224 | <ul class="dropdown-menu" role="menu"> |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | } elseif ($type == 'marine' || $type == 'tracker') { |
235 | 235 | ?> |
236 | 236 | <li class="dropdown"> |
237 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
237 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
238 | 238 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
239 | 239 | </a> |
240 | 240 | <ul class="dropdown-menu" role="menu"> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!isset($filter_name)) $filter_name = ''; |
22 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
22 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
23 | 23 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
24 | 24 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
25 | 25 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
29 | 29 | if (isset($airline_info[0]['name'])) { |
30 | 30 | $airline_name = $airline_info[0]['name']; |
31 | - } elseif (strpos($airline_icao,'alliance_') !== FALSE) { |
|
31 | + } elseif (strpos($airline_icao, 'alliance_') !== FALSE) { |
|
32 | 32 | $alliance_name = $airline_icao; |
33 | 33 | } |
34 | 34 | } |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | $title = _("Statistics"); |
39 | 39 | } |
40 | 40 | |
41 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
42 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
41 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
42 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
43 | 43 | |
44 | 44 | require_once('header.php'); |
45 | 45 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | date_default_timezone_set('UTC'); |
67 | 67 | $lastupdate = strtotime($last_update[0]['value']); |
68 | 68 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
69 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
69 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | ?> |
@@ -78,31 +78,31 @@ discard block |
||
78 | 78 | <?php |
79 | 79 | if ($type == 'aircraft') { |
80 | 80 | ?> |
81 | - <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span> |
|
82 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
83 | - <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
84 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
81 | + <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span> |
|
82 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
83 | + <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
84 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
85 | 85 | <?php |
86 | 86 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
87 | 87 | ?> |
88 | - <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
89 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
88 | + <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
89 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
90 | 90 | <?php |
91 | 91 | } |
92 | 92 | if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
93 | 93 | ?> |
94 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
|
95 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
94 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span> |
|
95 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
96 | 96 | <?php |
97 | 97 | } |
98 | 98 | ?> |
99 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
100 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
99 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
100 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
101 | 101 | <?php |
102 | 102 | if ($airline_icao == '') { |
103 | 103 | ?> |
104 | - <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
105 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
104 | + <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
105 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
106 | 106 | <?php |
107 | 107 | } |
108 | 108 | ?> |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) { |
111 | 111 | if ($airline_icao == '' || $airline_icao == 'all') { |
112 | 112 | ?> |
113 | - <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span> |
|
114 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
113 | + <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span> |
|
114 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
115 | 115 | <?php |
116 | 116 | } |
117 | 117 | } |
@@ -119,22 +119,22 @@ discard block |
||
119 | 119 | <?php |
120 | 120 | } elseif ($type == 'marine') { |
121 | 121 | ?> |
122 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(),$year,$month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
123 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
124 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
125 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
122 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(), $year, $month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
123 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
124 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
125 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
126 | 126 | <?php |
127 | 127 | } elseif ($type == 'tracker') { |
128 | 128 | ?> |
129 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(),$year,$month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
130 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
131 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
132 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
129 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(), $year, $month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
130 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
131 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
132 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
133 | 133 | <?php |
134 | 134 | } |
135 | 135 | ?> |
136 | 136 | </p> |
137 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
137 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
138 | 138 | <div class="specific-stats"> |
139 | 139 | <?php |
140 | 140 | if ($type == 'aircraft') { |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | <div class="col-md-6"> |
144 | 144 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
145 | 145 | <?php |
146 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
146 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
147 | 147 | if (count($aircraft_array) == 0) { |
148 | 148 | print _("No data available"); |
149 | 149 | } else { |
150 | 150 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
151 | 151 | $aircraft_data = ''; |
152 | - foreach($aircraft_array as $aircraft_item) { |
|
152 | + foreach ($aircraft_array as $aircraft_item) { |
|
153 | 153 | if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
154 | 154 | else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
155 | 155 | } |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | ?> |
179 | 179 | </div> |
180 | 180 | </div> |
181 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
181 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
182 | 182 | <?php |
183 | 183 | if ($airline_icao == '' || $airline_icao == 'all') { |
184 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
184 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
185 | 185 | if (count($airline_array) > 0) { |
186 | 186 | print '<div class="col-md-6">'; |
187 | 187 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
188 | 188 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
189 | 189 | $airline_data = ''; |
190 | - foreach($airline_array as $airline_item) { |
|
190 | + foreach ($airline_array as $airline_item) { |
|
191 | 191 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
192 | 192 | } |
193 | 193 | $airline_data = substr($airline_data, 0, -1); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | ?> |
214 | 214 | </div> |
215 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
215 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
216 | 216 | <?php |
217 | 217 | } |
218 | 218 | } |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | <div class="col-md-6"> |
225 | 225 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
226 | 226 | <?php |
227 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
227 | + $marine_array = $Marine->countAllMarineTypes(true, 0, '', array(), $year, $month); |
|
228 | 228 | if (count($marine_array) == 0) print _("No data available"); |
229 | 229 | else { |
230 | 230 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
231 | 231 | $marine_data = ''; |
232 | - foreach($marine_array as $marine_item) { |
|
232 | + foreach ($marine_array as $marine_item) { |
|
233 | 233 | $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
234 | 234 | } |
235 | 235 | $marine_data = substr($marine_data, 0, -1); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | ?> |
260 | 260 | </div> |
261 | 261 | </div> |
262 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
262 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
263 | 263 | <!-- </div>--> |
264 | 264 | <?php |
265 | 265 | } |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | <div class="col-md-6"> |
270 | 270 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
271 | 271 | <?php |
272 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
272 | + $tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month); |
|
273 | 273 | if (count($tracker_array) == 0) print _("No data available"); |
274 | 274 | else { |
275 | 275 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
276 | 276 | $tracker_data = ''; |
277 | - foreach($tracker_array as $tracker_item) { |
|
277 | + foreach ($tracker_array as $tracker_item) { |
|
278 | 278 | $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
279 | 279 | } |
280 | 280 | $tracker_data = substr($tracker_data, 0, -1); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | ?> |
305 | 305 | </div> |
306 | 306 | </div> |
307 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
307 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
308 | 308 | <!-- </div>--> |
309 | 309 | <?php |
310 | 310 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | ?> |
313 | 313 | <div class="row column"> |
314 | 314 | <?php |
315 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
315 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
316 | 316 | //if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
317 | 317 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
318 | 318 | if (empty($flightover_array)) { |
@@ -323,12 +323,12 @@ discard block |
||
323 | 323 | ?> |
324 | 324 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
325 | 325 | <?php |
326 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
326 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
327 | 327 | if (count($pilot_array) == 0) print _("No data available"); |
328 | 328 | else { |
329 | 329 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
330 | 330 | $pilot_data = ''; |
331 | - foreach($pilot_array as $pilot_item) { |
|
331 | + foreach ($pilot_array as $pilot_item) { |
|
332 | 332 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
333 | 333 | } |
334 | 334 | $pilot_data = substr($pilot_data, 0, -1); |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | ?> |
350 | 350 | </div> |
351 | 351 | |
352 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
352 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
353 | 353 | <?php |
354 | 354 | } |
355 | 355 | // else { |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | <div class="col-md-6"> |
359 | 359 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
360 | 360 | <?php |
361 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
361 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
362 | 362 | if (count($owner_array) == 0) print _("No data available"); |
363 | 363 | else { |
364 | 364 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
365 | 365 | $owner_data = ''; |
366 | - foreach($owner_array as $owner_item) { |
|
366 | + foreach ($owner_array as $owner_item) { |
|
367 | 367 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
368 | 368 | } |
369 | 369 | $owner_data = substr($owner_data, 0, -1); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | </div> |
383 | 383 | </div> |
384 | 384 | |
385 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
385 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
386 | 386 | <?php |
387 | 387 | } |
388 | 388 | if (!empty($flightover_array)) { |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
397 | 397 | print 'var series = ['; |
398 | 398 | $flightover_data = ''; |
399 | - foreach($flightover_array as $flightover_item) { |
|
399 | + foreach ($flightover_array as $flightover_item) { |
|
400 | 400 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
401 | 401 | } |
402 | 402 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | } |
442 | 442 | ?> |
443 | 443 | </div> |
444 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
444 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
445 | 445 | </div> |
446 | 446 | <?php |
447 | 447 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
458 | 458 | print 'var series = ['; |
459 | 459 | $flightover_data = ''; |
460 | - foreach($flightover_array as $flightover_item) { |
|
460 | + foreach ($flightover_array as $flightover_item) { |
|
461 | 461 | $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
462 | 462 | } |
463 | 463 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
515 | 515 | print 'var series = ['; |
516 | 516 | $flightover_data = ''; |
517 | - foreach($flightover_array as $flightover_item) { |
|
517 | + foreach ($flightover_array as $flightover_item) { |
|
518 | 518 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
519 | 519 | } |
520 | 520 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -564,14 +564,14 @@ discard block |
||
564 | 564 | <div class="row column"> |
565 | 565 | <div class="col-md-6"> |
566 | 566 | <?php |
567 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
567 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
568 | 568 | if (count($airport_airport_array) > 0) { |
569 | 569 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
570 | 570 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
571 | 571 | print "\n"; |
572 | 572 | print 'var series = ['; |
573 | 573 | $airport_data = ''; |
574 | - foreach($airport_airport_array as $airport_item) { |
|
574 | + foreach ($airport_airport_array as $airport_item) { |
|
575 | 575 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
576 | 576 | } |
577 | 577 | $airport_data = substr($airport_data, 0, -1); |
@@ -621,18 +621,18 @@ discard block |
||
621 | 621 | } |
622 | 622 | ?> |
623 | 623 | </div> |
624 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
624 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
625 | 625 | |
626 | 626 | <div class="col-md-6"> |
627 | 627 | <?php |
628 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
628 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
629 | 629 | if (count($airport_airport_array2) > 0) { |
630 | 630 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
631 | 631 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
632 | 632 | print "\n"; |
633 | 633 | print 'var series = ['; |
634 | 634 | $airport_data = ''; |
635 | - foreach($airport_airport_array2 as $airport_item) |
|
635 | + foreach ($airport_airport_array2 as $airport_item) |
|
636 | 636 | { |
637 | 637 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
638 | 638 | } |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | ?> |
685 | 685 | </div> |
686 | 686 | </div> |
687 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
687 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
688 | 688 | <?php |
689 | 689 | } |
690 | 690 | if ($type == 'aircraft') { |
@@ -696,18 +696,18 @@ discard block |
||
696 | 696 | <div class="col-md-6"> |
697 | 697 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
698 | 698 | <?php |
699 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
699 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
700 | 700 | if (count($year_array) == 0) print _("No data available"); |
701 | 701 | else { |
702 | 702 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
703 | 703 | $year_data = ''; |
704 | 704 | $year_cnt = ''; |
705 | - foreach($year_array as $year_item) { |
|
705 | + foreach ($year_array as $year_item) { |
|
706 | 706 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
707 | 707 | $year_cnt .= $year_item['date_count'].','; |
708 | 708 | } |
709 | 709 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
710 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
710 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
711 | 711 | print 'c3.generate({ |
712 | 712 | bindto: "#chart8", |
713 | 713 | data: { x: "x", |
@@ -720,22 +720,22 @@ discard block |
||
720 | 720 | <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
721 | 721 | </div> |
722 | 722 | </div> |
723 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
723 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
724 | 724 | <div class="col-md-6"> |
725 | 725 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
726 | 726 | <?php |
727 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
727 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
728 | 728 | if (count($month_array) == 0) print _("No data available"); |
729 | 729 | else { |
730 | 730 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
731 | 731 | $month_data = ''; |
732 | 732 | $month_cnt = ''; |
733 | - foreach($month_array as $month_item) { |
|
733 | + foreach ($month_array as $month_item) { |
|
734 | 734 | $month_data .= '"'.$month_item['date_name'].'",'; |
735 | 735 | $month_cnt .= $month_item['date_count'].','; |
736 | 736 | } |
737 | 737 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
738 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
738 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
739 | 739 | print 'c3.generate({ |
740 | 740 | bindto: "#chart9", |
741 | 741 | data: { x: "x", |
@@ -748,23 +748,23 @@ discard block |
||
748 | 748 | <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
749 | 749 | </div> |
750 | 750 | </div> |
751 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
751 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
752 | 752 | |
753 | 753 | <div class="col-md-6"> |
754 | 754 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
755 | 755 | <?php |
756 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
756 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
757 | 757 | if (empty($date_array)) print _("No data available"); |
758 | 758 | else { |
759 | 759 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
760 | 760 | $date_data = ''; |
761 | 761 | $date_cnt = ''; |
762 | - foreach($date_array as $date_item) { |
|
762 | + foreach ($date_array as $date_item) { |
|
763 | 763 | $date_data .= '"'.$date_item['date_name'].'",'; |
764 | 764 | $date_cnt .= $date_item['date_count'].','; |
765 | 765 | } |
766 | 766 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
767 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
767 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
768 | 768 | print 'c3.generate({ |
769 | 769 | bindto: "#chart5", |
770 | 770 | data: { x: "x", |
@@ -777,22 +777,22 @@ discard block |
||
777 | 777 | <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
778 | 778 | </div> |
779 | 779 | </div> |
780 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
780 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
781 | 781 | <div class="col-md-6"> |
782 | 782 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
783 | 783 | <?php |
784 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
784 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
785 | 785 | if (empty($hour_array)) print _("No data available"); |
786 | 786 | else { |
787 | 787 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
788 | 788 | $hour_data = ''; |
789 | 789 | $hour_cnt = ''; |
790 | - foreach($hour_array as $hour_item) { |
|
790 | + foreach ($hour_array as $hour_item) { |
|
791 | 791 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
792 | 792 | $hour_cnt .= $hour_item['hour_count'].','; |
793 | 793 | } |
794 | 794 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
795 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
795 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
796 | 796 | print 'c3.generate({ |
797 | 797 | bindto: "#chart6", |
798 | 798 | data: { |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
806 | 806 | </div> |
807 | 807 | </div> |
808 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
808 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
809 | 809 | </div> |
810 | 810 | <?php |
811 | 811 | } |
@@ -821,18 +821,18 @@ discard block |
||
821 | 821 | <div class="col-md-6"> |
822 | 822 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
823 | 823 | <?php |
824 | - $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
824 | + $year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
825 | 825 | if (count($year_array) == 0) print _("No data available"); |
826 | 826 | else { |
827 | 827 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
828 | 828 | $year_data = ''; |
829 | 829 | $year_cnt = ''; |
830 | - foreach($year_array as $year_item) { |
|
830 | + foreach ($year_array as $year_item) { |
|
831 | 831 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
832 | 832 | $year_cnt .= $year_item['date_count'].','; |
833 | 833 | } |
834 | 834 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
835 | - $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]"; |
|
835 | + $year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]"; |
|
836 | 836 | print 'c3.generate({ |
837 | 837 | bindto: "#chart8", |
838 | 838 | data: { x: "x", |
@@ -846,22 +846,22 @@ discard block |
||
846 | 846 | </div> |
847 | 847 | </div> |
848 | 848 | |
849 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
849 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
850 | 850 | <div class="col-md-6"> |
851 | 851 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
852 | 852 | <?php |
853 | - $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
|
853 | + $month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name); |
|
854 | 854 | if (count($month_array) == 0) print _("No data available"); |
855 | 855 | else { |
856 | 856 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
857 | 857 | $month_data = ''; |
858 | 858 | $month_cnt = ''; |
859 | - foreach($month_array as $month_item) { |
|
859 | + foreach ($month_array as $month_item) { |
|
860 | 860 | $month_data .= '"'.$month_item['date_name'].'",'; |
861 | 861 | $month_cnt .= $month_item['date_count'].','; |
862 | 862 | } |
863 | 863 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
864 | - $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]"; |
|
864 | + $month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]"; |
|
865 | 865 | print 'c3.generate({ |
866 | 866 | bindto: "#chart9", |
867 | 867 | data: { x: "x", |
@@ -874,23 +874,23 @@ discard block |
||
874 | 874 | <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
875 | 875 | </div> |
876 | 876 | </div> |
877 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
877 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
878 | 878 | |
879 | 879 | <div class="col-md-6"> |
880 | 880 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
881 | 881 | <?php |
882 | - $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
|
882 | + $date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name); |
|
883 | 883 | if (empty($date_array)) print _("No data available"); |
884 | 884 | else { |
885 | 885 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
886 | 886 | $date_data = ''; |
887 | 887 | $date_cnt = ''; |
888 | - foreach($date_array as $date_item) { |
|
888 | + foreach ($date_array as $date_item) { |
|
889 | 889 | $date_data .= '"'.$date_item['date_name'].'",'; |
890 | 890 | $date_cnt .= $date_item['date_count'].','; |
891 | 891 | } |
892 | 892 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
893 | - $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]"; |
|
893 | + $date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]"; |
|
894 | 894 | print 'c3.generate({ |
895 | 895 | bindto: "#chart5", |
896 | 896 | data: { x: "x", |
@@ -903,22 +903,22 @@ discard block |
||
903 | 903 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
904 | 904 | </div> |
905 | 905 | </div> |
906 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
906 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
907 | 907 | <div class="col-md-6"> |
908 | 908 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
909 | 909 | <?php |
910 | - $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
|
910 | + $hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name); |
|
911 | 911 | if (empty($hour_array)) print _("No data available"); |
912 | 912 | else { |
913 | 913 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
914 | 914 | $hour_data = ''; |
915 | 915 | $hour_cnt = ''; |
916 | - foreach($hour_array as $hour_item) { |
|
916 | + foreach ($hour_array as $hour_item) { |
|
917 | 917 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
918 | 918 | $hour_cnt .= $hour_item['hour_count'].','; |
919 | 919 | } |
920 | 920 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
921 | - $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]"; |
|
921 | + $hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]"; |
|
922 | 922 | print 'c3.generate({ |
923 | 923 | bindto: "#chart6", |
924 | 924 | data: { |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
932 | 932 | </div> |
933 | 933 | </div> |
934 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
934 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
935 | 935 | </div> |
936 | 936 | <?php |
937 | 937 | } |
@@ -953,12 +953,12 @@ discard block |
||
953 | 953 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
954 | 954 | $year_data = ''; |
955 | 955 | $year_cnt = ''; |
956 | - foreach($year_array as $year_item) { |
|
956 | + foreach ($year_array as $year_item) { |
|
957 | 957 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
958 | 958 | $year_cnt .= $year_item['date_count'].','; |
959 | 959 | } |
960 | 960 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
961 | - $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]"; |
|
961 | + $year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]"; |
|
962 | 962 | print 'c3.generate({ |
963 | 963 | bindto: "#chart8", |
964 | 964 | data: { x: "x", |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | </div> |
973 | 973 | </div> |
974 | 974 | |
975 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
975 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
976 | 976 | <div class="col-md-6"> |
977 | 977 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
978 | 978 | <?php |
@@ -982,12 +982,12 @@ discard block |
||
982 | 982 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
983 | 983 | $month_data = ''; |
984 | 984 | $month_cnt = ''; |
985 | - foreach($month_array as $month_item) { |
|
985 | + foreach ($month_array as $month_item) { |
|
986 | 986 | $month_data .= '"'.$month_item['date_name'].'",'; |
987 | 987 | $month_cnt .= $month_item['date_count'].','; |
988 | 988 | } |
989 | 989 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
990 | - $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]"; |
|
990 | + $month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]"; |
|
991 | 991 | print 'c3.generate({ |
992 | 992 | bindto: "#chart9", |
993 | 993 | data: { x: "x", |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1001 | 1001 | </div> |
1002 | 1002 | </div> |
1003 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1003 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1004 | 1004 | |
1005 | 1005 | <div class="col-md-6"> |
1006 | 1006 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1011,12 +1011,12 @@ discard block |
||
1011 | 1011 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1012 | 1012 | $date_data = ''; |
1013 | 1013 | $date_cnt = ''; |
1014 | - foreach($date_array as $date_item) { |
|
1014 | + foreach ($date_array as $date_item) { |
|
1015 | 1015 | $date_data .= '"'.$date_item['date_name'].'",'; |
1016 | 1016 | $date_cnt .= $date_item['date_count'].','; |
1017 | 1017 | } |
1018 | 1018 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
1019 | - $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]"; |
|
1019 | + $date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]"; |
|
1020 | 1020 | print 'c3.generate({ |
1021 | 1021 | bindto: "#chart5", |
1022 | 1022 | data: { x: "x", |
@@ -1029,22 +1029,22 @@ discard block |
||
1029 | 1029 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1030 | 1030 | </div> |
1031 | 1031 | </div> |
1032 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1032 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1033 | 1033 | <div class="col-md-6"> |
1034 | 1034 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1035 | 1035 | <?php |
1036 | - $hour_array = $Tracker->countAllHours('hour',true); |
|
1036 | + $hour_array = $Tracker->countAllHours('hour', true); |
|
1037 | 1037 | if (empty($hour_array)) print _("No data available"); |
1038 | 1038 | else { |
1039 | 1039 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1040 | 1040 | $hour_data = ''; |
1041 | 1041 | $hour_cnt = ''; |
1042 | - foreach($hour_array as $hour_item) { |
|
1042 | + foreach ($hour_array as $hour_item) { |
|
1043 | 1043 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1044 | 1044 | $hour_cnt .= $hour_item['hour_count'].','; |
1045 | 1045 | } |
1046 | 1046 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1047 | - $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]"; |
|
1047 | + $hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]"; |
|
1048 | 1048 | print 'c3.generate({ |
1049 | 1049 | bindto: "#chart6", |
1050 | 1050 | data: { |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1058 | 1058 | </div> |
1059 | 1059 | </div> |
1060 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1060 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1061 | 1061 | </div> |
1062 | 1062 | <?php |
1063 | 1063 | } |
@@ -1079,12 +1079,12 @@ discard block |
||
1079 | 1079 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1080 | 1080 | $year_data = ''; |
1081 | 1081 | $year_cnt = ''; |
1082 | - foreach($year_array as $year_item) { |
|
1082 | + foreach ($year_array as $year_item) { |
|
1083 | 1083 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
1084 | 1084 | $year_cnt .= $year_item['count'].','; |
1085 | 1085 | } |
1086 | 1086 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1087 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1087 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1088 | 1088 | print 'c3.generate({ |
1089 | 1089 | bindto: "#chart32", |
1090 | 1090 | data: { x: "x", |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1098 | 1098 | </div> |
1099 | 1099 | </div> |
1100 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1100 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1101 | 1101 | |
1102 | 1102 | <div class="row column"> |
1103 | 1103 | <div class="col-md-6"> |
@@ -1109,12 +1109,12 @@ discard block |
||
1109 | 1109 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1110 | 1110 | $year_data = ''; |
1111 | 1111 | $year_cnt = ''; |
1112 | - foreach($year_array as $year_item) { |
|
1112 | + foreach ($year_array as $year_item) { |
|
1113 | 1113 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
1114 | 1114 | $year_cnt .= $year_item['count'].','; |
1115 | 1115 | } |
1116 | 1116 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1117 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1117 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1118 | 1118 | print 'c3.generate({ |
1119 | 1119 | bindto: "#chart33", |
1120 | 1120 | data: { x: "x", |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1128 | 1128 | </div> |
1129 | 1129 | </div> |
1130 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1130 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1131 | 1131 | <br/> |
1132 | 1132 | <?php |
1133 | 1133 | } |
@@ -1141,19 +1141,19 @@ discard block |
||
1141 | 1141 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
1142 | 1142 | if ($year == '' && $month == '') { |
1143 | 1143 | if ($type == 'aircraft') { |
1144 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
1144 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
1145 | 1145 | } elseif ($type == 'marine') { |
1146 | - $polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d')); |
|
1146 | + $polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d')); |
|
1147 | 1147 | } elseif ($type == 'tracker') { |
1148 | - $polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d')); |
|
1148 | + $polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d')); |
|
1149 | 1149 | } |
1150 | 1150 | } else { |
1151 | 1151 | if ($type == 'aircraft') { |
1152 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
1152 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
1153 | 1153 | } elseif ($type == 'marine') { |
1154 | - $polar = $Stats->getStatsSource('polar_marine',$year,$month); |
|
1154 | + $polar = $Stats->getStatsSource('polar_marine', $year, $month); |
|
1155 | 1155 | } elseif ($type == 'tracker') { |
1156 | - $polar = $Stats->getStatsSource('polar_tracker',$year,$month); |
|
1156 | + $polar = $Stats->getStatsSource('polar_tracker', $year, $month); |
|
1157 | 1157 | } |
1158 | 1158 | } |
1159 | 1159 | if (!empty($polar)) { |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | unset($polar_data); |
1163 | 1163 | $Spotter = new Spotter(); |
1164 | 1164 | $data = json_decode($eachpolar['source_data']); |
1165 | - foreach($data as $value => $key) { |
|
1165 | + foreach ($data as $value => $key) { |
|
1166 | 1166 | $direction = $Spotter->parseDirection(($value*22.5)); |
1167 | 1167 | $distance = $key; |
1168 | 1168 | $unit = 'km'; |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | ?> |
1183 | 1183 | <div class="col-md-6"> |
1184 | 1184 | <h4><?php print $eachpolar['source_name']; ?></h4> |
1185 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1185 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1186 | 1186 | <script> |
1187 | 1187 | (function() { |
1188 | 1188 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | color: color, |
1207 | 1207 | unit: '<?php echo $unit; ?>' |
1208 | 1208 | }; |
1209 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1209 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1210 | 1210 | })(); |
1211 | 1211 | </script> |
1212 | 1212 | </div> |
@@ -1221,19 +1221,19 @@ discard block |
||
1221 | 1221 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
1222 | 1222 | if ($year == '' && $month == '') { |
1223 | 1223 | if ($type == 'aircraft') { |
1224 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
1224 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
1225 | 1225 | } elseif ($type == 'marine') { |
1226 | - $msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d')); |
|
1226 | + $msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d')); |
|
1227 | 1227 | } elseif ($type == 'tracker') { |
1228 | - $msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d')); |
|
1228 | + $msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d')); |
|
1229 | 1229 | } |
1230 | 1230 | } else { |
1231 | 1231 | if ($type == 'aircraft') { |
1232 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
1232 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
1233 | 1233 | } elseif ($type == 'marine') { |
1234 | - $msg = $Stats->getStatsSource('msg_marine',$year,$month); |
|
1234 | + $msg = $Stats->getStatsSource('msg_marine', $year, $month); |
|
1235 | 1235 | } elseif ($type == 'tracker') { |
1236 | - $msg = $Stats->getStatsSource('msg_tracker',$year,$month); |
|
1236 | + $msg = $Stats->getStatsSource('msg_tracker', $year, $month); |
|
1237 | 1237 | } |
1238 | 1238 | } |
1239 | 1239 | if (!empty($msg)) { |
@@ -1241,13 +1241,13 @@ discard block |
||
1241 | 1241 | foreach ($msg as $eachmsg) { |
1242 | 1242 | //$eachmsg = $msg[0]; |
1243 | 1243 | $data = $eachmsg['source_data']; |
1244 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1244 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
1245 | 1245 | else $max = 500; |
1246 | 1246 | ?> |
1247 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1247 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1248 | 1248 | <script> |
1249 | 1249 | var g = new JustGage({ |
1250 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
1250 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
1251 | 1251 | value: <?php echo $data; ?>, |
1252 | 1252 | min: 0, |
1253 | 1253 | max: <?php print $max; ?>, |
@@ -1269,19 +1269,19 @@ discard block |
||
1269 | 1269 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
1270 | 1270 | if ($year == '' && $month == '') { |
1271 | 1271 | if ($type == 'aircraft') { |
1272 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
1272 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
1273 | 1273 | } elseif ($type == 'marine') { |
1274 | - $hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d')); |
|
1274 | + $hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d')); |
|
1275 | 1275 | } elseif ($type == 'tracker') { |
1276 | - $hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d')); |
|
1276 | + $hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d')); |
|
1277 | 1277 | } |
1278 | 1278 | } else { |
1279 | 1279 | if ($type == 'aircraft') { |
1280 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
1280 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
1281 | 1281 | } elseif ($type == 'marine') { |
1282 | - $hist = $Stats->getStatsSource('hist_marine',$year,$month); |
|
1282 | + $hist = $Stats->getStatsSource('hist_marine', $year, $month); |
|
1283 | 1283 | } elseif ($type == 'tracker') { |
1284 | - $hist = $Stats->getStatsSource('hist_tracker',$year,$month); |
|
1284 | + $hist = $Stats->getStatsSource('hist_tracker', $year, $month); |
|
1285 | 1285 | } |
1286 | 1286 | } |
1287 | 1287 | foreach ($hist as $hists) { |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | $source = $hists['source_name']; |
1292 | 1292 | $hist_array = json_decode($hists['source_data']); |
1293 | 1293 | $unit = 'km'; |
1294 | - foreach($hist_array as $distance => $nb) { |
|
1294 | + foreach ($hist_array as $distance => $nb) { |
|
1295 | 1295 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1296 | 1296 | $distance = round($distance*0.539957); |
1297 | 1297 | $unit = 'nm'; |
@@ -1311,18 +1311,18 @@ discard block |
||
1311 | 1311 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
1312 | 1312 | ?> |
1313 | 1313 | <div class="col-md-6"> |
1314 | - <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2> |
|
1314 | + <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2> |
|
1315 | 1315 | <?php |
1316 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1316 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1317 | 1317 | print 'c3.generate({ |
1318 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
1318 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
1319 | 1319 | data: { x: "x", |
1320 | 1320 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
1321 | 1321 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
1322 | 1322 | print '</script>'; |
1323 | 1323 | ?> |
1324 | 1324 | </div> |
1325 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1325 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1326 | 1326 | <?php |
1327 | 1327 | } |
1328 | 1328 | ?> |
@@ -7,21 +7,21 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airline'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
10 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | $alliance = false; |
13 | -if (strpos($airline,'alliance_') !== FALSE) { |
|
13 | +if (strpos($airline, 'alliance_') !== FALSE) { |
|
14 | 14 | $alliance = true; |
15 | 15 | } else { |
16 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1",""); |
|
16 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", ""); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | if (!empty($spotter_array) || $alliance === true) |
20 | 20 | { |
21 | 21 | if ($alliance) { |
22 | - $title = sprintf(_("Most Common Aircraft Manufacturer from %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
22 | + $title = sprintf(_("Most Common Aircraft Manufacturer from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
23 | 23 | } else { |
24 | - $title = sprintf(_("Most Common Aircraft Manufacturer from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
24 | + $title = sprintf(_("Most Common Aircraft Manufacturer from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
25 | 25 | } |
26 | 26 | require_once('header.php'); |
27 | 27 | print '<div class="select-item">'; |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | $alliances = $Spotter->getAllAllianceNames(); |
32 | 32 | if (!empty($alliances)) { |
33 | 33 | foreach ($alliances as $al) { |
34 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
35 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
34 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
35 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
36 | 36 | } else { |
37 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
37 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | print '<option disabled>───────────────────</option>'; |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | $Stats = new Stats(); |
43 | 43 | $airline_names = $Stats->getAllAirlineNames(); |
44 | 44 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
45 | - foreach($airline_names as $airline_name) |
|
45 | + foreach ($airline_names as $airline_name) |
|
46 | 46 | { |
47 | - if($airline == $airline_name['airline_icao']) |
|
47 | + if ($airline == $airline_name['airline_icao']) |
|
48 | 48 | { |
49 | 49 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
50 | 50 | } else { |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | print '</div>'; |
79 | 79 | } else { |
80 | 80 | print '<div class="info column">'; |
81 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
82 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
81 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
82 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
83 | 83 | { |
84 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
84 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
85 | 85 | } |
86 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
86 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
87 | 87 | print '</div>'; |
88 | 88 | } |
89 | 89 | } else { |
@@ -94,16 +94,16 @@ discard block |
||
94 | 94 | print '<div class="column">'; |
95 | 95 | print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>'; |
96 | 96 | if ($alliance) { |
97 | - print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>'; |
|
97 | + print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>'; |
|
98 | 98 | } else { |
99 | - print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
99 | + print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
100 | 100 | } |
101 | 101 | if ($alliance) { |
102 | - $manufacturers_array = $Spotter->countAllAircraftManufacturerByAirline('',array('alliance' => str_replace('_',' ',str_replace('alliance_','',$airline)))); |
|
102 | + $manufacturers_array = $Spotter->countAllAircraftManufacturerByAirline('', array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $airline)))); |
|
103 | 103 | } else { |
104 | 104 | $manufacturers_array = $Spotter->countAllAircraftManufacturerByAirline($airline); |
105 | 105 | } |
106 | - $manufacturers_array = $Stats->countAllAircraftManufacturers(true,$airline); |
|
106 | + $manufacturers_array = $Stats->countAllAircraftManufacturers(true, $airline); |
|
107 | 107 | if (!empty($manufacturers_array)) |
108 | 108 | { |
109 | 109 | print '<div class="table-responsive">'; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | print '</thead>'; |
117 | 117 | print '<tbody>'; |
118 | 118 | $i = 1; |
119 | - foreach($manufacturers_array as $manufacturer_item) |
|
119 | + foreach ($manufacturers_array as $manufacturer_item) |
|
120 | 120 | { |
121 | 121 | print '<tr>'; |
122 | 122 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,22 +7,22 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airline'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
10 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | $alliance = false; |
13 | -if (strpos($airline,'alliance_') !== FALSE) { |
|
13 | +if (strpos($airline, 'alliance_') !== FALSE) { |
|
14 | 14 | // $spotter_array = $Spotter->getSpotterDataByAirline('',"0,1","",array('alliance' => str_replace('_',' ',str_replace('alliance_','',$airline)))); |
15 | 15 | $alliance = true; |
16 | 16 | } else { |
17 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1",""); |
|
17 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", ""); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | if (!empty($spotter_array) || $alliance === true) |
21 | 21 | { |
22 | 22 | if ($alliance) { |
23 | - $title = sprintf(_("Most Common Aircraft from %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
23 | + $title = sprintf(_("Most Common Aircraft from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
24 | 24 | } else { |
25 | - $title = sprintf(_("Most Common Aircraft from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
25 | + $title = sprintf(_("Most Common Aircraft from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
26 | 26 | } |
27 | 27 | require_once('header.php'); |
28 | 28 | print '<div class="select-item">'; |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $alliances = $Spotter->getAllAllianceNames(); |
33 | 33 | if (!empty($alliances)) { |
34 | 34 | foreach ($alliances as $al) { |
35 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
36 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
35 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
36 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
37 | 37 | } else { |
38 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
38 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | print '<option disabled>────────────────</option>'; |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $Stats = new Stats(); |
44 | 44 | $airline_names = $Stats->getAllAirlineNames(); |
45 | 45 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
46 | - foreach($airline_names as $airline_name) |
|
46 | + foreach ($airline_names as $airline_name) |
|
47 | 47 | { |
48 | - if($airline == $airline_name['airline_icao']) |
|
48 | + if ($airline == $airline_name['airline_icao']) |
|
49 | 49 | { |
50 | 50 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
51 | 51 | } else { |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | print '</div>'; |
80 | 80 | } else { |
81 | 81 | print '<div class="info column">'; |
82 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
83 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
82 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
83 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
84 | 84 | { |
85 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
85 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
86 | 86 | } |
87 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
87 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
88 | 88 | print '</div>'; |
89 | 89 | } |
90 | 90 | } else { |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | print '<div class="column">'; |
96 | 96 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
97 | 97 | if ($alliance === false) { |
98 | - print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
98 | + print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
99 | 99 | } else { |
100 | - print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>'; |
|
100 | + print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>'; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /* |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $aircraft_array = $Spotter->countAllAircraftTypesByAirline($airline); |
108 | 108 | } |
109 | 109 | */ |
110 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline); |
|
110 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline); |
|
111 | 111 | if (!empty($aircraft_array)) |
112 | 112 | { |
113 | 113 | print '<div class="table-responsive">'; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | print '</thead>'; |
121 | 121 | print '<tbody>'; |
122 | 122 | $i = 1; |
123 | - foreach($aircraft_array as $aircraft_item) |
|
123 | + foreach ($aircraft_array as $aircraft_item) |
|
124 | 124 | { |
125 | 125 | print '<tr>'; |
126 | 126 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,21 +7,21 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airline'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
10 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | $alliance = false; |
13 | -if (strpos($airline,'alliance_') !== FALSE) { |
|
13 | +if (strpos($airline, 'alliance_') !== FALSE) { |
|
14 | 14 | $alliance = true; |
15 | 15 | } else { |
16 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1",""); |
|
16 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", ""); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | if (!empty($spotter_array) || $alliance === true) |
20 | 20 | { |
21 | 21 | if ($alliance) { |
22 | - $title = sprintf(_("Most Common Arrival Airports by Country from %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
22 | + $title = sprintf(_("Most Common Arrival Airports by Country from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
23 | 23 | } else { |
24 | - $title = sprintf(_("Most Common Arrival Airports by Country from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
24 | + $title = sprintf(_("Most Common Arrival Airports by Country from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
25 | 25 | } |
26 | 26 | require_once('header.php'); |
27 | 27 | print '<div class="select-item">'; |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | $alliances = $Spotter->getAllAllianceNames(); |
32 | 32 | if (!empty($alliances)) { |
33 | 33 | foreach ($alliances as $al) { |
34 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
35 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
34 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
35 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
36 | 36 | } else { |
37 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
37 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | print '<option disabled>─────────────────</option>'; |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | $Stats = new Stats(); |
43 | 43 | $airline_names = $Stats->getAllAirlineNames(); |
44 | 44 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
45 | - foreach($airline_names as $airline_name) |
|
45 | + foreach ($airline_names as $airline_name) |
|
46 | 46 | { |
47 | - if($_GET['airline'] == $airline_name['airline_icao']) |
|
47 | + if ($_GET['airline'] == $airline_name['airline_icao']) |
|
48 | 48 | { |
49 | 49 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
50 | 50 | } else { |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | print '</div>'; |
79 | 79 | } else { |
80 | 80 | print '<div class="info column">'; |
81 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
82 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
81 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
82 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
83 | 83 | { |
84 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
84 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
85 | 85 | } |
86 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
86 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
87 | 87 | print '</div>'; |
88 | 88 | } |
89 | 89 | } else { |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | print '<div class="column">'; |
95 | 95 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
96 | 96 | if ($alliance) { |
97 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>'; |
|
97 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>'; |
|
98 | 98 | } else { |
99 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
99 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
100 | 100 | } |
101 | 101 | /* |
102 | 102 | if ($alliance) { |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByAirline($airline); |
106 | 106 | } |
107 | 107 | */ |
108 | - $airport_country_array = $Stats->countAllArrivalCountries(true,$airline); |
|
108 | + $airport_country_array = $Stats->countAllArrivalCountries(true, $airline); |
|
109 | 109 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
110 | 110 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
111 | 111 | print '<script type="text/javascript" src="'.$globalURL.'/js/datamaps.world.min.js"></script>'; |
112 | 112 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
113 | 113 | print 'var series = ['; |
114 | 114 | $country_data = ''; |
115 | - foreach($airport_country_array as $airport_item) |
|
115 | + foreach ($airport_country_array as $airport_item) |
|
116 | 116 | { |
117 | 117 | $country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
118 | 118 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | print '</thead>'; |
161 | 161 | print '<tbody>'; |
162 | 162 | $i = 1; |
163 | - foreach($airport_country_array as $airport_item) |
|
163 | + foreach ($airport_country_array as $airport_item) |
|
164 | 164 | { |
165 | 165 | print '<tr>'; |
166 | 166 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -4,20 +4,20 @@ discard block |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | |
7 | -if (!isset($_GET['airline'])){ |
|
7 | +if (!isset($_GET['airline'])) { |
|
8 | 8 | header('Location: '.$globalURL.'/airline'); |
9 | -} else{ |
|
9 | +} else { |
|
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | //calculuation for the pagination |
12 | - if(!isset($_GET['limit']) || $_GET['limit'] == "") |
|
12 | + if (!isset($_GET['limit']) || $_GET['limit'] == "") |
|
13 | 13 | { |
14 | 14 | $limit_start = 0; |
15 | 15 | $limit_end = 25; |
16 | 16 | $absolute_difference = 25; |
17 | - } else { |
|
17 | + } else { |
|
18 | 18 | $limit_explode = explode(",", $_GET['limit']); |
19 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
20 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
19 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
20 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
21 | 21 | if (!ctype_digit(strval($limit_start)) || !ctype_digit(strval($limit_end))) { |
22 | 22 | $limit_start = 0; |
23 | 23 | $limit_end = 25; |
@@ -28,24 +28,24 @@ discard block |
||
28 | 28 | $limit_previous_1 = $limit_start - $absolute_difference; |
29 | 29 | $limit_previous_2 = $limit_end - $absolute_difference; |
30 | 30 | |
31 | - $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
31 | + $airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
32 | 32 | $page_url = $globalURL.'/airline/'.$airline; |
33 | 33 | $alliance = false; |
34 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
35 | - if (strpos($airline,'alliance_') !== FALSE) { |
|
36 | - $spotter_array = $Spotter->getSpotterDataByAirline('',$limit_start.",".$absolute_difference, $sort,array('alliance' => str_replace('_',' ',str_replace('alliance_','',$airline)))); |
|
34 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
35 | + if (strpos($airline, 'alliance_') !== FALSE) { |
|
36 | + $spotter_array = $Spotter->getSpotterDataByAirline('', $limit_start.",".$absolute_difference, $sort, array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $airline)))); |
|
37 | 37 | $alliance = true; |
38 | 38 | } else { |
39 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,$limit_start.",".$absolute_difference, $sort); |
|
39 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, $limit_start.",".$absolute_difference, $sort); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | if (!empty($spotter_array)) |
43 | 43 | { |
44 | 44 | if ($alliance) { |
45 | - $title = sprintf(_("Detailed View for %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
45 | + $title = sprintf(_("Detailed View for %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
46 | 46 | } else { |
47 | 47 | if (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) { |
48 | - $title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
48 | + $title = sprintf(_("Detailed View for %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
49 | 49 | } else $title = ''; |
50 | 50 | } |
51 | 51 | require_once('header.php'); |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | $alliances = $Spotter->getAllAllianceNames(); |
58 | 58 | if (!empty($alliances)) { |
59 | 59 | foreach ($alliances as $al) { |
60 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
61 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
60 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
61 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
62 | 62 | } else { |
63 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
63 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | print '<option disabled>───────────────</option>'; |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | $Stats = new Stats(); |
69 | 69 | $airline_names = $Stats->getAllAirlineNames(); |
70 | 70 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
71 | - foreach($airline_names as $airline_name) |
|
71 | + foreach ($airline_names as $airline_name) |
|
72 | 72 | { |
73 | - if($airline == $airline_name['airline_icao']) |
|
73 | + if ($airline == $airline_name['airline_icao']) |
|
74 | 74 | { |
75 | 75 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
76 | 76 | } else { |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | print '</div>'; |
105 | 105 | } else { |
106 | 106 | print '<div class="info column">'; |
107 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
108 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
107 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
108 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
109 | 109 | { |
110 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
110 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
111 | 111 | } |
112 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
112 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
113 | 113 | print '</div>'; |
114 | 114 | } |
115 | 115 | } else { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | include('airline-sub-menu.php'); |
120 | 120 | print '<div class="table column">'; |
121 | 121 | if (isset($spotter_array[0]['airline_name']) && $alliance === false) { |
122 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
122 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | include('table-output.php'); |
@@ -7,22 +7,22 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airline'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
10 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | $alliance = false; |
13 | -if (strpos($airline,'alliance_') !== FALSE) { |
|
13 | +if (strpos($airline, 'alliance_') !== FALSE) { |
|
14 | 14 | $alliance = true; |
15 | 15 | } else { |
16 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1",""); |
|
16 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", ""); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | |
20 | 20 | if (!empty($spotter_array) || $alliance === true) |
21 | 21 | { |
22 | 22 | if ($alliance) { |
23 | - $title = sprintf(_("Most Common Time of Day from %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
23 | + $title = sprintf(_("Most Common Time of Day from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
24 | 24 | } else { |
25 | - $title = sprintf(_("Most Common Time of Day from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
25 | + $title = sprintf(_("Most Common Time of Day from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
26 | 26 | } |
27 | 27 | require_once('header.php'); |
28 | 28 | print '<div class="select-item">'; |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $alliances = $Spotter->getAllAllianceNames(); |
33 | 33 | if (!empty($alliances)) { |
34 | 34 | foreach ($alliances as $al) { |
35 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
36 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
35 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
36 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
37 | 37 | } else { |
38 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
38 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | print '<option disabled>────────────────</option>'; |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $Stats = new Stats(); |
44 | 44 | $airline_names = $Stats->getAllAirlineNames(); |
45 | 45 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
46 | - foreach($airline_names as $airline_name) |
|
46 | + foreach ($airline_names as $airline_name) |
|
47 | 47 | { |
48 | - if($airline == $airline_name['airline_icao']) |
|
48 | + if ($airline == $airline_name['airline_icao']) |
|
49 | 49 | { |
50 | 50 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
51 | 51 | } else { |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | print '</div>'; |
80 | 80 | } else { |
81 | 81 | print '<div class="info column">'; |
82 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
83 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
82 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
83 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
84 | 84 | { |
85 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
85 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
86 | 86 | } |
87 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
87 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
88 | 88 | print '</div>'; |
89 | 89 | } |
90 | 90 | } else { |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | print '<div class="column">'; |
96 | 96 | print '<h2>'._("Most Common Time of Day").'</h2>'; |
97 | 97 | if ($alliance) { |
98 | - print '<p>'.sprintf(_("The statistic below shows the most common time of day from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>'; |
|
98 | + print '<p>'.sprintf(_("The statistic below shows the most common time of day from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>'; |
|
99 | 99 | } else { |
100 | - print '<p>'.sprintf(_("The statistic below shows the most common time of day from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
100 | + print '<p>'.sprintf(_("The statistic below shows the most common time of day from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
101 | 101 | } |
102 | 102 | /* |
103 | 103 | if ($alliance) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $hour_array = $Spotter->countAllHoursByAirline($airline); |
107 | 107 | } |
108 | 108 | */ |
109 | - $hour_array = $Stats->countAllHours('hour',true,$airline); |
|
109 | + $hour_array = $Stats->countAllHours('hour', true, $airline); |
|
110 | 110 | print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">'; |
111 | 111 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
112 | 112 | print '<script type="text/javascript" src="'.$globalURL.'/js/c3.min.js"></script>'; |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | $hour_data = ''; |
115 | 115 | $hour_cnt = ''; |
116 | 116 | $last = 0; |
117 | - foreach($hour_array as $hour_item) |
|
117 | + foreach ($hour_array as $hour_item) |
|
118 | 118 | { |
119 | - while($last != $hour_item['hour_name']) { |
|
119 | + while ($last != $hour_item['hour_name']) { |
|
120 | 120 | $hour_data .= '"'.$last.':00",'; |
121 | 121 | $hour_cnt .= '0,'; |
122 | 122 | $last++; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $hour_cnt .= $hour_item['hour_count'].','; |
127 | 127 | } |
128 | 128 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
129 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
129 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
130 | 130 | print 'c3.generate({ |
131 | 131 | bindto: "#chartHour", |
132 | 132 | data: { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | print '</thead>'; |
147 | 147 | print '<tbody>'; |
148 | 148 | $i = 1; |
149 | - foreach($hour_array as $hour_item) |
|
149 | + foreach ($hour_array as $hour_item) |
|
150 | 150 | { |
151 | 151 | print '<tr>'; |
152 | 152 | print '<td>'.$hour_item['hour_name'].':00</td>'; |