@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | if ($this->db === null) die('Error: No DB connection.'); |
20 | 20 | } |
21 | 21 | |
22 | - public function addLastStatsUpdate($type,$stats_date) { |
|
22 | + public function addLastStatsUpdate($type, $stats_date) { |
|
23 | 23 | $query = "DELETE FROM config WHERE name = :type; |
24 | 24 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
25 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
25 | + $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
26 | 26 | try { |
27 | 27 | $sth = $this->db->prepare($query); |
28 | 28 | $sth->execute($query_values); |
29 | - } catch(PDOException $e) { |
|
29 | + } catch (PDOException $e) { |
|
30 | 30 | return "error : ".$e->getMessage(); |
31 | 31 | } |
32 | 32 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | try { |
37 | 37 | $sth = $this->db->prepare($query); |
38 | 38 | $sth->execute(array(':type' => $type)); |
39 | - } catch(PDOException $e) { |
|
39 | + } catch (PDOException $e) { |
|
40 | 40 | echo "error : ".$e->getMessage(); |
41 | 41 | } |
42 | 42 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | try { |
58 | 58 | $sth = $this->db->prepare($query); |
59 | 59 | $sth->execute(array(':filter_name' => $filter_name)); |
60 | - } catch(PDOException $e) { |
|
60 | + } catch (PDOException $e) { |
|
61 | 61 | return "error : ".$e->getMessage(); |
62 | 62 | } |
63 | 63 | } |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | try { |
71 | 71 | $sth = $this->db->prepare($query); |
72 | 72 | $sth->execute(); |
73 | - } catch(PDOException $e) { |
|
73 | + } catch (PDOException $e) { |
|
74 | 74 | return "error : ".$e->getMessage(); |
75 | 75 | } |
76 | 76 | $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;"; |
77 | 77 | try { |
78 | 78 | $sth = $this->db->prepare($query); |
79 | 79 | $sth->execute(array(':filter_name' => $filter_name)); |
80 | - } catch(PDOException $e) { |
|
80 | + } catch (PDOException $e) { |
|
81 | 81 | return "error : ".$e->getMessage(); |
82 | 82 | } |
83 | 83 | } |
@@ -89,77 +89,77 @@ discard block |
||
89 | 89 | try { |
90 | 90 | $sth = $this->db->prepare($query); |
91 | 91 | $sth->execute(array(':filter_name' => $filter_name)); |
92 | - } catch(PDOException $e) { |
|
92 | + } catch (PDOException $e) { |
|
93 | 93 | echo "error : ".$e->getMessage(); |
94 | 94 | } |
95 | 95 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
96 | 96 | if (empty($all)) { |
97 | 97 | $filters = array(); |
98 | 98 | if ($filter_name != '') { |
99 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
99 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
100 | 100 | } |
101 | 101 | $Spotter = new Spotter($this->db); |
102 | - $all = $Spotter->getAllAirlineNames('',NULL,$filters); |
|
102 | + $all = $Spotter->getAllAirlineNames('', NULL, $filters); |
|
103 | 103 | } |
104 | 104 | return $all; |
105 | 105 | } |
106 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
106 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
107 | 107 | if ($filter_name == '') $filter_name = $this->filter_name; |
108 | 108 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
109 | 109 | try { |
110 | 110 | $sth = $this->db->prepare($query); |
111 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
112 | - } catch(PDOException $e) { |
|
111 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
112 | + } catch (PDOException $e) { |
|
113 | 113 | echo "error : ".$e->getMessage(); |
114 | 114 | } |
115 | 115 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
116 | 116 | return $all; |
117 | 117 | } |
118 | - public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
118 | + public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
|
119 | 119 | if ($filter_name == '') $filter_name = $this->filter_name; |
120 | 120 | $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"; |
121 | 121 | try { |
122 | 122 | $sth = $this->db->prepare($query); |
123 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
124 | - } catch(PDOException $e) { |
|
123 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
124 | + } catch (PDOException $e) { |
|
125 | 125 | echo "error : ".$e->getMessage(); |
126 | 126 | } |
127 | 127 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
128 | 128 | return $all; |
129 | 129 | } |
130 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
130 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
131 | 131 | if ($filter_name == '') $filter_name = $this->filter_name; |
132 | 132 | $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"; |
133 | 133 | try { |
134 | 134 | $sth = $this->db->prepare($query); |
135 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
136 | - } catch(PDOException $e) { |
|
135 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
136 | + } catch (PDOException $e) { |
|
137 | 137 | echo "error : ".$e->getMessage(); |
138 | 138 | } |
139 | 139 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
140 | 140 | return $all; |
141 | 141 | } |
142 | 142 | |
143 | - public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
|
143 | + public function getAllOwnerNames($stats_airline = '', $filter_name = '') { |
|
144 | 144 | if ($filter_name == '') $filter_name = $this->filter_name; |
145 | 145 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
146 | 146 | try { |
147 | 147 | $sth = $this->db->prepare($query); |
148 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
149 | - } catch(PDOException $e) { |
|
148 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
149 | + } catch (PDOException $e) { |
|
150 | 150 | echo "error : ".$e->getMessage(); |
151 | 151 | } |
152 | 152 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
153 | 153 | return $all; |
154 | 154 | } |
155 | 155 | |
156 | - public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
|
156 | + public function getAllPilotNames($stats_airline = '', $filter_name = '') { |
|
157 | 157 | if ($filter_name == '') $filter_name = $this->filter_name; |
158 | 158 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
159 | 159 | try { |
160 | 160 | $sth = $this->db->prepare($query); |
161 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
162 | - } catch(PDOException $e) { |
|
161 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
162 | + } catch (PDOException $e) { |
|
163 | 163 | echo "error : ".$e->getMessage(); |
164 | 164 | } |
165 | 165 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -167,23 +167,23 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | |
170 | - public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
170 | + public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
171 | 171 | global $globalStatsFilters; |
172 | 172 | if ($filter_name == '') $filter_name = $this->filter_name; |
173 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
173 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
174 | 174 | $Spotter = new Spotter($this->db); |
175 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
175 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
176 | 176 | $alliance_airlines = array(); |
177 | 177 | foreach ($airlines as $airline) { |
178 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
178 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
179 | 179 | } |
180 | 180 | if ($year == '' && $month == '') { |
181 | - 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"; |
|
182 | - 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"; |
|
181 | + 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"; |
|
182 | + 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"; |
|
183 | 183 | try { |
184 | 184 | $sth = $this->db->prepare($query); |
185 | 185 | $sth->execute(array(':filter_name' => $filter_name)); |
186 | - } catch(PDOException $e) { |
|
186 | + } catch (PDOException $e) { |
|
187 | 187 | echo "error : ".$e->getMessage(); |
188 | 188 | } |
189 | 189 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -194,29 +194,29 @@ discard block |
||
194 | 194 | 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"; |
195 | 195 | try { |
196 | 196 | $sth = $this->db->prepare($query); |
197 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
198 | - } catch(PDOException $e) { |
|
197 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
198 | + } catch (PDOException $e) { |
|
199 | 199 | echo "error : ".$e->getMessage(); |
200 | 200 | } |
201 | 201 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
202 | 202 | } else $all = array(); |
203 | 203 | } |
204 | 204 | if (empty($all)) { |
205 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
206 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
205 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
206 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
207 | 207 | } else { |
208 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
208 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
209 | 209 | } |
210 | 210 | if ($filter_name != '') { |
211 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
211 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
212 | 212 | } |
213 | 213 | $Spotter = new Spotter($this->db); |
214 | 214 | //$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
215 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
215 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
216 | 216 | } |
217 | 217 | return $all; |
218 | 218 | } |
219 | - public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
|
219 | + public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
|
220 | 220 | global $globalStatsFilters; |
221 | 221 | if ($filter_name == '') $filter_name = $this->filter_name; |
222 | 222 | if ($year == '' && $month == '') { |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | try { |
226 | 226 | $sth = $this->db->prepare($query); |
227 | 227 | $sth->execute(array(':filter_name' => $filter_name)); |
228 | - } catch(PDOException $e) { |
|
228 | + } catch (PDOException $e) { |
|
229 | 229 | echo "error : ".$e->getMessage(); |
230 | 230 | } |
231 | 231 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -233,32 +233,32 @@ discard block |
||
233 | 233 | if (empty($all)) { |
234 | 234 | $Spotter = new Spotter($this->db); |
235 | 235 | $filters = array(); |
236 | - $filters = array('year' => $year,'month' => $month); |
|
236 | + $filters = array('year' => $year, 'month' => $month); |
|
237 | 237 | if ($filter_name != '') { |
238 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
238 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
239 | 239 | } |
240 | 240 | //$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
241 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
241 | + $all = $Spotter->countAllAirlineCountries($limit, $filters); |
|
242 | 242 | } |
243 | 243 | return $all; |
244 | 244 | } |
245 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
245 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
246 | 246 | global $globalStatsFilters; |
247 | 247 | if ($filter_name == '') $filter_name = $this->filter_name; |
248 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
248 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
249 | 249 | $Spotter = new Spotter($this->db); |
250 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
250 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
251 | 251 | $alliance_airlines = array(); |
252 | 252 | foreach ($airlines as $airline) { |
253 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
253 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
254 | 254 | } |
255 | 255 | if ($year == '' && $month == '') { |
256 | - 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"; |
|
257 | - 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"; |
|
256 | + 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"; |
|
257 | + 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"; |
|
258 | 258 | try { |
259 | 259 | $sth = $this->db->prepare($query); |
260 | 260 | $sth->execute(array(':filter_name' => $filter_name)); |
261 | - } catch(PDOException $e) { |
|
261 | + } catch (PDOException $e) { |
|
262 | 262 | echo "error : ".$e->getMessage(); |
263 | 263 | } |
264 | 264 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -269,21 +269,21 @@ discard block |
||
269 | 269 | 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"; |
270 | 270 | try { |
271 | 271 | $sth = $this->db->prepare($query); |
272 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
273 | - } catch(PDOException $e) { |
|
272 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
273 | + } catch (PDOException $e) { |
|
274 | 274 | echo "error : ".$e->getMessage(); |
275 | 275 | } |
276 | 276 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
277 | 277 | } else $all = array(); |
278 | 278 | } |
279 | 279 | if (empty($all)) { |
280 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
281 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
280 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
281 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
282 | 282 | } else { |
283 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
283 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
284 | 284 | } |
285 | 285 | if ($filter_name != '') { |
286 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
286 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
287 | 287 | } |
288 | 288 | $Spotter = new Spotter($this->db); |
289 | 289 | //$all = $Spotter->countAllAircraftManufacturers($filters,$year,$month); |
@@ -292,23 +292,23 @@ discard block |
||
292 | 292 | return $all; |
293 | 293 | } |
294 | 294 | |
295 | - public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
295 | + public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
296 | 296 | global $globalStatsFilters; |
297 | 297 | if ($filter_name == '') $filter_name = $this->filter_name; |
298 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
298 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
299 | 299 | $Spotter = new Spotter($this->db); |
300 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
300 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
301 | 301 | $alliance_airlines = array(); |
302 | 302 | foreach ($airlines as $airline) { |
303 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
303 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
304 | 304 | } |
305 | 305 | if ($year == '' && $month == '') { |
306 | - 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"; |
|
307 | - 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"; |
|
306 | + 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"; |
|
307 | + 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"; |
|
308 | 308 | try { |
309 | 309 | $sth = $this->db->prepare($query); |
310 | 310 | $sth->execute(array(':filter_name' => $filter_name)); |
311 | - } catch(PDOException $e) { |
|
311 | + } catch (PDOException $e) { |
|
312 | 312 | echo "error : ".$e->getMessage(); |
313 | 313 | } |
314 | 314 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -319,61 +319,61 @@ discard block |
||
319 | 319 | 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"; |
320 | 320 | try { |
321 | 321 | $sth = $this->db->prepare($query); |
322 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
323 | - } catch(PDOException $e) { |
|
322 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
323 | + } catch (PDOException $e) { |
|
324 | 324 | echo "error : ".$e->getMessage(); |
325 | 325 | } |
326 | 326 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
327 | 327 | } else $all = array(); |
328 | 328 | } |
329 | 329 | if (empty($all)) { |
330 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
331 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
330 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
331 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
332 | 332 | } else { |
333 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
333 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
334 | 334 | } |
335 | 335 | if ($filter_name != '') { |
336 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
336 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
337 | 337 | } |
338 | 338 | $Spotter = new Spotter($this->db); |
339 | 339 | //$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
340 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
340 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
341 | 341 | } |
342 | 342 | return $all; |
343 | 343 | } |
344 | 344 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
345 | 345 | global $globalStatsFilters; |
346 | 346 | if ($filter_name == '') $filter_name = $this->filter_name; |
347 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
347 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
348 | 348 | $Spotter = new Spotter($this->db); |
349 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
349 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
350 | 350 | $alliance_airlines = array(); |
351 | 351 | foreach ($airlines as $airline) { |
352 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
352 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
353 | 353 | } |
354 | - 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"; |
|
355 | - 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"; |
|
354 | + 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"; |
|
355 | + 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"; |
|
356 | 356 | $query_values = array(':filter_name' => $filter_name); |
357 | 357 | } else { |
358 | 358 | 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"; |
359 | 359 | 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"; |
360 | - $query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
360 | + $query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
361 | 361 | } |
362 | 362 | try { |
363 | 363 | $sth = $this->db->prepare($query); |
364 | 364 | $sth->execute($query_values); |
365 | - } catch(PDOException $e) { |
|
365 | + } catch (PDOException $e) { |
|
366 | 366 | echo "error : ".$e->getMessage(); |
367 | 367 | } |
368 | 368 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
369 | 369 | if (empty($all)) { |
370 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
371 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
370 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
371 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
372 | 372 | } else { |
373 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
373 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
374 | 374 | } |
375 | 375 | if ($filter_name != '') { |
376 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
376 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
377 | 377 | } |
378 | 378 | $Spotter = new Spotter($this->db); |
379 | 379 | //$all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | return $all; |
383 | 383 | } |
384 | 384 | |
385 | - public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
|
385 | + public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') { |
|
386 | 386 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
387 | 387 | if ($filter_name == '') $filter_name = $this->filter_name; |
388 | 388 | if ($year == '' && $month == '') { |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | if (isset($forsource)) { |
392 | 392 | 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"; |
393 | 393 | 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"; |
394 | - $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
|
394 | + $query_values = array(':filter_name' => $filter_name, ':forsource' => $forsource); |
|
395 | 395 | } else { |
396 | 396 | 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"; |
397 | 397 | 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"; |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | try { |
401 | 401 | $sth = $this->db->prepare($query); |
402 | 402 | $sth->execute($query_values); |
403 | - } catch(PDOException $e) { |
|
403 | + } catch (PDOException $e) { |
|
404 | 404 | echo "error : ".$e->getMessage(); |
405 | 405 | } |
406 | 406 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -408,32 +408,32 @@ discard block |
||
408 | 408 | if (empty($all)) { |
409 | 409 | $Spotter = new Spotter($this->db); |
410 | 410 | $filters = array(); |
411 | - $filters = array('year' => $year,'month' => $month); |
|
411 | + $filters = array('year' => $year, 'month' => $month); |
|
412 | 412 | if ($filter_name != '') { |
413 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
413 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
414 | 414 | } |
415 | 415 | //$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
416 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
416 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
|
417 | 417 | } |
418 | 418 | return $all; |
419 | 419 | } |
420 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
420 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
421 | 421 | global $globalStatsFilters; |
422 | 422 | if ($filter_name == '') $filter_name = $this->filter_name; |
423 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
423 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
424 | 424 | $Spotter = new Spotter($this->db); |
425 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
425 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
426 | 426 | $alliance_airlines = array(); |
427 | 427 | foreach ($airlines as $airline) { |
428 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
428 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
429 | 429 | } |
430 | 430 | if ($year == '' && $month == '') { |
431 | - 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"; |
|
432 | - 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"; |
|
431 | + 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"; |
|
432 | + 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"; |
|
433 | 433 | try { |
434 | 434 | $sth = $this->db->prepare($query); |
435 | 435 | $sth->execute(array(':filter_name' => $filter_name)); |
436 | - } catch(PDOException $e) { |
|
436 | + } catch (PDOException $e) { |
|
437 | 437 | echo "error : ".$e->getMessage(); |
438 | 438 | } |
439 | 439 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -444,45 +444,45 @@ discard block |
||
444 | 444 | 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"; |
445 | 445 | try { |
446 | 446 | $sth = $this->db->prepare($query); |
447 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
448 | - } catch(PDOException $e) { |
|
447 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
448 | + } catch (PDOException $e) { |
|
449 | 449 | echo "error : ".$e->getMessage(); |
450 | 450 | } |
451 | 451 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
452 | 452 | } else $all = array(); |
453 | 453 | } |
454 | 454 | if (empty($all)) { |
455 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
456 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
455 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
456 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
457 | 457 | } else { |
458 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
458 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
459 | 459 | } |
460 | 460 | if ($filter_name != '') { |
461 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
461 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
462 | 462 | } |
463 | 463 | $Spotter = new Spotter($this->db); |
464 | 464 | //$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
465 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
465 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
466 | 466 | } |
467 | 467 | return $all; |
468 | 468 | } |
469 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
469 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
470 | 470 | global $globalStatsFilters; |
471 | 471 | if ($filter_name == '') $filter_name = $this->filter_name; |
472 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
472 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
473 | 473 | $Spotter = new Spotter($this->db); |
474 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
474 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
475 | 475 | $alliance_airlines = array(); |
476 | 476 | foreach ($airlines as $airline) { |
477 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
477 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
478 | 478 | } |
479 | 479 | if ($year == '' && $month == '') { |
480 | - 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"; |
|
481 | - 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"; |
|
480 | + 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"; |
|
481 | + 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"; |
|
482 | 482 | try { |
483 | 483 | $sth = $this->db->prepare($query); |
484 | 484 | $sth->execute(array(':filter_name' => $filter_name)); |
485 | - } catch(PDOException $e) { |
|
485 | + } catch (PDOException $e) { |
|
486 | 486 | echo "error : ".$e->getMessage(); |
487 | 487 | } |
488 | 488 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -493,46 +493,46 @@ discard block |
||
493 | 493 | 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"; |
494 | 494 | try { |
495 | 495 | $sth = $this->db->prepare($query); |
496 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
497 | - } catch(PDOException $e) { |
|
496 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
497 | + } catch (PDOException $e) { |
|
498 | 498 | echo "error : ".$e->getMessage(); |
499 | 499 | } |
500 | 500 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
501 | 501 | } else $all = array(); |
502 | 502 | } |
503 | 503 | if (empty($all)) { |
504 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
505 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
504 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
505 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
506 | 506 | } else { |
507 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
507 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
508 | 508 | } |
509 | 509 | if ($filter_name != '') { |
510 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
510 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
511 | 511 | } |
512 | 512 | $Spotter = new Spotter($this->db); |
513 | 513 | //$all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month); |
514 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
514 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
515 | 515 | } |
516 | 516 | return $all; |
517 | 517 | } |
518 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
518 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
519 | 519 | $Connection = new Connection($this->db); |
520 | 520 | if ($filter_name == '') $filter_name = $this->filter_name; |
521 | 521 | if ($Connection->tableExists('countries')) { |
522 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
522 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
523 | 523 | $Spotter = new Spotter($this->db); |
524 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
524 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
525 | 525 | if ($year == '' && $month == '') { |
526 | 526 | $alliance_airlines = array(); |
527 | 527 | foreach ($airlines as $airline) { |
528 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
528 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
529 | 529 | } |
530 | - 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"; |
|
531 | - 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"; |
|
530 | + 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"; |
|
531 | + 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"; |
|
532 | 532 | try { |
533 | 533 | $sth = $this->db->prepare($query); |
534 | 534 | $sth->execute(array(':filter_name' => $filter_name)); |
535 | - } catch(PDOException $e) { |
|
535 | + } catch (PDOException $e) { |
|
536 | 536 | echo "error : ".$e->getMessage(); |
537 | 537 | } |
538 | 538 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | 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"; |
545 | 545 | try { |
546 | 546 | $sth = $this->db->prepare($query); |
547 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
548 | - } catch(PDOException $e) { |
|
547 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
548 | + } catch (PDOException $e) { |
|
549 | 549 | echo "error : ".$e->getMessage(); |
550 | 550 | } |
551 | 551 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | return array(); |
563 | 563 | } |
564 | 564 | } |
565 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
|
565 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
566 | 566 | global $globalStatsFilters; |
567 | 567 | if ($filter_name == '') $filter_name = $this->filter_name; |
568 | 568 | if ($year == '' && $month == '') { |
@@ -570,41 +570,41 @@ discard block |
||
570 | 570 | 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"; |
571 | 571 | try { |
572 | 572 | $sth = $this->db->prepare($query); |
573 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
574 | - } catch(PDOException $e) { |
|
573 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
574 | + } catch (PDOException $e) { |
|
575 | 575 | echo "error : ".$e->getMessage(); |
576 | 576 | } |
577 | 577 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
578 | 578 | } else $all = array(); |
579 | 579 | if (empty($all)) { |
580 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
580 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
581 | 581 | if ($filter_name != '') { |
582 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
582 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
583 | 583 | } |
584 | 584 | $Spotter = new Spotter($this->db); |
585 | 585 | //$all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month); |
586 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
586 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
587 | 587 | } |
588 | 588 | return $all; |
589 | 589 | } |
590 | 590 | |
591 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
591 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
592 | 592 | global $globalStatsFilters; |
593 | 593 | if ($filter_name == '') $filter_name = $this->filter_name; |
594 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
594 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
595 | 595 | $Spotter = new Spotter($this->db); |
596 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
596 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
597 | 597 | if ($year == '' && $month == '') { |
598 | 598 | $alliance_airlines = array(); |
599 | 599 | foreach ($airlines as $airline) { |
600 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
600 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
601 | 601 | } |
602 | - 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"; |
|
603 | - 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"; |
|
602 | + 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"; |
|
603 | + 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"; |
|
604 | 604 | try { |
605 | 605 | $sth = $this->db->prepare($query); |
606 | 606 | $sth->execute(array(':filter_name' => $filter_name)); |
607 | - } catch(PDOException $e) { |
|
607 | + } catch (PDOException $e) { |
|
608 | 608 | echo "error : ".$e->getMessage(); |
609 | 609 | } |
610 | 610 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -615,45 +615,45 @@ discard block |
||
615 | 615 | 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"; |
616 | 616 | try { |
617 | 617 | $sth = $this->db->prepare($query); |
618 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
619 | - } catch(PDOException $e) { |
|
618 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
619 | + } catch (PDOException $e) { |
|
620 | 620 | echo "error : ".$e->getMessage(); |
621 | 621 | } |
622 | 622 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
623 | 623 | } else $all = array(); |
624 | 624 | } |
625 | 625 | if (empty($all)) { |
626 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
627 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
626 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
627 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
628 | 628 | } else { |
629 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
629 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
630 | 630 | } |
631 | 631 | if ($filter_name != '') { |
632 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
632 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
633 | 633 | } |
634 | 634 | $Spotter = new Spotter($this->db); |
635 | 635 | //$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
636 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
636 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
637 | 637 | } |
638 | 638 | return $all; |
639 | 639 | } |
640 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
640 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
641 | 641 | global $globalStatsFilters; |
642 | 642 | if ($filter_name == '') $filter_name = $this->filter_name; |
643 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
643 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
644 | 644 | $Spotter = new Spotter($this->db); |
645 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
645 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
646 | 646 | if ($year == '' && $month == '') { |
647 | 647 | $alliance_airlines = array(); |
648 | 648 | foreach ($airlines as $airline) { |
649 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
649 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
650 | 650 | } |
651 | - 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"; |
|
652 | - 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"; |
|
651 | + 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"; |
|
652 | + 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"; |
|
653 | 653 | try { |
654 | 654 | $sth = $this->db->prepare($query); |
655 | 655 | $sth->execute(array(':filter_name' => $filter_name)); |
656 | - } catch(PDOException $e) { |
|
656 | + } catch (PDOException $e) { |
|
657 | 657 | echo "error : ".$e->getMessage(); |
658 | 658 | } |
659 | 659 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -664,27 +664,27 @@ discard block |
||
664 | 664 | 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"; |
665 | 665 | try { |
666 | 666 | $sth = $this->db->prepare($query); |
667 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
668 | - } catch(PDOException $e) { |
|
667 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
668 | + } catch (PDOException $e) { |
|
669 | 669 | echo "error : ".$e->getMessage(); |
670 | 670 | } |
671 | 671 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
672 | 672 | } else $all = array(); |
673 | 673 | } |
674 | 674 | if (empty($all)) { |
675 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
676 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
675 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
676 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
677 | 677 | } else { |
678 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
678 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
679 | 679 | } |
680 | 680 | if ($filter_name != '') { |
681 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
681 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
682 | 682 | } |
683 | 683 | $Spotter = new Spotter($this->db); |
684 | 684 | // $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
685 | 685 | // $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
686 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
687 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
686 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
687 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
688 | 688 | $all = array(); |
689 | 689 | foreach ($pall as $value) { |
690 | 690 | $icao = $value['airport_departure_icao']; |
@@ -700,27 +700,27 @@ discard block |
||
700 | 700 | foreach ($all as $key => $row) { |
701 | 701 | $count[$key] = $row['airport_departure_icao_count']; |
702 | 702 | } |
703 | - array_multisort($count,SORT_DESC,$all); |
|
703 | + array_multisort($count, SORT_DESC, $all); |
|
704 | 704 | } |
705 | 705 | return $all; |
706 | 706 | } |
707 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
707 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
708 | 708 | global $globalStatsFilters; |
709 | 709 | if ($filter_name == '') $filter_name = $this->filter_name; |
710 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
710 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
711 | 711 | $Spotter = new Spotter($this->db); |
712 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
712 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
713 | 713 | if ($year == '' && $month == '') { |
714 | 714 | $alliance_airlines = array(); |
715 | 715 | foreach ($airlines as $airline) { |
716 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
716 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
717 | 717 | } |
718 | - 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"; |
|
719 | - 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"; |
|
718 | + 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"; |
|
719 | + 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"; |
|
720 | 720 | try { |
721 | 721 | $sth = $this->db->prepare($query); |
722 | 722 | $sth->execute(array(':filter_name' => $filter_name)); |
723 | - } catch(PDOException $e) { |
|
723 | + } catch (PDOException $e) { |
|
724 | 724 | echo "error : ".$e->getMessage(); |
725 | 725 | } |
726 | 726 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -731,27 +731,27 @@ discard block |
||
731 | 731 | 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"; |
732 | 732 | try { |
733 | 733 | $sth = $this->db->prepare($query); |
734 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
735 | - } catch(PDOException $e) { |
|
734 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
735 | + } catch (PDOException $e) { |
|
736 | 736 | echo "error : ".$e->getMessage(); |
737 | 737 | } |
738 | 738 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
739 | 739 | } else $all = array(); |
740 | 740 | } |
741 | 741 | if (empty($all)) { |
742 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
743 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
742 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
743 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
744 | 744 | } else { |
745 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
745 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
746 | 746 | } |
747 | 747 | if ($filter_name != '') { |
748 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
748 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
749 | 749 | } |
750 | 750 | $Spotter = new Spotter($this->db); |
751 | 751 | // $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month); |
752 | 752 | // $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
753 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
754 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
753 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
754 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
755 | 755 | $all = array(); |
756 | 756 | foreach ($pall as $value) { |
757 | 757 | $icao = $value['airport_arrival_icao']; |
@@ -767,26 +767,26 @@ discard block |
||
767 | 767 | foreach ($all as $key => $row) { |
768 | 768 | $count[$key] = $row['airport_arrival_icao_count']; |
769 | 769 | } |
770 | - array_multisort($count,SORT_DESC,$all); |
|
770 | + array_multisort($count, SORT_DESC, $all); |
|
771 | 771 | } |
772 | 772 | return $all; |
773 | 773 | } |
774 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
774 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
775 | 775 | global $globalDBdriver, $globalStatsFilters; |
776 | 776 | if ($filter_name == '') $filter_name = $this->filter_name; |
777 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
777 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
778 | 778 | $Spotter = new Spotter($this->db); |
779 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
779 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
780 | 780 | $alliance_airlines = array(); |
781 | 781 | foreach ($airlines as $airline) { |
782 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
782 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
783 | 783 | } |
784 | 784 | if ($globalDBdriver == 'mysql') { |
785 | - 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"; |
|
786 | - 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"; |
|
785 | + 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"; |
|
786 | + 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"; |
|
787 | 787 | } else { |
788 | - 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"; |
|
789 | - 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"; |
|
788 | + 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"; |
|
789 | + 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"; |
|
790 | 790 | } |
791 | 791 | $query_data = array(':filter_name' => $filter_name); |
792 | 792 | } else { |
@@ -797,23 +797,23 @@ discard block |
||
797 | 797 | 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"; |
798 | 798 | 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"; |
799 | 799 | } |
800 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
800 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
801 | 801 | } |
802 | 802 | try { |
803 | 803 | $sth = $this->db->prepare($query); |
804 | 804 | $sth->execute($query_data); |
805 | - } catch(PDOException $e) { |
|
805 | + } catch (PDOException $e) { |
|
806 | 806 | echo "error : ".$e->getMessage(); |
807 | 807 | } |
808 | 808 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
809 | 809 | if (empty($all)) { |
810 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
811 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
810 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
811 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
812 | 812 | } else { |
813 | 813 | $filters = array('airlines' => array($stats_airline)); |
814 | 814 | } |
815 | 815 | if ($filter_name != '') { |
816 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
816 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
817 | 817 | } |
818 | 818 | $Spotter = new Spotter($this->db); |
819 | 819 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -821,57 +821,57 @@ discard block |
||
821 | 821 | return $all; |
822 | 822 | } |
823 | 823 | |
824 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
824 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
825 | 825 | global $globalStatsFilters; |
826 | 826 | if ($filter_name == '') $filter_name = $this->filter_name; |
827 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
827 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
828 | 828 | $Spotter = new Spotter($this->db); |
829 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
829 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
830 | 830 | $alliance_airlines = array(); |
831 | 831 | foreach ($airlines as $airline) { |
832 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
832 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
833 | 833 | } |
834 | - $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 | + $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"; |
|
835 | 835 | $query_data = array(':filter_name' => $filter_name); |
836 | 836 | } else { |
837 | 837 | $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"; |
838 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
838 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
839 | 839 | } |
840 | 840 | try { |
841 | 841 | $sth = $this->db->prepare($query); |
842 | 842 | $sth->execute($query_data); |
843 | - } catch(PDOException $e) { |
|
843 | + } catch (PDOException $e) { |
|
844 | 844 | echo "error : ".$e->getMessage(); |
845 | 845 | } |
846 | 846 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
847 | 847 | if (empty($all)) { |
848 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
849 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
848 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
849 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
850 | 850 | } else { |
851 | 851 | $filters = array('airlines' => array($stats_airline)); |
852 | 852 | } |
853 | 853 | if ($filter_name != '') { |
854 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
854 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
855 | 855 | } |
856 | 856 | $Spotter = new Spotter($this->db); |
857 | 857 | $all = $Spotter->countAllDatesLastMonth($filters); |
858 | 858 | } |
859 | 859 | return $all; |
860 | 860 | } |
861 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
861 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
862 | 862 | global $globalDBdriver, $globalStatsFilters; |
863 | 863 | if ($filter_name == '') $filter_name = $this->filter_name; |
864 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
864 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
865 | 865 | $Spotter = new Spotter($this->db); |
866 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
866 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
867 | 867 | $alliance_airlines = array(); |
868 | 868 | foreach ($airlines as $airline) { |
869 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
869 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
870 | 870 | } |
871 | 871 | if ($globalDBdriver == 'mysql') { |
872 | - $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 | + $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"; |
|
873 | 873 | } else { |
874 | - $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 | + $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"; |
|
875 | 875 | } |
876 | 876 | $query_data = array(':filter_name' => $filter_name); |
877 | 877 | } else { |
@@ -880,60 +880,60 @@ discard block |
||
880 | 880 | } else { |
881 | 881 | $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"; |
882 | 882 | } |
883 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
883 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
884 | 884 | } |
885 | 885 | try { |
886 | 886 | $sth = $this->db->prepare($query); |
887 | 887 | $sth->execute($query_data); |
888 | - } catch(PDOException $e) { |
|
888 | + } catch (PDOException $e) { |
|
889 | 889 | echo "error : ".$e->getMessage(); |
890 | 890 | } |
891 | 891 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
892 | 892 | if (empty($all)) { |
893 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
894 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
893 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
894 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
895 | 895 | } else { |
896 | 896 | $filters = array('airlines' => array($stats_airline)); |
897 | 897 | } |
898 | 898 | if ($filter_name != '') { |
899 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
899 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
900 | 900 | } |
901 | 901 | $Spotter = new Spotter($this->db); |
902 | 902 | $all = $Spotter->countAllDatesLast7Days($filters); |
903 | 903 | } |
904 | 904 | return $all; |
905 | 905 | } |
906 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
906 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
907 | 907 | global $globalStatsFilters; |
908 | 908 | if ($filter_name == '') $filter_name = $this->filter_name; |
909 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
909 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
910 | 910 | $Spotter = new Spotter($this->db); |
911 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
911 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
912 | 912 | $alliance_airlines = array(); |
913 | 913 | foreach ($airlines as $airline) { |
914 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
914 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
915 | 915 | } |
916 | - $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 | + $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"; |
|
917 | 917 | $query_data = array(':filter_name' => $filter_name); |
918 | 918 | } else { |
919 | 919 | $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"; |
920 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
920 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
921 | 921 | } |
922 | 922 | try { |
923 | 923 | $sth = $this->db->prepare($query); |
924 | 924 | $sth->execute($query_data); |
925 | - } catch(PDOException $e) { |
|
925 | + } catch (PDOException $e) { |
|
926 | 926 | echo "error : ".$e->getMessage(); |
927 | 927 | } |
928 | 928 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
929 | 929 | if (empty($all)) { |
930 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
931 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
930 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
931 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
932 | 932 | } else { |
933 | 933 | $filters = array('airlines' => array($stats_airline)); |
934 | 934 | } |
935 | 935 | if ($filter_name != '') { |
936 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
936 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
937 | 937 | } |
938 | 938 | $Spotter = new Spotter($this->db); |
939 | 939 | $all = $Spotter->countAllDates($filters); |
@@ -948,34 +948,34 @@ discard block |
||
948 | 948 | try { |
949 | 949 | $sth = $this->db->prepare($query); |
950 | 950 | $sth->execute($query_data); |
951 | - } catch(PDOException $e) { |
|
951 | + } catch (PDOException $e) { |
|
952 | 952 | echo "error : ".$e->getMessage(); |
953 | 953 | } |
954 | 954 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
955 | 955 | if (empty($all)) { |
956 | 956 | $filters = array(); |
957 | 957 | if ($filter_name != '') { |
958 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
958 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
959 | 959 | } |
960 | 960 | $Spotter = new Spotter($this->db); |
961 | 961 | $all = $Spotter->countAllDatesByAirlines($filters); |
962 | 962 | } |
963 | 963 | return $all; |
964 | 964 | } |
965 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
965 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
966 | 966 | global $globalStatsFilters, $globalDBdriver; |
967 | 967 | if ($filter_name == '') $filter_name = $this->filter_name; |
968 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
968 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
969 | 969 | $Spotter = new Spotter($this->db); |
970 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
970 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
971 | 971 | $alliance_airlines = array(); |
972 | 972 | foreach ($airlines as $airline) { |
973 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
973 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
974 | 974 | } |
975 | 975 | if ($globalDBdriver == 'mysql') { |
976 | - $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 | + $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"; |
|
977 | 977 | } else { |
978 | - $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 | + $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"; |
|
979 | 979 | } |
980 | 980 | $query_data = array(':filter_name' => $filter_name); |
981 | 981 | } else { |
@@ -989,18 +989,18 @@ discard block |
||
989 | 989 | try { |
990 | 990 | $sth = $this->db->prepare($query); |
991 | 991 | $sth->execute($query_data); |
992 | - } catch(PDOException $e) { |
|
992 | + } catch (PDOException $e) { |
|
993 | 993 | echo "error : ".$e->getMessage(); |
994 | 994 | } |
995 | 995 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
996 | 996 | if (empty($all)) { |
997 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
998 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
997 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
998 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
999 | 999 | } else { |
1000 | 1000 | $filters = array('airlines' => array($stats_airline)); |
1001 | 1001 | } |
1002 | 1002 | if ($filter_name != '') { |
1003 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1003 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1004 | 1004 | } |
1005 | 1005 | $Spotter = new Spotter($this->db); |
1006 | 1006 | $all = $Spotter->countAllMonths($filters); |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | try { |
1018 | 1018 | $sth = $this->db->prepare($query); |
1019 | 1019 | $sth->execute(); |
1020 | - } catch(PDOException $e) { |
|
1020 | + } catch (PDOException $e) { |
|
1021 | 1021 | echo "error : ".$e->getMessage(); |
1022 | 1022 | } |
1023 | 1023 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | try { |
1038 | 1038 | $sth = $this->db->prepare($query); |
1039 | 1039 | $sth->execute(); |
1040 | - } catch(PDOException $e) { |
|
1040 | + } catch (PDOException $e) { |
|
1041 | 1041 | echo "error : ".$e->getMessage(); |
1042 | 1042 | } |
1043 | 1043 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1054,32 +1054,32 @@ discard block |
||
1054 | 1054 | try { |
1055 | 1055 | $sth = $this->db->prepare($query); |
1056 | 1056 | $sth->execute(array(':filter_name' => $filter_name)); |
1057 | - } catch(PDOException $e) { |
|
1057 | + } catch (PDOException $e) { |
|
1058 | 1058 | echo "error : ".$e->getMessage(); |
1059 | 1059 | } |
1060 | 1060 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1061 | 1061 | if (empty($all)) { |
1062 | 1062 | $filters = array(); |
1063 | 1063 | if ($filter_name != '') { |
1064 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1064 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1065 | 1065 | } |
1066 | 1066 | $Spotter = new Spotter($this->db); |
1067 | 1067 | $all = $Spotter->countAllMilitaryMonths($filters); |
1068 | 1068 | } |
1069 | 1069 | return $all; |
1070 | 1070 | } |
1071 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
1071 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
1072 | 1072 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
1073 | 1073 | if ($filter_name == '') $filter_name = $this->filter_name; |
1074 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1074 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1075 | 1075 | $Spotter = new Spotter($this->db); |
1076 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1076 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1077 | 1077 | $alliance_airlines = array(); |
1078 | 1078 | foreach ($airlines as $airline) { |
1079 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1079 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1080 | 1080 | } |
1081 | - 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"; |
|
1082 | - 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"; |
|
1081 | + 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"; |
|
1082 | + 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"; |
|
1083 | 1083 | $query_data = array(':filter_name' => $filter_name); |
1084 | 1084 | } else { |
1085 | 1085 | 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"; |
@@ -1097,37 +1097,37 @@ discard block |
||
1097 | 1097 | try { |
1098 | 1098 | $sth = $this->db->prepare($query); |
1099 | 1099 | $sth->execute($query_data); |
1100 | - } catch(PDOException $e) { |
|
1100 | + } catch (PDOException $e) { |
|
1101 | 1101 | echo "error : ".$e->getMessage(); |
1102 | 1102 | } |
1103 | 1103 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1104 | 1104 | if (empty($all)) { |
1105 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1106 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1105 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1106 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1107 | 1107 | } else { |
1108 | 1108 | $filters = array('airlines' => array($stats_airline)); |
1109 | 1109 | } |
1110 | 1110 | if ($filter_name != '') { |
1111 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1111 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1112 | 1112 | } |
1113 | 1113 | $Spotter = new Spotter($this->db); |
1114 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
1114 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
1115 | 1115 | } |
1116 | 1116 | return $all; |
1117 | 1117 | } |
1118 | - public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
1118 | + public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1119 | 1119 | global $globalStatsFilters; |
1120 | 1120 | if ($filter_name == '') $filter_name = $this->filter_name; |
1121 | 1121 | if ($year == '') $year = date('Y'); |
1122 | - $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1122 | + $all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1123 | 1123 | if (empty($all)) { |
1124 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1125 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1124 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1125 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1126 | 1126 | } else { |
1127 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1127 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1128 | 1128 | } |
1129 | 1129 | if ($filter_name != '') { |
1130 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1130 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1131 | 1131 | } |
1132 | 1132 | $Spotter = new Spotter($this->db); |
1133 | 1133 | //$all = $Spotter->countOverallFlights($filters,$year,$month); |
@@ -1135,16 +1135,16 @@ discard block |
||
1135 | 1135 | } |
1136 | 1136 | return $all; |
1137 | 1137 | } |
1138 | - public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
|
1138 | + public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') { |
|
1139 | 1139 | global $globalStatsFilters; |
1140 | 1140 | if ($filter_name == '') $filter_name = $this->filter_name; |
1141 | 1141 | if ($year == '') $year = date('Y'); |
1142 | - $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
|
1142 | + $all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month); |
|
1143 | 1143 | if (empty($all)) { |
1144 | 1144 | $filters = array(); |
1145 | - $filters = array('year' => $year,'month' => $month); |
|
1145 | + $filters = array('year' => $year, 'month' => $month); |
|
1146 | 1146 | if ($filter_name != '') { |
1147 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1147 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1148 | 1148 | } |
1149 | 1149 | $Spotter = new Spotter($this->db); |
1150 | 1150 | //$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
@@ -1152,19 +1152,19 @@ discard block |
||
1152 | 1152 | } |
1153 | 1153 | return $all; |
1154 | 1154 | } |
1155 | - public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
|
1155 | + public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1156 | 1156 | global $globalStatsFilters; |
1157 | 1157 | if ($filter_name == '') $filter_name = $this->filter_name; |
1158 | 1158 | if ($year == '') $year = date('Y'); |
1159 | - $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1159 | + $all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1160 | 1160 | if (empty($all)) { |
1161 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1162 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1161 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1162 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1163 | 1163 | } else { |
1164 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1164 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1165 | 1165 | } |
1166 | 1166 | if ($filter_name != '') { |
1167 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1167 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1168 | 1168 | } |
1169 | 1169 | $Spotter = new Spotter($this->db); |
1170 | 1170 | //$all = $Spotter->countOverallArrival($filters,$year,$month); |
@@ -1172,48 +1172,48 @@ discard block |
||
1172 | 1172 | } |
1173 | 1173 | return $all; |
1174 | 1174 | } |
1175 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
1175 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1176 | 1176 | global $globalStatsFilters; |
1177 | 1177 | if ($filter_name == '') $filter_name = $this->filter_name; |
1178 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1178 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1179 | 1179 | $Spotter = new Spotter($this->db); |
1180 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1180 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1181 | 1181 | if ($year == '' && $month == '') { |
1182 | 1182 | $alliance_airlines = array(); |
1183 | 1183 | foreach ($airlines as $airline) { |
1184 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1184 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1185 | 1185 | } |
1186 | - $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1186 | + $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1187 | 1187 | try { |
1188 | 1188 | $sth = $this->db->prepare($query); |
1189 | 1189 | $sth->execute(array(':filter_name' => $filter_name)); |
1190 | - } catch(PDOException $e) { |
|
1190 | + } catch (PDOException $e) { |
|
1191 | 1191 | echo "error : ".$e->getMessage(); |
1192 | 1192 | } |
1193 | 1193 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1194 | 1194 | $all = $result[0]['nb']; |
1195 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1195 | + } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1196 | 1196 | } else { |
1197 | 1197 | if ($year == '' && $month == '') { |
1198 | 1198 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
1199 | 1199 | try { |
1200 | 1200 | $sth = $this->db->prepare($query); |
1201 | - $sth->execute(array(':filter_name' => $filter_name,':stats_airline' => $stats_airline)); |
|
1202 | - } catch(PDOException $e) { |
|
1201 | + $sth->execute(array(':filter_name' => $filter_name, ':stats_airline' => $stats_airline)); |
|
1202 | + } catch (PDOException $e) { |
|
1203 | 1203 | echo "error : ".$e->getMessage(); |
1204 | 1204 | } |
1205 | 1205 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1206 | 1206 | $all = $result[0]['nb']; |
1207 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1207 | + } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1208 | 1208 | } |
1209 | 1209 | if (empty($all)) { |
1210 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1211 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1210 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1211 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1212 | 1212 | } else { |
1213 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1213 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1214 | 1214 | } |
1215 | 1215 | if ($filter_name != '') { |
1216 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1216 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1217 | 1217 | } |
1218 | 1218 | $Spotter = new Spotter($this->db); |
1219 | 1219 | //$all = $Spotter->countOverallAircrafts($filters,$year,$month); |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | } |
1222 | 1222 | return $all; |
1223 | 1223 | } |
1224 | - public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
|
1224 | + public function countOverallAirlines($filter_name = '', $year = '', $month = '') { |
|
1225 | 1225 | global $globalStatsFilters; |
1226 | 1226 | if ($filter_name == '') $filter_name = $this->filter_name; |
1227 | 1227 | if ($year == '' && $month == '') { |
@@ -1229,17 +1229,17 @@ discard block |
||
1229 | 1229 | try { |
1230 | 1230 | $sth = $this->db->prepare($query); |
1231 | 1231 | $sth->execute(array(':filter_name' => $filter_name)); |
1232 | - } catch(PDOException $e) { |
|
1232 | + } catch (PDOException $e) { |
|
1233 | 1233 | echo "error : ".$e->getMessage(); |
1234 | 1234 | } |
1235 | 1235 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1236 | 1236 | $all = $result[0]['nb_airline']; |
1237 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
1237 | + } else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month); |
|
1238 | 1238 | if (empty($all)) { |
1239 | 1239 | $filters = array(); |
1240 | - $filters = array('year' => $year,'month' => $month); |
|
1240 | + $filters = array('year' => $year, 'month' => $month); |
|
1241 | 1241 | if ($filter_name != '') { |
1242 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1242 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1243 | 1243 | } |
1244 | 1244 | $Spotter = new Spotter($this->db); |
1245 | 1245 | //$all = $Spotter->countOverallAirlines($filters,$year,$month); |
@@ -1247,29 +1247,29 @@ discard block |
||
1247 | 1247 | } |
1248 | 1248 | return $all; |
1249 | 1249 | } |
1250 | - public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
1250 | + public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1251 | 1251 | global $globalStatsFilters; |
1252 | 1252 | if ($filter_name == '') $filter_name = $this->filter_name; |
1253 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1253 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1254 | 1254 | $Spotter = new Spotter($this->db); |
1255 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1255 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1256 | 1256 | if ($year == '' && $month == '') { |
1257 | 1257 | $alliance_airlines = array(); |
1258 | 1258 | foreach ($airlines as $airline) { |
1259 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1259 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1260 | 1260 | } |
1261 | - $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1261 | + $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1262 | 1262 | $query_values = array(':filter_name' => $filter_name); |
1263 | 1263 | try { |
1264 | 1264 | $sth = $this->db->prepare($query); |
1265 | 1265 | $sth->execute($query_values); |
1266 | - } catch(PDOException $e) { |
|
1266 | + } catch (PDOException $e) { |
|
1267 | 1267 | echo "error : ".$e->getMessage(); |
1268 | 1268 | } |
1269 | 1269 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1270 | 1270 | $all = $result[0]['nb']; |
1271 | 1271 | } else { |
1272 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1272 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1273 | 1273 | } |
1274 | 1274 | } else { |
1275 | 1275 | if ($year == '' && $month == '') { |
@@ -1278,23 +1278,23 @@ discard block |
||
1278 | 1278 | try { |
1279 | 1279 | $sth = $this->db->prepare($query); |
1280 | 1280 | $sth->execute($query_values); |
1281 | - } catch(PDOException $e) { |
|
1281 | + } catch (PDOException $e) { |
|
1282 | 1282 | echo "error : ".$e->getMessage(); |
1283 | 1283 | } |
1284 | 1284 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1285 | 1285 | $all = $result[0]['nb']; |
1286 | 1286 | } else { |
1287 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1287 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1288 | 1288 | } |
1289 | 1289 | } |
1290 | 1290 | if (empty($all)) { |
1291 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1292 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1291 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1292 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1293 | 1293 | } else { |
1294 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1294 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1295 | 1295 | } |
1296 | 1296 | if ($filter_name != '') { |
1297 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1297 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1298 | 1298 | } |
1299 | 1299 | $Spotter = new Spotter($this->db); |
1300 | 1300 | //$all = $Spotter->countOverallOwners($filters,$year,$month); |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | } |
1303 | 1303 | return $all; |
1304 | 1304 | } |
1305 | - public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
1305 | + public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1306 | 1306 | global $globalStatsFilters; |
1307 | 1307 | if ($filter_name == '') $filter_name = $this->filter_name; |
1308 | 1308 | //if ($year == '') $year = date('Y'); |
@@ -1312,18 +1312,18 @@ discard block |
||
1312 | 1312 | try { |
1313 | 1313 | $sth = $this->db->prepare($query); |
1314 | 1314 | $sth->execute($query_values); |
1315 | - } catch(PDOException $e) { |
|
1315 | + } catch (PDOException $e) { |
|
1316 | 1316 | echo "error : ".$e->getMessage(); |
1317 | 1317 | } |
1318 | 1318 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1319 | 1319 | $all = $result[0]['nb']; |
1320 | 1320 | } else { |
1321 | - $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1321 | + $all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1322 | 1322 | } |
1323 | 1323 | if (empty($all)) { |
1324 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1324 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1325 | 1325 | if ($filter_name != '') { |
1326 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1326 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1327 | 1327 | } |
1328 | 1328 | $Spotter = new Spotter($this->db); |
1329 | 1329 | //$all = $Spotter->countOverallPilots($filters,$year,$month); |
@@ -1332,104 +1332,104 @@ discard block |
||
1332 | 1332 | return $all; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
1335 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
1336 | 1336 | if ($filter_name == '') $filter_name = $this->filter_name; |
1337 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1337 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1338 | 1338 | $Spotter = new Spotter($this->db); |
1339 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1339 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1340 | 1340 | $alliance_airlines = array(); |
1341 | 1341 | foreach ($airlines as $airline) { |
1342 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1342 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1343 | 1343 | } |
1344 | - $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"; |
|
1345 | - $query_values = array(':airport_icao' => $airport_icao,':filter_name' => $filter_name); |
|
1344 | + $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"; |
|
1345 | + $query_values = array(':airport_icao' => $airport_icao, ':filter_name' => $filter_name); |
|
1346 | 1346 | } else { |
1347 | 1347 | $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"; |
1348 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1348 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1349 | 1349 | } |
1350 | 1350 | try { |
1351 | 1351 | $sth = $this->db->prepare($query); |
1352 | 1352 | $sth->execute($query_values); |
1353 | - } catch(PDOException $e) { |
|
1353 | + } catch (PDOException $e) { |
|
1354 | 1354 | echo "error : ".$e->getMessage(); |
1355 | 1355 | } |
1356 | 1356 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1357 | 1357 | return $all; |
1358 | 1358 | } |
1359 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
1359 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
1360 | 1360 | if ($filter_name == '') $filter_name = $this->filter_name; |
1361 | 1361 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
1362 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1362 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1363 | 1363 | try { |
1364 | 1364 | $sth = $this->db->prepare($query); |
1365 | 1365 | $sth->execute($query_values); |
1366 | - } catch(PDOException $e) { |
|
1366 | + } catch (PDOException $e) { |
|
1367 | 1367 | echo "error : ".$e->getMessage(); |
1368 | 1368 | } |
1369 | 1369 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1370 | 1370 | return $all; |
1371 | 1371 | } |
1372 | - public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
|
1372 | + public function deleteStatsByType($type, $stats_airline = '', $filter_name = '') { |
|
1373 | 1373 | if ($filter_name == '') $filter_name = $this->filter_name; |
1374 | 1374 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1375 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1375 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1376 | 1376 | try { |
1377 | 1377 | $sth = $this->db->prepare($query); |
1378 | 1378 | $sth->execute($query_values); |
1379 | - } catch(PDOException $e) { |
|
1379 | + } catch (PDOException $e) { |
|
1380 | 1380 | echo "error : ".$e->getMessage(); |
1381 | 1381 | } |
1382 | 1382 | } |
1383 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
|
1383 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') { |
|
1384 | 1384 | if ($filter_name == '') $filter_name = $this->filter_name; |
1385 | 1385 | global $globalArchiveMonths, $globalDBdriver; |
1386 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1386 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1387 | 1387 | $Spotter = new Spotter($this->db); |
1388 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1388 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1389 | 1389 | $alliance_airlines = array(); |
1390 | 1390 | foreach ($airlines as $airline) { |
1391 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1391 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1392 | 1392 | } |
1393 | 1393 | if ($globalDBdriver == 'mysql') { |
1394 | 1394 | if ($month == '') { |
1395 | - $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 | + $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"; |
|
1396 | 1396 | $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name); |
1397 | 1397 | } else { |
1398 | - $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"; |
|
1399 | - $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month); |
|
1398 | + $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"; |
|
1399 | + $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month); |
|
1400 | 1400 | } |
1401 | 1401 | } else { |
1402 | 1402 | if ($month == '') { |
1403 | - $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 | + $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"; |
|
1404 | 1404 | $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name); |
1405 | 1405 | } else { |
1406 | - $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"; |
|
1407 | - $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month); |
|
1406 | + $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"; |
|
1407 | + $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month); |
|
1408 | 1408 | } |
1409 | 1409 | } |
1410 | 1410 | } else { |
1411 | 1411 | if ($globalDBdriver == 'mysql') { |
1412 | 1412 | if ($month == '') { |
1413 | 1413 | $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"; |
1414 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1414 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1415 | 1415 | } else { |
1416 | 1416 | $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"; |
1417 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
1417 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
1418 | 1418 | } |
1419 | 1419 | } else { |
1420 | 1420 | if ($month == '') { |
1421 | 1421 | $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"; |
1422 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1422 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1423 | 1423 | } else { |
1424 | 1424 | $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"; |
1425 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
1425 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
1426 | 1426 | } |
1427 | 1427 | } |
1428 | 1428 | } |
1429 | 1429 | try { |
1430 | 1430 | $sth = $this->db->prepare($query); |
1431 | 1431 | $sth->execute($query_values); |
1432 | - } catch(PDOException $e) { |
|
1432 | + } catch (PDOException $e) { |
|
1433 | 1433 | echo "error : ".$e->getMessage(); |
1434 | 1434 | } |
1435 | 1435 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1438,17 +1438,17 @@ discard block |
||
1438 | 1438 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
1439 | 1439 | global $globalArchiveMonths, $globalDBdriver; |
1440 | 1440 | if ($filter_name == '') $filter_name = $this->filter_name; |
1441 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1441 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1442 | 1442 | $Spotter = new Spotter($this->db); |
1443 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1443 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1444 | 1444 | $alliance_airlines = array(); |
1445 | 1445 | foreach ($airlines as $airline) { |
1446 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1446 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1447 | 1447 | } |
1448 | 1448 | if ($globalDBdriver == 'mysql') { |
1449 | - $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 | + $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"; |
|
1450 | 1450 | } else { |
1451 | - $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 | + $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"; |
|
1452 | 1452 | } |
1453 | 1453 | $query_values = array(':type' => $type, ':filter_name' => $filter_name); |
1454 | 1454 | } else { |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | try { |
1463 | 1463 | $sth = $this->db->prepare($query); |
1464 | 1464 | $sth->execute($query_values); |
1465 | - } catch(PDOException $e) { |
|
1465 | + } catch (PDOException $e) { |
|
1466 | 1466 | echo "error : ".$e->getMessage(); |
1467 | 1467 | } |
1468 | 1468 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1471,17 +1471,17 @@ discard block |
||
1471 | 1471 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
1472 | 1472 | global $globalArchiveMonths, $globalDBdriver; |
1473 | 1473 | if ($filter_name == '') $filter_name = $this->filter_name; |
1474 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1474 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1475 | 1475 | $Spotter = new Spotter($this->db); |
1476 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1476 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1477 | 1477 | $alliance_airlines = array(); |
1478 | 1478 | foreach ($airlines as $airline) { |
1479 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1479 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1480 | 1480 | } |
1481 | 1481 | if ($globalDBdriver == 'mysql') { |
1482 | - $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1482 | + $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1483 | 1483 | } else { |
1484 | - $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1484 | + $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1485 | 1485 | } |
1486 | 1486 | } else { |
1487 | 1487 | if ($globalDBdriver == 'mysql') { |
@@ -1493,7 +1493,7 @@ discard block |
||
1493 | 1493 | try { |
1494 | 1494 | $sth = $this->db->prepare($query); |
1495 | 1495 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
1496 | - } catch(PDOException $e) { |
|
1496 | + } catch (PDOException $e) { |
|
1497 | 1497 | echo "error : ".$e->getMessage(); |
1498 | 1498 | } |
1499 | 1499 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1510,7 +1510,7 @@ discard block |
||
1510 | 1510 | try { |
1511 | 1511 | $sth = $this->db->prepare($query); |
1512 | 1512 | $sth->execute(array(':filter_name' => $filter_name)); |
1513 | - } catch(PDOException $e) { |
|
1513 | + } catch (PDOException $e) { |
|
1514 | 1514 | echo "error : ".$e->getMessage(); |
1515 | 1515 | } |
1516 | 1516 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1527,20 +1527,20 @@ discard block |
||
1527 | 1527 | try { |
1528 | 1528 | $sth = $this->db->prepare($query); |
1529 | 1529 | $sth->execute(array(':filter_name' => $filter_name)); |
1530 | - } catch(PDOException $e) { |
|
1530 | + } catch (PDOException $e) { |
|
1531 | 1531 | echo "error : ".$e->getMessage(); |
1532 | 1532 | } |
1533 | 1533 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1534 | 1534 | return $all[0]['total']; |
1535 | 1535 | } |
1536 | - public function getStatsOwner($owner_name,$filter_name = '') { |
|
1536 | + public function getStatsOwner($owner_name, $filter_name = '') { |
|
1537 | 1537 | global $globalArchiveMonths, $globalDBdriver; |
1538 | 1538 | if ($filter_name == '') $filter_name = $this->filter_name; |
1539 | 1539 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
1540 | 1540 | try { |
1541 | 1541 | $sth = $this->db->prepare($query); |
1542 | - $sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name)); |
|
1543 | - } catch(PDOException $e) { |
|
1542 | + $sth->execute(array(':filter_name' => $filter_name, ':owner_name' => $owner_name)); |
|
1543 | + } catch (PDOException $e) { |
|
1544 | 1544 | echo "error : ".$e->getMessage(); |
1545 | 1545 | } |
1546 | 1546 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1558,20 +1558,20 @@ discard block |
||
1558 | 1558 | try { |
1559 | 1559 | $sth = $this->db->prepare($query); |
1560 | 1560 | $sth->execute(array(':filter_name' => $filter_name)); |
1561 | - } catch(PDOException $e) { |
|
1561 | + } catch (PDOException $e) { |
|
1562 | 1562 | echo "error : ".$e->getMessage(); |
1563 | 1563 | } |
1564 | 1564 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1565 | 1565 | return $all[0]['total']; |
1566 | 1566 | } |
1567 | - public function getStatsPilot($pilot,$filter_name = '') { |
|
1567 | + public function getStatsPilot($pilot, $filter_name = '') { |
|
1568 | 1568 | global $globalArchiveMonths, $globalDBdriver; |
1569 | 1569 | if ($filter_name == '') $filter_name = $this->filter_name; |
1570 | 1570 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
1571 | 1571 | try { |
1572 | 1572 | $sth = $this->db->prepare($query); |
1573 | - $sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot)); |
|
1574 | - } catch(PDOException $e) { |
|
1573 | + $sth->execute(array(':filter_name' => $filter_name, ':pilot' => $pilot)); |
|
1574 | + } catch (PDOException $e) { |
|
1575 | 1575 | echo "error : ".$e->getMessage(); |
1576 | 1576 | } |
1577 | 1577 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1579,7 +1579,7 @@ discard block |
||
1579 | 1579 | else return 0; |
1580 | 1580 | } |
1581 | 1581 | |
1582 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1582 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
1583 | 1583 | global $globalDBdriver; |
1584 | 1584 | if ($filter_name == '') $filter_name = $this->filter_name; |
1585 | 1585 | if ($globalDBdriver == 'mysql') { |
@@ -1587,15 +1587,15 @@ discard block |
||
1587 | 1587 | } else { |
1588 | 1588 | $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);"; |
1589 | 1589 | } |
1590 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1590 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1591 | 1591 | try { |
1592 | 1592 | $sth = $this->db->prepare($query); |
1593 | 1593 | $sth->execute($query_values); |
1594 | - } catch(PDOException $e) { |
|
1594 | + } catch (PDOException $e) { |
|
1595 | 1595 | return "error : ".$e->getMessage(); |
1596 | 1596 | } |
1597 | 1597 | } |
1598 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1598 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
1599 | 1599 | global $globalDBdriver; |
1600 | 1600 | if ($filter_name == '') $filter_name = $this->filter_name; |
1601 | 1601 | if ($globalDBdriver == 'mysql') { |
@@ -1604,11 +1604,11 @@ discard block |
||
1604 | 1604 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
1605 | 1605 | $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);"; |
1606 | 1606 | } |
1607 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1607 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1608 | 1608 | try { |
1609 | 1609 | $sth = $this->db->prepare($query); |
1610 | 1610 | $sth->execute($query_values); |
1611 | - } catch(PDOException $e) { |
|
1611 | + } catch (PDOException $e) { |
|
1612 | 1612 | return "error : ".$e->getMessage(); |
1613 | 1613 | } |
1614 | 1614 | } |
@@ -1632,75 +1632,75 @@ discard block |
||
1632 | 1632 | } |
1633 | 1633 | */ |
1634 | 1634 | |
1635 | - public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
|
1635 | + public function getStatsSource($stats_type, $year = '', $month = '', $day = '') { |
|
1636 | 1636 | global $globalDBdriver; |
1637 | 1637 | $query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
1638 | 1638 | $query_values = array(); |
1639 | 1639 | if ($globalDBdriver == 'mysql') { |
1640 | 1640 | if ($year != '') { |
1641 | 1641 | $query .= ' AND YEAR(stats_date) = :year'; |
1642 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1642 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1643 | 1643 | } |
1644 | 1644 | if ($month != '') { |
1645 | 1645 | $query .= ' AND MONTH(stats_date) = :month'; |
1646 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1646 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1647 | 1647 | } |
1648 | 1648 | if ($day != '') { |
1649 | 1649 | $query .= ' AND DAY(stats_date) = :day'; |
1650 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1650 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1651 | 1651 | } |
1652 | 1652 | } else { |
1653 | 1653 | if ($year != '') { |
1654 | 1654 | $query .= ' AND EXTRACT(YEAR FROM stats_date) = :year'; |
1655 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1655 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1656 | 1656 | } |
1657 | 1657 | if ($month != '') { |
1658 | 1658 | $query .= ' AND EXTRACT(MONTH FROM stats_date) = :month'; |
1659 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1659 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1660 | 1660 | } |
1661 | 1661 | if ($day != '') { |
1662 | 1662 | $query .= ' AND EXTRACT(DAY FROM stats_date) = :day'; |
1663 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1663 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1664 | 1664 | } |
1665 | 1665 | } |
1666 | 1666 | $query .= " ORDER BY source_name"; |
1667 | - $query_values = array_merge($query_values,array(':stats_type' => $stats_type)); |
|
1667 | + $query_values = array_merge($query_values, array(':stats_type' => $stats_type)); |
|
1668 | 1668 | try { |
1669 | 1669 | $sth = $this->db->prepare($query); |
1670 | 1670 | $sth->execute($query_values); |
1671 | - } catch(PDOException $e) { |
|
1671 | + } catch (PDOException $e) { |
|
1672 | 1672 | echo "error : ".$e->getMessage(); |
1673 | 1673 | } |
1674 | 1674 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1675 | 1675 | return $all; |
1676 | 1676 | } |
1677 | 1677 | |
1678 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
1678 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
1679 | 1679 | global $globalDBdriver; |
1680 | 1680 | if ($globalDBdriver == 'mysql') { |
1681 | 1681 | $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"; |
1682 | 1682 | } else { |
1683 | 1683 | $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);"; |
1684 | 1684 | } |
1685 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
1685 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
1686 | 1686 | try { |
1687 | 1687 | $sth = $this->db->prepare($query); |
1688 | 1688 | $sth->execute($query_values); |
1689 | - } catch(PDOException $e) { |
|
1689 | + } catch (PDOException $e) { |
|
1690 | 1690 | return "error : ".$e->getMessage(); |
1691 | 1691 | } |
1692 | 1692 | } |
1693 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
1693 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
1694 | 1694 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
1695 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1695 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1696 | 1696 | try { |
1697 | 1697 | $sth = $this->db->prepare($query); |
1698 | 1698 | $sth->execute($query_values); |
1699 | - } catch(PDOException $e) { |
|
1699 | + } catch (PDOException $e) { |
|
1700 | 1700 | return "error : ".$e->getMessage(); |
1701 | 1701 | } |
1702 | 1702 | } |
1703 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
|
1703 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1704 | 1704 | global $globalDBdriver; |
1705 | 1705 | if ($globalDBdriver == 'mysql') { |
1706 | 1706 | if ($reset) { |
@@ -1715,15 +1715,15 @@ discard block |
||
1715 | 1715 | $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);"; |
1716 | 1716 | } |
1717 | 1717 | } |
1718 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1718 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1719 | 1719 | try { |
1720 | 1720 | $sth = $this->db->prepare($query); |
1721 | 1721 | $sth->execute($query_values); |
1722 | - } catch(PDOException $e) { |
|
1722 | + } catch (PDOException $e) { |
|
1723 | 1723 | return "error : ".$e->getMessage(); |
1724 | 1724 | } |
1725 | 1725 | } |
1726 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
|
1726 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1727 | 1727 | global $globalDBdriver; |
1728 | 1728 | if ($globalDBdriver == 'mysql') { |
1729 | 1729 | if ($reset) { |
@@ -1738,15 +1738,15 @@ discard block |
||
1738 | 1738 | $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);"; |
1739 | 1739 | } |
1740 | 1740 | } |
1741 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1741 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1742 | 1742 | try { |
1743 | 1743 | $sth = $this->db->prepare($query); |
1744 | 1744 | $sth->execute($query_values); |
1745 | - } catch(PDOException $e) { |
|
1745 | + } catch (PDOException $e) { |
|
1746 | 1746 | return "error : ".$e->getMessage(); |
1747 | 1747 | } |
1748 | 1748 | } |
1749 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1749 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1750 | 1750 | global $globalDBdriver; |
1751 | 1751 | if ($globalDBdriver == 'mysql') { |
1752 | 1752 | if ($reset) { |
@@ -1761,15 +1761,15 @@ discard block |
||
1761 | 1761 | $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);"; |
1762 | 1762 | } |
1763 | 1763 | } |
1764 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
1764 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name, ':airline' => $airline_icao); |
|
1765 | 1765 | try { |
1766 | 1766 | $sth = $this->db->prepare($query); |
1767 | 1767 | $sth->execute($query_values); |
1768 | - } catch(PDOException $e) { |
|
1768 | + } catch (PDOException $e) { |
|
1769 | 1769 | return "error : ".$e->getMessage(); |
1770 | 1770 | } |
1771 | 1771 | } |
1772 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1772 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1773 | 1773 | global $globalDBdriver; |
1774 | 1774 | if ($globalDBdriver == 'mysql') { |
1775 | 1775 | if ($reset) { |
@@ -1784,15 +1784,15 @@ discard block |
||
1784 | 1784 | $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);"; |
1785 | 1785 | } |
1786 | 1786 | } |
1787 | - $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 | + $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); |
|
1788 | 1788 | try { |
1789 | 1789 | $sth = $this->db->prepare($query); |
1790 | 1790 | $sth->execute($query_values); |
1791 | - } catch(PDOException $e) { |
|
1791 | + } catch (PDOException $e) { |
|
1792 | 1792 | return "error : ".$e->getMessage(); |
1793 | 1793 | } |
1794 | 1794 | } |
1795 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
|
1795 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) { |
|
1796 | 1796 | global $globalDBdriver; |
1797 | 1797 | if ($globalDBdriver == 'mysql') { |
1798 | 1798 | if ($reset) { |
@@ -1807,15 +1807,15 @@ discard block |
||
1807 | 1807 | $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);"; |
1808 | 1808 | } |
1809 | 1809 | } |
1810 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1810 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1811 | 1811 | try { |
1812 | 1812 | $sth = $this->db->prepare($query); |
1813 | 1813 | $sth->execute($query_values); |
1814 | - } catch(PDOException $e) { |
|
1814 | + } catch (PDOException $e) { |
|
1815 | 1815 | return "error : ".$e->getMessage(); |
1816 | 1816 | } |
1817 | 1817 | } |
1818 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
|
1818 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) { |
|
1819 | 1819 | global $globalDBdriver; |
1820 | 1820 | if ($globalDBdriver == 'mysql') { |
1821 | 1821 | if ($reset) { |
@@ -1830,15 +1830,15 @@ discard block |
||
1830 | 1830 | $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);"; |
1831 | 1831 | } |
1832 | 1832 | } |
1833 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1833 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1834 | 1834 | try { |
1835 | 1835 | $sth = $this->db->prepare($query); |
1836 | 1836 | $sth->execute($query_values); |
1837 | - } catch(PDOException $e) { |
|
1837 | + } catch (PDOException $e) { |
|
1838 | 1838 | return "error : ".$e->getMessage(); |
1839 | 1839 | } |
1840 | 1840 | } |
1841 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
|
1841 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) { |
|
1842 | 1842 | global $globalDBdriver; |
1843 | 1843 | if ($globalDBdriver == 'mysql') { |
1844 | 1844 | if ($reset) { |
@@ -1853,15 +1853,15 @@ discard block |
||
1853 | 1853 | $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);"; |
1854 | 1854 | } |
1855 | 1855 | } |
1856 | - $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 | + $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); |
|
1857 | 1857 | try { |
1858 | 1858 | $sth = $this->db->prepare($query); |
1859 | 1859 | $sth->execute($query_values); |
1860 | - } catch(PDOException $e) { |
|
1860 | + } catch (PDOException $e) { |
|
1861 | 1861 | return "error : ".$e->getMessage(); |
1862 | 1862 | } |
1863 | 1863 | } |
1864 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1864 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1865 | 1865 | global $globalDBdriver; |
1866 | 1866 | if ($airport_icao != '') { |
1867 | 1867 | if ($globalDBdriver == 'mysql') { |
@@ -1877,16 +1877,16 @@ discard block |
||
1877 | 1877 | $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);"; |
1878 | 1878 | } |
1879 | 1879 | } |
1880 | - $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 | + $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); |
|
1881 | 1881 | try { |
1882 | 1882 | $sth = $this->db->prepare($query); |
1883 | 1883 | $sth->execute($query_values); |
1884 | - } catch(PDOException $e) { |
|
1884 | + } catch (PDOException $e) { |
|
1885 | 1885 | return "error : ".$e->getMessage(); |
1886 | 1886 | } |
1887 | 1887 | } |
1888 | 1888 | } |
1889 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1889 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1890 | 1890 | global $globalDBdriver; |
1891 | 1891 | if ($airport_icao != '') { |
1892 | 1892 | if ($globalDBdriver == 'mysql') { |
@@ -1894,16 +1894,16 @@ discard block |
||
1894 | 1894 | } else { |
1895 | 1895 | $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);"; |
1896 | 1896 | } |
1897 | - $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 | + $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); |
|
1898 | 1898 | try { |
1899 | 1899 | $sth = $this->db->prepare($query); |
1900 | 1900 | $sth->execute($query_values); |
1901 | - } catch(PDOException $e) { |
|
1901 | + } catch (PDOException $e) { |
|
1902 | 1902 | return "error : ".$e->getMessage(); |
1903 | 1903 | } |
1904 | 1904 | } |
1905 | 1905 | } |
1906 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1906 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1907 | 1907 | global $globalDBdriver; |
1908 | 1908 | if ($airport_icao != '') { |
1909 | 1909 | if ($globalDBdriver == 'mysql') { |
@@ -1919,16 +1919,16 @@ discard block |
||
1919 | 1919 | $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);"; |
1920 | 1920 | } |
1921 | 1921 | } |
1922 | - $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 | + $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); |
|
1923 | 1923 | try { |
1924 | 1924 | $sth = $this->db->prepare($query); |
1925 | 1925 | $sth->execute($query_values); |
1926 | - } catch(PDOException $e) { |
|
1926 | + } catch (PDOException $e) { |
|
1927 | 1927 | return "error : ".$e->getMessage(); |
1928 | 1928 | } |
1929 | 1929 | } |
1930 | 1930 | } |
1931 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1931 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1932 | 1932 | global $globalDBdriver; |
1933 | 1933 | if ($airport_icao != '') { |
1934 | 1934 | if ($globalDBdriver == 'mysql') { |
@@ -1936,11 +1936,11 @@ discard block |
||
1936 | 1936 | } else { |
1937 | 1937 | $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);"; |
1938 | 1938 | } |
1939 | - $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 | + $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); |
|
1940 | 1940 | try { |
1941 | 1941 | $sth = $this->db->prepare($query); |
1942 | 1942 | $sth->execute($query_values); |
1943 | - } catch(PDOException $e) { |
|
1943 | + } catch (PDOException $e) { |
|
1944 | 1944 | return "error : ".$e->getMessage(); |
1945 | 1945 | } |
1946 | 1946 | } |
@@ -1952,7 +1952,7 @@ discard block |
||
1952 | 1952 | try { |
1953 | 1953 | $sth = $this->db->prepare($query); |
1954 | 1954 | $sth->execute($query_values); |
1955 | - } catch(PDOException $e) { |
|
1955 | + } catch (PDOException $e) { |
|
1956 | 1956 | return "error : ".$e->getMessage(); |
1957 | 1957 | } |
1958 | 1958 | } |
@@ -1962,7 +1962,7 @@ discard block |
||
1962 | 1962 | try { |
1963 | 1963 | $sth = $this->db->prepare($query); |
1964 | 1964 | $sth->execute($query_values); |
1965 | - } catch(PDOException $e) { |
|
1965 | + } catch (PDOException $e) { |
|
1966 | 1966 | return "error : ".$e->getMessage(); |
1967 | 1967 | } |
1968 | 1968 | } |
@@ -1972,13 +1972,13 @@ discard block |
||
1972 | 1972 | try { |
1973 | 1973 | $sth = $this->db->prepare($query); |
1974 | 1974 | $sth->execute($query_values); |
1975 | - } catch(PDOException $e) { |
|
1975 | + } catch (PDOException $e) { |
|
1976 | 1976 | return "error : ".$e->getMessage(); |
1977 | 1977 | } |
1978 | 1978 | } |
1979 | 1979 | |
1980 | 1980 | public function addOldStats() { |
1981 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear, $globalAccidents; |
|
1981 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear, $globalAccidents; |
|
1982 | 1982 | $Common = new Common(); |
1983 | 1983 | $Connection = new Connection($this->db); |
1984 | 1984 | date_default_timezone_set('UTC'); |
@@ -1996,41 +1996,41 @@ discard block |
||
1996 | 1996 | $Spotter = new Spotter($this->db); |
1997 | 1997 | |
1998 | 1998 | if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
1999 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1999 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
2000 | 2000 | foreach ($alldata as $number) { |
2001 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
|
2001 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset); |
|
2002 | 2002 | } |
2003 | 2003 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
2004 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
2004 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
2005 | 2005 | foreach ($alldata as $number) { |
2006 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
|
2006 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset); |
|
2007 | 2007 | } |
2008 | 2008 | if ($globalDebug) echo 'Count all registrations...'."\n"; |
2009 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
2009 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
2010 | 2010 | foreach ($alldata as $number) { |
2011 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
|
2011 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset); |
|
2012 | 2012 | } |
2013 | 2013 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
2014 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
2014 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
2015 | 2015 | foreach ($alldata as $number) { |
2016 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
2016 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
2017 | 2017 | } |
2018 | 2018 | if ($globalDebug) echo 'Count all owners...'."\n"; |
2019 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
2019 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
2020 | 2020 | foreach ($alldata as $number) { |
2021 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
|
2021 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset); |
|
2022 | 2022 | } |
2023 | 2023 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
2024 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
2024 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
2025 | 2025 | foreach ($alldata as $number) { |
2026 | 2026 | if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name']; |
2027 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
|
2027 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset); |
|
2028 | 2028 | } |
2029 | 2029 | |
2030 | 2030 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
2031 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
2031 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
2032 | 2032 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
2033 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
2033 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
2034 | 2034 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
2035 | 2035 | $alldata = array(); |
2036 | 2036 | foreach ($pall as $value) { |
@@ -2047,14 +2047,14 @@ discard block |
||
2047 | 2047 | foreach ($alldata as $key => $row) { |
2048 | 2048 | $count[$key] = $row['airport_departure_icao_count']; |
2049 | 2049 | } |
2050 | - array_multisort($count,SORT_DESC,$alldata); |
|
2050 | + array_multisort($count, SORT_DESC, $alldata); |
|
2051 | 2051 | foreach ($alldata as $number) { |
2052 | - 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 | + 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); |
|
2053 | 2053 | } |
2054 | 2054 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
2055 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
2055 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
2056 | 2056 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
2057 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
2057 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
2058 | 2058 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
2059 | 2059 | $alldata = array(); |
2060 | 2060 | foreach ($pall as $value) { |
@@ -2071,18 +2071,18 @@ discard block |
||
2071 | 2071 | foreach ($alldata as $key => $row) { |
2072 | 2072 | $count[$key] = $row['airport_arrival_icao_count']; |
2073 | 2073 | } |
2074 | - array_multisort($count,SORT_DESC,$alldata); |
|
2074 | + array_multisort($count, SORT_DESC, $alldata); |
|
2075 | 2075 | foreach ($alldata as $number) { |
2076 | - 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 | + 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); |
|
2077 | 2077 | } |
2078 | 2078 | if ($Connection->tableExists('countries')) { |
2079 | 2079 | if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
2080 | 2080 | //$SpotterArchive = new SpotterArchive(); |
2081 | 2081 | //$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
2082 | 2082 | $Spotter = new Spotter($this->db); |
2083 | - $alldata = $Spotter->countAllFlightOverCountries(false,0,$last_update_day); |
|
2083 | + $alldata = $Spotter->countAllFlightOverCountries(false, 0, $last_update_day); |
|
2084 | 2084 | foreach ($alldata as $number) { |
2085 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'','',$reset); |
|
2085 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', '', $reset); |
|
2086 | 2086 | } |
2087 | 2087 | } |
2088 | 2088 | |
@@ -2092,12 +2092,12 @@ discard block |
||
2092 | 2092 | $this->deleteStatsByType('fatalities_byyear'); |
2093 | 2093 | $alldata = $Accident->countFatalitiesByYear(); |
2094 | 2094 | foreach ($alldata as $number) { |
2095 | - $this->addStat('fatalities_byyear',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,1,1,$number['year']))); |
|
2095 | + $this->addStat('fatalities_byyear', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, 1, 1, $number['year']))); |
|
2096 | 2096 | } |
2097 | 2097 | $this->deleteStatsByType('fatalities_bymonth'); |
2098 | 2098 | $alldata = $Accident->countFatalitiesLast12Months(); |
2099 | 2099 | foreach ($alldata as $number) { |
2100 | - $this->addStat('fatalities_bymonth',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month'],1,$number['year']))); |
|
2100 | + $this->addStat('fatalities_bymonth', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month'], 1, $number['year']))); |
|
2101 | 2101 | } |
2102 | 2102 | } |
2103 | 2103 | |
@@ -2111,37 +2111,37 @@ discard block |
||
2111 | 2111 | $lastyear = false; |
2112 | 2112 | foreach ($alldata as $number) { |
2113 | 2113 | if ($number['year_name'] != date('Y')) $lastyear = true; |
2114 | - $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 | + $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']))); |
|
2115 | 2115 | } |
2116 | 2116 | if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
2117 | 2117 | $alldata = $Spotter->countAllMilitaryMonths($filter_last_month); |
2118 | 2118 | foreach ($alldata as $number) { |
2119 | - $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 | + $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']))); |
|
2120 | 2120 | } |
2121 | 2121 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
2122 | 2122 | $alldata = $Spotter->countAllMonthsOwners($filter_last_month); |
2123 | 2123 | foreach ($alldata as $number) { |
2124 | - $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 | + $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']))); |
|
2125 | 2125 | } |
2126 | 2126 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
2127 | 2127 | $alldata = $Spotter->countAllMonthsPilots($filter_last_month); |
2128 | 2128 | foreach ($alldata as $number) { |
2129 | - $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 | + $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']))); |
|
2130 | 2130 | } |
2131 | 2131 | if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
2132 | 2132 | $alldata = $Spotter->countAllMonthsAirlines($filter_last_month); |
2133 | 2133 | foreach ($alldata as $number) { |
2134 | - $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 | + $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']))); |
|
2135 | 2135 | } |
2136 | 2136 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
2137 | 2137 | $alldata = $Spotter->countAllMonthsAircrafts($filter_last_month); |
2138 | 2138 | foreach ($alldata as $number) { |
2139 | - $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 | + $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']))); |
|
2140 | 2140 | } |
2141 | 2141 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
2142 | 2142 | $alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month); |
2143 | 2143 | foreach ($alldata as $number) { |
2144 | - $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 | + $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']))); |
|
2145 | 2145 | } |
2146 | 2146 | if ($globalDebug) echo 'Airports data...'."\n"; |
2147 | 2147 | if ($globalDebug) echo '...Departure'."\n"; |
@@ -2186,7 +2186,7 @@ discard block |
||
2186 | 2186 | } |
2187 | 2187 | $alldata = $pall; |
2188 | 2188 | foreach ($alldata as $number) { |
2189 | - $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 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
2190 | 2190 | } |
2191 | 2191 | echo '...Arrival'."\n"; |
2192 | 2192 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -2227,7 +2227,7 @@ discard block |
||
2227 | 2227 | } |
2228 | 2228 | $alldata = $pall; |
2229 | 2229 | foreach ($alldata as $number) { |
2230 | - $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 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
2231 | 2231 | } |
2232 | 2232 | |
2233 | 2233 | echo 'Flights data...'."\n"; |
@@ -2235,28 +2235,28 @@ discard block |
||
2235 | 2235 | echo '-> countAllDatesLastMonth...'."\n"; |
2236 | 2236 | $alldata = $Spotter->countAllDatesLastMonth($filter_last_month); |
2237 | 2237 | foreach ($alldata as $number) { |
2238 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
2238 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
2239 | 2239 | } |
2240 | 2240 | echo '-> countAllDates...'."\n"; |
2241 | 2241 | $previousdata = $this->countAllDates(); |
2242 | 2242 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
2243 | 2243 | $this->deleteStatFlight('date'); |
2244 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter_last_month)); |
|
2244 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter_last_month)); |
|
2245 | 2245 | $values = array(); |
2246 | 2246 | foreach ($alldata as $cnt) { |
2247 | 2247 | $values[] = $cnt['date_count']; |
2248 | 2248 | } |
2249 | - array_multisort($values,SORT_DESC,$alldata); |
|
2250 | - array_splice($alldata,11); |
|
2249 | + array_multisort($values, SORT_DESC, $alldata); |
|
2250 | + array_splice($alldata, 11); |
|
2251 | 2251 | foreach ($alldata as $number) { |
2252 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
2252 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
2253 | 2253 | } |
2254 | 2254 | |
2255 | 2255 | $this->deleteStatFlight('hour'); |
2256 | 2256 | echo '-> countAllHours...'."\n"; |
2257 | - $alldata = $Spotter->countAllHours('hour',$filter_last_month); |
|
2257 | + $alldata = $Spotter->countAllHours('hour', $filter_last_month); |
|
2258 | 2258 | foreach ($alldata as $number) { |
2259 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
2259 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
2260 | 2260 | } |
2261 | 2261 | |
2262 | 2262 | // Count by airlines |
@@ -2265,42 +2265,42 @@ discard block |
||
2265 | 2265 | if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
2266 | 2266 | $SpotterArchive = new SpotterArchive($this->db); |
2267 | 2267 | //$Spotter = new Spotter($this->db); |
2268 | - $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
|
2268 | + $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false, 0, $last_update_day); |
|
2269 | 2269 | //$alldata = $Spotter->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
2270 | 2270 | foreach ($alldata as $number) { |
2271 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
|
2271 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], $number['airline_icao'], '', $reset); |
|
2272 | 2272 | } |
2273 | 2273 | } |
2274 | 2274 | if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
2275 | 2275 | $Spotter = new Spotter($this->db); |
2276 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
2276 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
2277 | 2277 | foreach ($alldata as $number) { |
2278 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
|
2278 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset); |
|
2279 | 2279 | } |
2280 | 2280 | if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
2281 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
2281 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
2282 | 2282 | foreach ($alldata as $number) { |
2283 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
|
2283 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset); |
|
2284 | 2284 | } |
2285 | 2285 | if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
2286 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
2286 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
2287 | 2287 | foreach ($alldata as $number) { |
2288 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
2288 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
2289 | 2289 | } |
2290 | 2290 | if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
2291 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
2291 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
2292 | 2292 | foreach ($alldata as $number) { |
2293 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
|
2293 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset); |
|
2294 | 2294 | } |
2295 | 2295 | if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
2296 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
2296 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
2297 | 2297 | foreach ($alldata as $number) { |
2298 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
|
2298 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset); |
|
2299 | 2299 | } |
2300 | 2300 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
2301 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2301 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
2302 | 2302 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
2303 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2303 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
2304 | 2304 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
2305 | 2305 | //$alldata = array(); |
2306 | 2306 | foreach ($dall as $value) { |
@@ -2320,12 +2320,12 @@ discard block |
||
2320 | 2320 | } |
2321 | 2321 | $alldata = $pall; |
2322 | 2322 | foreach ($alldata as $number) { |
2323 | - 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 | + 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); |
|
2324 | 2324 | } |
2325 | 2325 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
2326 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2326 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
2327 | 2327 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
2328 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2328 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
2329 | 2329 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
2330 | 2330 | //$alldata = array(); |
2331 | 2331 | foreach ($dall as $value) { |
@@ -2345,7 +2345,7 @@ discard block |
||
2345 | 2345 | } |
2346 | 2346 | $alldata = $pall; |
2347 | 2347 | foreach ($alldata as $number) { |
2348 | - 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 | + 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); |
|
2349 | 2349 | } |
2350 | 2350 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
2351 | 2351 | $Spotter = new Spotter($this->db); |
@@ -2353,27 +2353,27 @@ discard block |
||
2353 | 2353 | $lastyear = false; |
2354 | 2354 | foreach ($alldata as $number) { |
2355 | 2355 | if ($number['year_name'] != date('Y')) $lastyear = true; |
2356 | - $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 | + $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']); |
|
2357 | 2357 | } |
2358 | 2358 | if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
2359 | 2359 | $alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month); |
2360 | 2360 | foreach ($alldata as $number) { |
2361 | - $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 | + $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']); |
|
2362 | 2362 | } |
2363 | 2363 | if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
2364 | 2364 | $alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month); |
2365 | 2365 | foreach ($alldata as $number) { |
2366 | - $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 | + $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']); |
|
2367 | 2367 | } |
2368 | 2368 | if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
2369 | 2369 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month); |
2370 | 2370 | foreach ($alldata as $number) { |
2371 | - $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 | + $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']); |
|
2372 | 2372 | } |
2373 | 2373 | if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
2374 | 2374 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month); |
2375 | 2375 | foreach ($alldata as $number) { |
2376 | - $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 | + $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']); |
|
2377 | 2377 | } |
2378 | 2378 | if ($globalDebug) echo '...Departure'."\n"; |
2379 | 2379 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -2396,7 +2396,7 @@ discard block |
||
2396 | 2396 | } |
2397 | 2397 | $alldata = $pall; |
2398 | 2398 | foreach ($alldata as $number) { |
2399 | - $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 | + $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']); |
|
2400 | 2400 | } |
2401 | 2401 | if ($globalDebug) echo '...Arrival'."\n"; |
2402 | 2402 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -2419,32 +2419,32 @@ discard block |
||
2419 | 2419 | } |
2420 | 2420 | $alldata = $pall; |
2421 | 2421 | foreach ($alldata as $number) { |
2422 | - $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 | + $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']); |
|
2423 | 2423 | } |
2424 | 2424 | |
2425 | 2425 | if ($globalDebug) echo 'Flights data...'."\n"; |
2426 | 2426 | if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
2427 | 2427 | $alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month); |
2428 | 2428 | foreach ($alldata as $number) { |
2429 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
2429 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
2430 | 2430 | } |
2431 | 2431 | if ($globalDebug) echo '-> countAllDates...'."\n"; |
2432 | 2432 | //$previousdata = $this->countAllDatesByAirlines(); |
2433 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month)); |
|
2433 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines($filter_last_month)); |
|
2434 | 2434 | $values = array(); |
2435 | 2435 | foreach ($alldata as $cnt) { |
2436 | 2436 | $values[] = $cnt['date_count']; |
2437 | 2437 | } |
2438 | - array_multisort($values,SORT_DESC,$alldata); |
|
2439 | - array_splice($alldata,11); |
|
2438 | + array_multisort($values, SORT_DESC, $alldata); |
|
2439 | + array_splice($alldata, 11); |
|
2440 | 2440 | foreach ($alldata as $number) { |
2441 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
2441 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
2442 | 2442 | } |
2443 | 2443 | |
2444 | 2444 | if ($globalDebug) echo '-> countAllHours...'."\n"; |
2445 | - $alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month); |
|
2445 | + $alldata = $Spotter->countAllHoursByAirlines('hour', $filter_last_month); |
|
2446 | 2446 | foreach ($alldata as $number) { |
2447 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
2447 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
2448 | 2448 | } |
2449 | 2449 | |
2450 | 2450 | // Stats by filters |
@@ -2468,7 +2468,7 @@ discard block |
||
2468 | 2468 | $last_update_day = date('Y').'-01-01 00:00:00'; |
2469 | 2469 | } |
2470 | 2470 | } |
2471 | - if (isset($filter['DeleteLastYearStats']) && date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2471 | + if (isset($filter['DeleteLastYearStats']) && date('Y', strtotime($last_update_day)) != date('Y')) { |
|
2472 | 2472 | $last_update_day = date('Y').'-01-01 00:00:00'; |
2473 | 2473 | $reset = true; |
2474 | 2474 | } |
@@ -2476,38 +2476,38 @@ discard block |
||
2476 | 2476 | if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
2477 | 2477 | $Spotter = new Spotter($this->db); |
2478 | 2478 | if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
2479 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
2479 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
2480 | 2480 | foreach ($alldata as $number) { |
2481 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
|
2481 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset); |
|
2482 | 2482 | } |
2483 | 2483 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
2484 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
2484 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
2485 | 2485 | foreach ($alldata as $number) { |
2486 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
|
2486 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset); |
|
2487 | 2487 | } |
2488 | 2488 | if ($globalDebug) echo 'Count all aircraft registrations...'."\n"; |
2489 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
2489 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
2490 | 2490 | foreach ($alldata as $number) { |
2491 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
|
2491 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset); |
|
2492 | 2492 | } |
2493 | 2493 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
2494 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
2494 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
2495 | 2495 | foreach ($alldata as $number) { |
2496 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
|
2496 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset); |
|
2497 | 2497 | } |
2498 | 2498 | if ($globalDebug) echo 'Count all owners...'."\n"; |
2499 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
2499 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
2500 | 2500 | foreach ($alldata as $number) { |
2501 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
|
2501 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset); |
|
2502 | 2502 | } |
2503 | 2503 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
2504 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
2504 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
2505 | 2505 | foreach ($alldata as $number) { |
2506 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
|
2506 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset); |
|
2507 | 2507 | } |
2508 | 2508 | if ($globalDebug) echo 'Count departure airports...'."\n"; |
2509 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
2510 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
2509 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
2510 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
2511 | 2511 | $alldata = array(); |
2512 | 2512 | foreach ($pall as $value) { |
2513 | 2513 | $icao = $value['airport_departure_icao']; |
@@ -2523,13 +2523,13 @@ discard block |
||
2523 | 2523 | foreach ($alldata as $key => $row) { |
2524 | 2524 | $count[$key] = $row['airport_departure_icao_count']; |
2525 | 2525 | } |
2526 | - array_multisort($count,SORT_DESC,$alldata); |
|
2526 | + array_multisort($count, SORT_DESC, $alldata); |
|
2527 | 2527 | foreach ($alldata as $number) { |
2528 | - 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); |
|
2528 | + 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); |
|
2529 | 2529 | } |
2530 | 2530 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
2531 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2532 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2531 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
2532 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
2533 | 2533 | $alldata = array(); |
2534 | 2534 | foreach ($pall as $value) { |
2535 | 2535 | $icao = $value['airport_arrival_icao']; |
@@ -2545,9 +2545,9 @@ discard block |
||
2545 | 2545 | foreach ($alldata as $key => $row) { |
2546 | 2546 | $count[$key] = $row['airport_arrival_icao_count']; |
2547 | 2547 | } |
2548 | - array_multisort($count,SORT_DESC,$alldata); |
|
2548 | + array_multisort($count, SORT_DESC, $alldata); |
|
2549 | 2549 | foreach ($alldata as $number) { |
2550 | - 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); |
|
2550 | + 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); |
|
2551 | 2551 | } |
2552 | 2552 | if ($globalDebug) echo 'Count all months...'."\n"; |
2553 | 2553 | $Spotter = new Spotter($this->db); |
@@ -2555,36 +2555,36 @@ discard block |
||
2555 | 2555 | $lastyear = false; |
2556 | 2556 | foreach ($alldata as $number) { |
2557 | 2557 | if ($number['year_name'] != date('Y')) $lastyear = true; |
2558 | - $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); |
|
2558 | + $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); |
|
2559 | 2559 | } |
2560 | 2560 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
2561 | 2561 | $alldata = $Spotter->countAllMonthsOwners($filter); |
2562 | 2562 | foreach ($alldata as $number) { |
2563 | - $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); |
|
2563 | + $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); |
|
2564 | 2564 | } |
2565 | 2565 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
2566 | 2566 | $alldata = $Spotter->countAllMonthsPilots($filter); |
2567 | 2567 | foreach ($alldata as $number) { |
2568 | - $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); |
|
2568 | + $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); |
|
2569 | 2569 | } |
2570 | 2570 | if ($globalDebug) echo 'Count all military by months...'."\n"; |
2571 | 2571 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
2572 | 2572 | foreach ($alldata as $number) { |
2573 | - $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); |
|
2573 | + $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); |
|
2574 | 2574 | } |
2575 | 2575 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
2576 | 2576 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
2577 | 2577 | foreach ($alldata as $number) { |
2578 | - $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); |
|
2578 | + $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); |
|
2579 | 2579 | } |
2580 | 2580 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
2581 | 2581 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
2582 | 2582 | foreach ($alldata as $number) { |
2583 | - $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); |
|
2583 | + $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); |
|
2584 | 2584 | } |
2585 | 2585 | echo '...Departure'."\n"; |
2586 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
2587 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
2586 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
2587 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
2588 | 2588 | foreach ($dall as $value) { |
2589 | 2589 | $icao = $value['departure_airport_icao']; |
2590 | 2590 | $ddate = $value['date']; |
@@ -2602,11 +2602,11 @@ discard block |
||
2602 | 2602 | } |
2603 | 2603 | $alldata = $pall; |
2604 | 2604 | foreach ($alldata as $number) { |
2605 | - $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); |
|
2605 | + $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); |
|
2606 | 2606 | } |
2607 | 2607 | echo '...Arrival'."\n"; |
2608 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
2609 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
2608 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
2609 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
2610 | 2610 | foreach ($dall as $value) { |
2611 | 2611 | $icao = $value['arrival_airport_icao']; |
2612 | 2612 | $ddate = $value['date']; |
@@ -2624,39 +2624,39 @@ discard block |
||
2624 | 2624 | } |
2625 | 2625 | $alldata = $pall; |
2626 | 2626 | foreach ($alldata as $number) { |
2627 | - $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); |
|
2627 | + $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); |
|
2628 | 2628 | } |
2629 | 2629 | echo 'Flights data...'."\n"; |
2630 | 2630 | echo '-> countAllDatesLastMonth...'."\n"; |
2631 | 2631 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
2632 | 2632 | foreach ($alldata as $number) { |
2633 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
2633 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2634 | 2634 | } |
2635 | 2635 | echo '-> countAllDates...'."\n"; |
2636 | - $previousdata = $this->countAllDates('',$filter_name); |
|
2637 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
2636 | + $previousdata = $this->countAllDates('', $filter_name); |
|
2637 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
2638 | 2638 | $values = array(); |
2639 | 2639 | foreach ($alldata as $cnt) { |
2640 | 2640 | $values[] = $cnt['date_count']; |
2641 | 2641 | } |
2642 | - array_multisort($values,SORT_DESC,$alldata); |
|
2643 | - array_splice($alldata,11); |
|
2642 | + array_multisort($values, SORT_DESC, $alldata); |
|
2643 | + array_splice($alldata, 11); |
|
2644 | 2644 | foreach ($alldata as $number) { |
2645 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
2645 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2646 | 2646 | } |
2647 | 2647 | |
2648 | 2648 | echo '-> countAllHours...'."\n"; |
2649 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
2649 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
2650 | 2650 | foreach ($alldata as $number) { |
2651 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
2651 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
2652 | 2652 | } |
2653 | 2653 | echo 'Insert last stats update date...'."\n"; |
2654 | 2654 | date_default_timezone_set('UTC'); |
2655 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
2655 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
|
2656 | 2656 | if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
2657 | - if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2657 | + if (date('Y', strtotime($last_update_day)) != date('Y')) { |
|
2658 | 2658 | $this->deleteOldStats($filter_name); |
2659 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
2659 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
|
2660 | 2660 | } |
2661 | 2661 | } |
2662 | 2662 | } |
@@ -2668,16 +2668,16 @@ discard block |
||
2668 | 2668 | // SUM all previous month to put as year |
2669 | 2669 | $previous_year = date('Y'); |
2670 | 2670 | $previous_year--; |
2671 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2672 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2673 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2674 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2671 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2672 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2673 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2674 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2675 | 2675 | $allairlines = $this->getAllAirlineNames(); |
2676 | 2676 | foreach ($allairlines as $data) { |
2677 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2678 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2679 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2680 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2677 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2678 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2679 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2680 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2681 | 2681 | } |
2682 | 2682 | |
2683 | 2683 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -2686,7 +2686,7 @@ discard block |
||
2686 | 2686 | try { |
2687 | 2687 | $sth = $this->db->prepare($query); |
2688 | 2688 | $sth->execute(); |
2689 | - } catch(PDOException $e) { |
|
2689 | + } catch (PDOException $e) { |
|
2690 | 2690 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2691 | 2691 | } |
2692 | 2692 | } |
@@ -2699,15 +2699,15 @@ discard block |
||
2699 | 2699 | try { |
2700 | 2700 | $sth = $this->db->prepare($query); |
2701 | 2701 | $sth->execute(); |
2702 | - } catch(PDOException $e) { |
|
2702 | + } catch (PDOException $e) { |
|
2703 | 2703 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2704 | 2704 | } |
2705 | 2705 | } |
2706 | 2706 | if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
2707 | 2707 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
2708 | - if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
2708 | + if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
|
2709 | 2709 | $this->deleteOldStats(); |
2710 | - $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
2710 | + $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
|
2711 | 2711 | $lastyearupdate = true; |
2712 | 2712 | } |
2713 | 2713 | } |
@@ -2729,7 +2729,7 @@ discard block |
||
2729 | 2729 | try { |
2730 | 2730 | $sth = $this->db->prepare($query); |
2731 | 2731 | $sth->execute(); |
2732 | - } catch(PDOException $e) { |
|
2732 | + } catch (PDOException $e) { |
|
2733 | 2733 | return "error : ".$e->getMessage(); |
2734 | 2734 | } |
2735 | 2735 | } |
@@ -2744,14 +2744,14 @@ discard block |
||
2744 | 2744 | try { |
2745 | 2745 | $sth = $this->db->prepare($query); |
2746 | 2746 | $sth->execute(); |
2747 | - } catch(PDOException $e) { |
|
2747 | + } catch (PDOException $e) { |
|
2748 | 2748 | return "error : ".$e->getMessage(); |
2749 | 2749 | } |
2750 | 2750 | } |
2751 | 2751 | if (!isset($lastyearupdate)) { |
2752 | 2752 | echo 'Insert last stats update date...'."\n"; |
2753 | 2753 | date_default_timezone_set('UTC'); |
2754 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
2754 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
2755 | 2755 | } |
2756 | 2756 | if ($globalStatsResetYear) { |
2757 | 2757 | require_once(dirname(__FILE__).'/../install/class.settings.php'); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | try { |
17 | 17 | $sth = $this->db->prepare($query); |
18 | 18 | $sth->execute($query_values); |
19 | - } catch(PDOException $e) { |
|
19 | + } catch (PDOException $e) { |
|
20 | 20 | return "error : ".$e->getMessage(); |
21 | 21 | } |
22 | 22 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | try { |
30 | 30 | $sth = $this->db->prepare($query); |
31 | 31 | $sth->execute($query_values); |
32 | - } catch(PDOException $e) { |
|
32 | + } catch (PDOException $e) { |
|
33 | 33 | return "error : ".$e->getMessage(); |
34 | 34 | } |
35 | 35 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
36 | 36 | return $all; |
37 | 37 | } |
38 | 38 | |
39 | - public function getLocationInfobyNameType($name,$type) { |
|
39 | + public function getLocationInfobyNameType($name, $type) { |
|
40 | 40 | $query = "SELECT * FROM source_location WHERE name = :name AND type = :type"; |
41 | - $query_values = array(':name' => $name,':type' => $type); |
|
41 | + $query_values = array(':name' => $name, ':type' => $type); |
|
42 | 42 | try { |
43 | 43 | $sth = $this->db->prepare($query); |
44 | 44 | $sth->execute($query_values); |
45 | - } catch(PDOException $e) { |
|
45 | + } catch (PDOException $e) { |
|
46 | 46 | return "error : ".$e->getMessage(); |
47 | 47 | } |
48 | 48 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | try { |
56 | 56 | $sth = $this->db->prepare($query); |
57 | 57 | $sth->execute($query_values); |
58 | - } catch(PDOException $e) { |
|
58 | + } catch (PDOException $e) { |
|
59 | 59 | return "error : ".$e->getMessage(); |
60 | 60 | } |
61 | 61 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | public function getLocationInfoByType($type, $coord = array(), $limit = false) { |
66 | 66 | $query = "SELECT * FROM source_location WHERE type = :type"; |
67 | 67 | if (is_array($coord) && !empty($coord)) { |
68 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
69 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
70 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
71 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
68 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
69 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
70 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
71 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
72 | 72 | $query .= " AND source_location.latitude BETWEEN ".$minlat." AND ".$maxlat." AND source_location.longitude BETWEEN ".$minlong." AND ".$maxlong." AND source_location.latitude <> 0 AND source_location.longitude <> 0"; |
73 | 73 | } |
74 | 74 | $query .= " ORDER BY last_seen DESC"; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | try { |
78 | 78 | $sth = $this->db->prepare($query); |
79 | 79 | $sth->execute($query_values); |
80 | - } catch(PDOException $e) { |
|
80 | + } catch (PDOException $e) { |
|
81 | 81 | return "error : ".$e->getMessage(); |
82 | 82 | } |
83 | 83 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | try { |
91 | 91 | $sth = $this->db->prepare($query); |
92 | 92 | $sth->execute($query_values); |
93 | - } catch(PDOException $e) { |
|
93 | + } catch (PDOException $e) { |
|
94 | 94 | return "error : ".$e->getMessage(); |
95 | 95 | } |
96 | 96 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -103,56 +103,56 @@ discard block |
||
103 | 103 | try { |
104 | 104 | $sth = $this->db->prepare($query); |
105 | 105 | $sth->execute($query_values); |
106 | - } catch(PDOException $e) { |
|
106 | + } catch (PDOException $e) { |
|
107 | 107 | return "error : ".$e->getMessage(); |
108 | 108 | } |
109 | 109 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
110 | 110 | return $all; |
111 | 111 | } |
112 | 112 | |
113 | - public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') { |
|
113 | + public function addLocation($name, $latitude, $longitude, $altitude, $city, $country, $source, $logo = 'antenna.png', $type = '', $source_id = 0, $location_id = 0, $last_seen = '', $description = '') { |
|
114 | 114 | if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
115 | 115 | $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)"; |
116 | - $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
|
116 | + $query_values = array(':name' => $name, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':city' => $city, ':country' => $country, ':logo' => $logo, ':source' => $source, ':type' => $type, ':source_id' => $source_id, ':last_seen' => $last_seen, ':location_id' => $location_id, ':description' => $description); |
|
117 | 117 | try { |
118 | 118 | $sth = $this->db->prepare($query); |
119 | 119 | $sth->execute($query_values); |
120 | - } catch(PDOException $e) { |
|
120 | + } catch (PDOException $e) { |
|
121 | 121 | echo "error : ".$e->getMessage(); |
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
125 | - public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') { |
|
125 | + public function updateLocation($name, $latitude, $longitude, $altitude, $city, $country, $source, $logo = 'antenna.png', $type = '', $source_id = 0, $location_id = 0, $last_seen = '', $description = '') { |
|
126 | 126 | if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
127 | 127 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source"; |
128 | - $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
|
128 | + $query_values = array(':name' => $name, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':city' => $city, ':country' => $country, ':logo' => $logo, ':source' => $source, ':type' => $type, ':source_id' => $source_id, ':last_seen' => $last_seen, ':location_id' => $location_id, ':description' => $description); |
|
129 | 129 | try { |
130 | 130 | $sth = $this->db->prepare($query); |
131 | 131 | $sth->execute($query_values); |
132 | - } catch(PDOException $e) { |
|
132 | + } catch (PDOException $e) { |
|
133 | 133 | return "error : ".$e->getMessage(); |
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - public function updateLocationDescByName($name,$source,$source_id = 0,$description = '') { |
|
137 | + public function updateLocationDescByName($name, $source, $source_id = 0, $description = '') { |
|
138 | 138 | $query = "UPDATE source_location SET description = :description WHERE source_id = :source_id AND name = :name AND source = :source"; |
139 | - $query_values = array(':name' => $name,':source' => $source,':source_id' => $source_id,':description' => $description); |
|
139 | + $query_values = array(':name' => $name, ':source' => $source, ':source_id' => $source_id, ':description' => $description); |
|
140 | 140 | try { |
141 | 141 | $sth = $this->db->prepare($query); |
142 | 142 | $sth->execute($query_values); |
143 | - } catch(PDOException $e) { |
|
143 | + } catch (PDOException $e) { |
|
144 | 144 | return "error : ".$e->getMessage(); |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') { |
|
148 | + public function updateLocationByLocationID($name, $latitude, $longitude, $altitude, $city, $country, $source, $logo = 'antenna.png', $type = '', $source_id = 0, $location_id, $last_seen = '', $description = '') { |
|
149 | 149 | if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
150 | 150 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id"; |
151 | - $query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
|
151 | + $query_values = array(':source_id' => $source_id, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':city' => $city, ':country' => $country, ':logo' => $logo, ':source' => $source, ':type' => $type, ':last_seen' => $last_seen, ':location_id' => $location_id, ':description' => $description); |
|
152 | 152 | try { |
153 | 153 | $sth = $this->db->prepare($query); |
154 | 154 | $sth->execute($query_values); |
155 | - } catch(PDOException $e) { |
|
155 | + } catch (PDOException $e) { |
|
156 | 156 | echo "error : ".$e->getMessage(); |
157 | 157 | } |
158 | 158 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | try { |
164 | 164 | $sth = $this->db->prepare($query); |
165 | 165 | $sth->execute($query_values); |
166 | - } catch(PDOException $e) { |
|
166 | + } catch (PDOException $e) { |
|
167 | 167 | return "error : ".$e->getMessage(); |
168 | 168 | } |
169 | 169 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | try { |
175 | 175 | $sth = $this->db->prepare($query); |
176 | 176 | $sth->execute($query_values); |
177 | - } catch(PDOException $e) { |
|
177 | + } catch (PDOException $e) { |
|
178 | 178 | return "error : ".$e->getMessage(); |
179 | 179 | } |
180 | 180 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | try { |
186 | 186 | $sth = $this->db->prepare($query); |
187 | 187 | $sth->execute($query_values); |
188 | - } catch(PDOException $e) { |
|
188 | + } catch (PDOException $e) { |
|
189 | 189 | return "error : ".$e->getMessage(); |
190 | 190 | } |
191 | 191 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | try { |
196 | 196 | $sth = $this->db->prepare($query); |
197 | 197 | $sth->execute(); |
198 | - } catch(PDOException $e) { |
|
198 | + } catch (PDOException $e) { |
|
199 | 199 | return "error : ".$e->getMessage(); |
200 | 200 | } |
201 | 201 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | try { |
225 | 225 | $sth = $this->db->prepare($query); |
226 | 226 | $sth->execute(array(':type' => $type)); |
227 | - } catch(PDOException $e) { |
|
227 | + } catch (PDOException $e) { |
|
228 | 228 | return "error"; |
229 | 229 | } |
230 | 230 | return "success"; |
@@ -12,39 +12,39 @@ discard block |
||
12 | 12 | if (!isset($globalDemo)) { |
13 | 13 | if (isset($_GET['coord'])) |
14 | 14 | { |
15 | - $coords = explode(',',$_GET['coord']); |
|
15 | + $coords = explode(',', $_GET['coord']); |
|
16 | 16 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
17 | 17 | || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) { |
18 | 18 | //$spotter_array = $Source->getAllLocationInfo(); |
19 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs',$coords)); |
|
19 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('gs', $coords)); |
|
20 | 20 | } |
21 | 21 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
22 | 22 | || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) { |
23 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx',$coords)); |
|
23 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('wx', $coords)); |
|
24 | 24 | } |
25 | 25 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
26 | 26 | || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) { |
27 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning',$coords)); |
|
27 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('lightning', $coords)); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') |
31 | 31 | || (!isset($_COOKIE['show_Fire']) && (!isset($globalMapFire) || $globalMapFire === TRUE))) { |
32 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',$coords,true)); |
|
32 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('fires', $coords, true)); |
|
33 | 33 | } |
34 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('')); |
|
34 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('')); |
|
35 | 35 | } else { |
36 | 36 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
37 | 37 | || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) { |
38 | 38 | //$spotter_array = $Source->getAllLocationInfo(); |
39 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs')); |
|
39 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('gs')); |
|
40 | 40 | } |
41 | 41 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
42 | 42 | || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) { |
43 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx')); |
|
43 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('wx')); |
|
44 | 44 | } |
45 | 45 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
46 | 46 | || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) { |
47 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning')); |
|
47 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('lightning')); |
|
48 | 48 | } |
49 | 49 | /* |
50 | 50 | if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',array(),true)); |
53 | 53 | } |
54 | 54 | */ |
55 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('')); |
|
55 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('')); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | 59 | $output = '{"type": "FeatureCollection","features": ['; |
60 | 60 | if (!empty($spotter_array) && count($spotter_array) > 0) |
61 | 61 | { |
62 | - foreach($spotter_array as $spotter_item) |
|
62 | + foreach ($spotter_array as $spotter_item) |
|
63 | 63 | { |
64 | 64 | date_default_timezone_set('UTC'); |
65 | 65 | $output .= '{"type": "Feature",'; |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | $output .= '"icon": "'.$globalURL.'/images/'.$spotter_item['logo'].'",'; |
79 | 79 | $output .= '"type": "'.$spotter_item['type'].'",'; |
80 | 80 | if ($spotter_item['type'] == 'wx') { |
81 | - $weather = json_decode($spotter_item['description'],true); |
|
82 | - if (isset($weather['temp'])) $output.= '"temp": "'.$weather['temp'].'",'; |
|
81 | + $weather = json_decode($spotter_item['description'], true); |
|
82 | + if (isset($weather['temp'])) $output .= '"temp": "'.$weather['temp'].'",'; |
|
83 | 83 | } |
84 | 84 | $output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"'; |
85 | 85 | $output .= '},'; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $output .= '}'; |
90 | 90 | $output .= '},'; |
91 | 91 | } |
92 | - $output = substr($output, 0, -1); |
|
92 | + $output = substr($output, 0, -1); |
|
93 | 93 | } |
94 | 94 | $output .= ']}'; |
95 | 95 | print $output; |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | $s3 = sin($bank/2); |
49 | 49 | $c1c2 = $c1*$c2; |
50 | 50 | $s1s2 = $s1*$s2; |
51 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
52 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
53 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
51 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
52 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
53 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
56 | 56 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
57 | 57 | |
58 | 58 | } |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | $min = false; |
74 | 74 | $allhistory = false; |
75 | 75 | $filter['source'] = array(); |
76 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
77 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
78 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
79 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
80 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
81 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
82 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
83 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
84 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
85 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
76 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
77 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
79 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
80 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
81 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
82 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
83 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
84 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
85 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
86 | 86 | /* |
87 | 87 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
88 | 88 | $min = true; |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | $from_archive = true; |
130 | 130 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
131 | 131 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
132 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
133 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
134 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
135 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
136 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
137 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
132 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
133 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
134 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
135 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
136 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
137 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
138 | 138 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
139 | 139 | $from_archive = true; |
140 | 140 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -144,34 +144,34 @@ discard block |
||
144 | 144 | $begindate = $_COOKIE['archive_begin']; |
145 | 145 | $enddate = $_COOKIE['archive_end']; |
146 | 146 | |
147 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
148 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
149 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
147 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
148 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
149 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
150 | 150 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
151 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
151 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
152 | 152 | } elseif ($tracker) { |
153 | 153 | $coord = array(); |
154 | 154 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
155 | - $coord = explode(',',$_GET['coord']); |
|
155 | + $coord = explode(',', $_GET['coord']); |
|
156 | 156 | } |
157 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
157 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
158 | 158 | } elseif ($marine) { |
159 | 159 | $coord = array(); |
160 | 160 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
161 | - $coord = explode(',',$_GET['coord']); |
|
161 | + $coord = explode(',', $_GET['coord']); |
|
162 | 162 | } |
163 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
163 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
164 | 164 | } else { |
165 | 165 | $coord = array(); |
166 | 166 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
167 | - $coord = explode(',',$_GET['coord']); |
|
167 | + $coord = explode(',', $_GET['coord']); |
|
168 | 168 | } |
169 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
169 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
170 | 170 | } |
171 | 171 | //print_r($spotter_array); |
172 | 172 | if (!empty($spotter_array) && isset($coord)) { |
173 | 173 | if (isset($_GET['archive'])) { |
174 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
174 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
175 | 175 | } elseif ($tracker) { |
176 | 176 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
177 | 177 | } elseif ($marine) { |
@@ -182,15 +182,15 @@ discard block |
||
182 | 182 | if ($flightcnt == '') $flightcnt = 0; |
183 | 183 | } else $flightcnt = 0; |
184 | 184 | |
185 | -$sqltime = round(microtime(true)-$begintime,2); |
|
185 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
186 | 186 | $minitime = time(); |
187 | 187 | $maxitime = 0; |
188 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
188 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
189 | 189 | $modelsdb = array(); |
190 | 190 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
191 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
192 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
193 | - if (isset($row[1]) ){ |
|
191 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
192 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
193 | + if (isset($row[1])) { |
|
194 | 194 | $model = $row[0]; |
195 | 195 | $modelsdb[$model] = $row[1]; |
196 | 196 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | if (!empty($spotter_array) && is_array($spotter_array)) |
228 | 228 | { |
229 | 229 | $nblatlong = 0; |
230 | - foreach($spotter_array as $spotter_item) |
|
230 | + foreach ($spotter_array as $spotter_item) |
|
231 | 231 | { |
232 | 232 | $j++; |
233 | 233 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | $output .= '"lastupdate": "'.$lastupdate.'",'; |
268 | 268 | $output .= '"format": "'.$spotter_item['format_source'].'",'; |
269 | 269 | if ($tracker) { |
270 | - $output.= '"type": "tracker"'; |
|
270 | + $output .= '"type": "tracker"'; |
|
271 | 271 | } elseif ($marine) { |
272 | - $output.= '"type": "marine"'; |
|
272 | + $output .= '"type": "marine"'; |
|
273 | 273 | } else { |
274 | - $output.= '"type": "flight"'; |
|
274 | + $output .= '"type": "flight"'; |
|
275 | 275 | } |
276 | 276 | $output .= '},'; |
277 | 277 | |
@@ -615,8 +615,8 @@ discard block |
||
615 | 615 | $output .= '},'; |
616 | 616 | } |
617 | 617 | } |
618 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
619 | - else $output = str_replace('%onground%','false',$output); |
|
618 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
619 | + else $output = str_replace('%onground%', 'false', $output); |
|
620 | 620 | |
621 | 621 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
622 | 622 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | $output .= '"cartographicDegrees": ['; |
632 | 632 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
633 | 633 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
634 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
634 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
635 | 635 | $output .= $spotter_item['longitude'].', '; |
636 | 636 | $output .= $spotter_item['latitude']; |
637 | 637 | $prevlong = $spotter_item['longitude']; |
@@ -659,8 +659,8 @@ discard block |
||
659 | 659 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
660 | 660 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
661 | 661 | } else { |
662 | - $nblatlong = $nblatlong+1; |
|
663 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
662 | + $nblatlong = $nblatlong + 1; |
|
663 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
664 | 664 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
665 | 665 | if ($spotter_item['ground_speed'] == 0) { |
666 | 666 | $output .= $prevlong.', '; |
@@ -700,15 +700,15 @@ discard block |
||
700 | 700 | } |
701 | 701 | $output .= ']'; |
702 | 702 | if (isset($globalArchive) && $globalArchive === TRUE) { |
703 | - if ((time()-$globalLiveInterval) > $minitime) { |
|
704 | - if (time()-$globalLiveInterval > $maxitime) { |
|
705 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
703 | + if ((time() - $globalLiveInterval) > $minitime) { |
|
704 | + if (time() - $globalLiveInterval > $maxitime) { |
|
705 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
706 | 706 | } else { |
707 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
707 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
708 | 708 | } |
709 | 709 | } |
710 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
711 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
712 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
710 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
711 | +} else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
712 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
713 | 713 | print $output; |
714 | 714 | ?> |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | $Source = new Source(); |
6 | 6 | |
7 | 7 | if (isset($_GET['sourceid'])) { |
8 | - $sourceid = filter_input(INPUT_GET,'sourceid',FILTER_SANITIZE_NUMBER_INT); |
|
8 | + $sourceid = filter_input(INPUT_GET, 'sourceid', FILTER_SANITIZE_NUMBER_INT); |
|
9 | 9 | $source_data = $Source->getLocationInfoById($sourceid); |
10 | 10 | if (isset($source_data[0])) { |
11 | 11 | ?> |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | print '</div>'; |
42 | 42 | |
43 | 43 | if ($spotter_item['city'] != '') print '<div><span>'._("City").'</span>'.$spotter_item['city'].'</div>'; |
44 | -if ($spotter_item['country'] !='') print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>'; |
|
45 | -print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],4).', '.round($spotter_item['longitude'],4).'</div>'; |
|
44 | +if ($spotter_item['country'] != '') print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>'; |
|
45 | +print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'], 4).', '.round($spotter_item['longitude'], 4).'</div>'; |
|
46 | 46 | /* |
47 | 47 | if ($spotter_item['atc_range'] > 0) { |
48 | 48 | print '<div><span>'._("Range").'</span>'; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | */ |
53 | 53 | if ($spotter_item['type'] == 'wx') { |
54 | - $weather = json_decode($spotter_item['description'],true); |
|
54 | + $weather = json_decode($spotter_item['description'], true); |
|
55 | 55 | //print_r($weather); |
56 | 56 | if (isset($weather['temp'])) print '<div><span>'._("Temperature").'</span>'.$weather['temp'].'°C</div>'; |
57 | 57 | if (isset($weather['pressure'])) print '<div><span>'._("Pressure").'</span>'.$weather['pressure'].'hPa</div>'; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if (isset($weather['precipitation24h'])) print '<div><span>'._("Precipitation Today").'</span>'.$weather['precipitation24h'].' mm</div>'; |
63 | 63 | $spotter_item['description'] = $weather['comment']; |
64 | 64 | } elseif ($spotter_item['type'] == 'fires') { |
65 | - print_r(json_decode($spotter_item['description'],true)); |
|
65 | + print_r(json_decode($spotter_item['description'], true)); |
|
66 | 66 | } |
67 | 67 | print '</div>'; |
68 | 68 | if ($spotter_item['type'] != 'wx' && $spotter_item['type'] != 'fires') { |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | * @param Array $headers header to submit with the form |
15 | 15 | * @return String the result |
16 | 16 | */ |
17 | - public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') { |
|
17 | + public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '') { |
|
18 | 18 | global $globalProxy, $globalForceIPv4; |
19 | 19 | $ch = curl_init(); |
20 | 20 | curl_setopt($ch, CURLOPT_URL, $url); |
21 | 21 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
22 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
22 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
23 | 23 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
24 | 24 | } |
25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
30 | 30 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
31 | 31 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
32 | - curl_setopt($ch,CURLOPT_ENCODING , "gzip"); |
|
32 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
33 | 33 | //curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
34 | 34 | // curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0'); |
35 | 35 | if ($useragent == '') { |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | } |
40 | 40 | if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
41 | 41 | else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
42 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
|
42 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback")); |
|
43 | 43 | if ($type == 'post') { |
44 | 44 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
45 | 45 | if (is_array($data)) { |
46 | 46 | curl_setopt($ch, CURLOPT_POST, count($data)); |
47 | 47 | $data_string = ''; |
48 | - foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
48 | + foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
49 | 49 | rtrim($data_string, '&'); |
50 | 50 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); |
51 | 51 | } else { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | if ($cookie != '') { |
59 | 59 | if (is_array($cookie)) { |
60 | - curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';')); |
|
60 | + curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';')); |
|
61 | 61 | } else { |
62 | 62 | curl_setopt($ch, CURLOPT_COOKIE, $cookie); |
63 | 63 | } |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | $info = curl_getinfo($ch); |
70 | 70 | //var_dump($info); |
71 | 71 | curl_close($ch); |
72 | - if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) { |
|
72 | + if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) { |
|
73 | 73 | echo "Cloudflare Detected\n"; |
74 | 74 | require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php'); |
75 | 75 | $useragent = UAgent::random(); |
76 | 76 | cloudflare::useUserAgent($useragent); |
77 | 77 | if ($clearanceCookie = cloudflare::bypass($url)) { |
78 | - return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
|
78 | + return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent); |
|
79 | 79 | } |
80 | 80 | } else { |
81 | 81 | return $result; |
@@ -106,20 +106,20 @@ discard block |
||
106 | 106 | fclose($fp); |
107 | 107 | } |
108 | 108 | |
109 | - public static function gunzip($in_file,$out_file_name = '') { |
|
109 | + public static function gunzip($in_file, $out_file_name = '') { |
|
110 | 110 | //echo $in_file.' -> '.$out_file_name."\n"; |
111 | 111 | $buffer_size = 4096; // read 4kb at a time |
112 | 112 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
113 | 113 | if ($in_file != '' && file_exists($in_file)) { |
114 | 114 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
115 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
116 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
115 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
116 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
117 | 117 | else { |
118 | 118 | echo 'gzopen not available'; |
119 | 119 | die; |
120 | 120 | } |
121 | 121 | $out_file = fopen($out_file_name, 'wb'); |
122 | - while(!gzeof($file)) { |
|
122 | + while (!gzeof($file)) { |
|
123 | 123 | fwrite($out_file, gzread($file, $buffer_size)); |
124 | 124 | } |
125 | 125 | fclose($out_file); |
@@ -127,19 +127,19 @@ discard block |
||
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | - public static function bunzip2($in_file,$out_file_name = '') { |
|
130 | + public static function bunzip2($in_file, $out_file_name = '') { |
|
131 | 131 | //echo $in_file.' -> '.$out_file_name."\n"; |
132 | 132 | $buffer_size = 4096; // read 4kb at a time |
133 | 133 | if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
134 | 134 | if ($in_file != '' && file_exists($in_file)) { |
135 | 135 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
136 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
136 | + if (function_exists('bzopen')) $file = bzopen($in_file, 'rb'); |
|
137 | 137 | else { |
138 | 138 | echo 'bzopen not available'; |
139 | 139 | die; |
140 | 140 | } |
141 | 141 | $out_file = fopen($out_file_name, 'wb'); |
142 | - while(!feof($file)) { |
|
142 | + while (!feof($file)) { |
|
143 | 143 | fwrite($out_file, bzread($file, $buffer_size)); |
144 | 144 | } |
145 | 145 | fclose($out_file); |
@@ -157,27 +157,27 @@ discard block |
||
157 | 157 | if ($data == '') return array(); |
158 | 158 | $html = str_get_html($data); |
159 | 159 | if ($html === false) return array(); |
160 | - $tabledata=array(); |
|
161 | - foreach($html->find('tr') as $element) |
|
160 | + $tabledata = array(); |
|
161 | + foreach ($html->find('tr') as $element) |
|
162 | 162 | { |
163 | 163 | $td = array(); |
164 | - foreach( $element->find('th') as $row) |
|
164 | + foreach ($element->find('th') as $row) |
|
165 | 165 | { |
166 | 166 | $td [] = trim($row->plaintext); |
167 | 167 | } |
168 | - $td=array_filter($td); |
|
168 | + $td = array_filter($td); |
|
169 | 169 | $tabledata[] = $td; |
170 | 170 | |
171 | 171 | $td = array(); |
172 | 172 | $tdi = array(); |
173 | - foreach( $element->find('td') as $row) |
|
173 | + foreach ($element->find('td') as $row) |
|
174 | 174 | { |
175 | 175 | $td [] = trim($row->plaintext); |
176 | 176 | $tdi [] = trim($row->innertext); |
177 | 177 | } |
178 | - $td=array_filter($td); |
|
179 | - $tdi=array_filter($tdi); |
|
180 | - $tabledata[]=array_merge($td,$tdi); |
|
178 | + $td = array_filter($td); |
|
179 | + $tdi = array_filter($tdi); |
|
180 | + $tabledata[] = array_merge($td, $tdi); |
|
181 | 181 | } |
182 | 182 | $html->clear(); |
183 | 183 | unset($html); |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | public function text2array($data) { |
193 | 193 | $html = str_get_html($data); |
194 | 194 | if ($html === false) return array(); |
195 | - $tabledata=array(); |
|
196 | - foreach($html->find('p') as $element) |
|
195 | + $tabledata = array(); |
|
196 | + foreach ($html->find('p') as $element) |
|
197 | 197 | { |
198 | 198 | $tabledata [] = trim($element->plaintext); |
199 | 199 | } |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
215 | 215 | if ($lat == $latc && $lon == $lonc) return 0; |
216 | - $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
|
216 | + $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc))) + cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon) - floatval($lonc)))))*60*1.1515; |
|
217 | 217 | if ($unit == "km") { |
218 | - return round($dist * 1.609344); |
|
218 | + return round($dist*1.609344); |
|
219 | 219 | } elseif ($unit == "m") { |
220 | - return round($dist * 1.609344 * 1000); |
|
220 | + return round($dist*1.609344*1000); |
|
221 | 221 | } elseif ($unit == "mile" || $unit == "mi") { |
222 | 222 | return round($dist); |
223 | 223 | } elseif ($unit == "nm") { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @param float $distance distance covered |
234 | 234 | * @return whether distance is realistic |
235 | 235 | */ |
236 | - public function withinThreshold ($timeDifference, $distance) { |
|
236 | + public function withinThreshold($timeDifference, $distance) { |
|
237 | 237 | $x = abs($timeDifference); |
238 | 238 | $d = abs($distance); |
239 | 239 | if ($x == 0 || $d == 0) return true; |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | return ($array !== array_values($array)); |
250 | 250 | } |
251 | 251 | |
252 | - public function isInteger($input){ |
|
252 | + public function isInteger($input) { |
|
253 | 253 | return(ctype_digit(strval($input))); |
254 | 254 | } |
255 | 255 | |
256 | 256 | |
257 | - public function convertDec($dms,$latlong) { |
|
257 | + public function convertDec($dms, $latlong) { |
|
258 | 258 | if ($latlong == 'latitude') { |
259 | 259 | $deg = substr($dms, 0, 2); |
260 | 260 | $min = substr($dms, 2, 4); |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | $deg = substr($dms, 0, 3); |
263 | 263 | $min = substr($dms, 3, 5); |
264 | 264 | } |
265 | - return $deg+(($min*60)/3600); |
|
265 | + return $deg + (($min*60)/3600); |
|
266 | 266 | } |
267 | 267 | |
268 | - public function convertDM($coord,$latlong) { |
|
268 | + public function convertDM($coord, $latlong) { |
|
269 | 269 | if ($latlong == 'latitude') { |
270 | 270 | if ($coord < 0) $NSEW = 'S'; |
271 | 271 | else $NSEW = 'N'; |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | } |
276 | 276 | $coord = abs($coord); |
277 | 277 | $deg = floor($coord); |
278 | - $coord = ($coord-$deg)*60; |
|
278 | + $coord = ($coord - $deg)*60; |
|
279 | 279 | $min = $coord; |
280 | - return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW); |
|
280 | + return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -289,8 +289,8 @@ discard block |
||
289 | 289 | public function xcopy($source, $dest) |
290 | 290 | { |
291 | 291 | $files = glob($source.'*.*'); |
292 | - foreach($files as $file){ |
|
293 | - $file_to_go = str_replace($source,$dest,$file); |
|
292 | + foreach ($files as $file) { |
|
293 | + $file_to_go = str_replace($source, $dest, $file); |
|
294 | 294 | copy($file, $file_to_go); |
295 | 295 | } |
296 | 296 | return true; |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | * @param String $url url to check |
302 | 302 | * @return bool Return true on succes false on failure |
303 | 303 | */ |
304 | - public function urlexist($url){ |
|
305 | - $headers=get_headers($url); |
|
306 | - return stripos($headers[0],"200 OK")?true:false; |
|
304 | + public function urlexist($url) { |
|
305 | + $headers = get_headers($url); |
|
306 | + return stripos($headers[0], "200 OK") ? true : false; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | public function hex2str($hex) { |
315 | 315 | $str = ''; |
316 | 316 | $hexln = strlen($hex); |
317 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
317 | + for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2))); |
|
318 | 318 | return $str; |
319 | 319 | } |
320 | 320 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @return String Return result |
325 | 325 | */ |
326 | 326 | public function hex2rgb($hex) { |
327 | - $hex = str_replace('#','',$hex); |
|
327 | + $hex = str_replace('#', '', $hex); |
|
328 | 328 | return sscanf($hex, "%02x%02x%02x"); |
329 | 329 | } |
330 | 330 | |
@@ -332,33 +332,33 @@ discard block |
||
332 | 332 | //difference in longitudinal coordinates |
333 | 333 | $dLon = deg2rad($lon2) - deg2rad($lon1); |
334 | 334 | //difference in the phi of latitudinal coordinates |
335 | - $dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4)); |
|
335 | + $dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4)); |
|
336 | 336 | //we need to recalculate $dLon if it is greater than pi |
337 | - if(abs($dLon) > pi()) { |
|
338 | - if($dLon > 0) { |
|
339 | - $dLon = (2 * pi() - $dLon) * -1; |
|
337 | + if (abs($dLon) > pi()) { |
|
338 | + if ($dLon > 0) { |
|
339 | + $dLon = (2*pi() - $dLon)*-1; |
|
340 | 340 | } else { |
341 | - $dLon = 2 * pi() + $dLon; |
|
341 | + $dLon = 2*pi() + $dLon; |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | //return the angle, normalized |
345 | - return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360; |
|
345 | + return (rad2deg(atan2($dLon, $dPhi)) + 360)%360; |
|
346 | 346 | } |
347 | 347 | |
348 | - public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.15) { |
|
348 | + public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.15) { |
|
349 | 349 | //$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1); |
350 | - $a = -($lon2-$lon1); |
|
350 | + $a = -($lon2 - $lon1); |
|
351 | 351 | $b = $lat2 - $lat1; |
352 | - $c = -($a*$lat1+$b*$lon1); |
|
353 | - $d = $a*$lat3+$b*$lon3+$c; |
|
352 | + $c = -($a*$lat1 + $b*$lon1); |
|
353 | + $d = $a*$lat3 + $b*$lon3 + $c; |
|
354 | 354 | if ($d > -$approx && $d < $approx) return true; |
355 | 355 | else return false; |
356 | 356 | } |
357 | 357 | |
358 | 358 | public function array_merge_noappend() { |
359 | 359 | $output = array(); |
360 | - foreach(func_get_args() as $array) { |
|
361 | - foreach($array as $key => $value) { |
|
360 | + foreach (func_get_args() as $array) { |
|
361 | + foreach ($array as $key => $value) { |
|
362 | 362 | $output[$key] = isset($output[$key]) ? |
363 | 363 | array_merge($output[$key], $value) : $value; |
364 | 364 | } |
@@ -422,34 +422,34 @@ discard block |
||
422 | 422 | return $result; |
423 | 423 | } |
424 | 424 | |
425 | - public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1){ |
|
425 | + public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1) { |
|
426 | 426 | global $globalMapRefresh; |
427 | 427 | $distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000; |
428 | 428 | $r = 6378; |
429 | 429 | $latitude = deg2rad($latitude); |
430 | 430 | $longitude = deg2rad($longitude); |
431 | 431 | $bearing = deg2rad($heading); |
432 | - $latitude2 = asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) ); |
|
433 | - $longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) ); |
|
434 | - return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.','')); |
|
432 | + $latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing))); |
|
433 | + $longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2))); |
|
434 | + return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', '')); |
|
435 | 435 | } |
436 | 436 | |
437 | - public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) { |
|
437 | + public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) { |
|
438 | 438 | // distance in meter |
439 | 439 | $R = 6378.14; |
440 | - $latitude1 = $latitude * (M_PI/180); |
|
441 | - $longitude1 = $longitude * (M_PI/180); |
|
442 | - $brng = $bearing * (M_PI/180); |
|
440 | + $latitude1 = $latitude*(M_PI/180); |
|
441 | + $longitude1 = $longitude*(M_PI/180); |
|
442 | + $brng = $bearing*(M_PI/180); |
|
443 | 443 | $d = $distance; |
444 | 444 | |
445 | 445 | $latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng)); |
446 | - $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2)); |
|
446 | + $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2)); |
|
447 | 447 | |
448 | - $latitude2 = $latitude2 * (180/M_PI); |
|
449 | - $longitude2 = $longitude2 * (180/M_PI); |
|
448 | + $latitude2 = $latitude2*(180/M_PI); |
|
449 | + $longitude2 = $longitude2*(180/M_PI); |
|
450 | 450 | |
451 | - $flat = round ($latitude2,6); |
|
452 | - $flong = round ($longitude2,6); |
|
451 | + $flat = round($latitude2, 6); |
|
452 | + $flong = round($longitude2, 6); |
|
453 | 453 | /* |
454 | 454 | $dx = $distance*cos($bearing); |
455 | 455 | $dy = $distance*sin($bearing); |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $flong = $longitude + $dlong; |
459 | 459 | $flat = $latitude + $dlat; |
460 | 460 | */ |
461 | - return array('latitude' => $flat,'longitude' => $flong); |
|
461 | + return array('latitude' => $flat, 'longitude' => $flong); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
@@ -472,14 +472,14 @@ discard block |
||
472 | 472 | * @param integer $level GZIP compression level (default: 9) |
473 | 473 | * @return string New filename (with .gz appended) if success, or false if operation fails |
474 | 474 | */ |
475 | - public function gzCompressFile($source, $level = 9){ |
|
476 | - $dest = $source . '.gz'; |
|
477 | - $mode = 'wb' . $level; |
|
475 | + public function gzCompressFile($source, $level = 9) { |
|
476 | + $dest = $source.'.gz'; |
|
477 | + $mode = 'wb'.$level; |
|
478 | 478 | $error = false; |
479 | 479 | if ($fp_out = gzopen($dest, $mode)) { |
480 | - if ($fp_in = fopen($source,'rb')) { |
|
480 | + if ($fp_in = fopen($source, 'rb')) { |
|
481 | 481 | while (!feof($fp_in)) |
482 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
482 | + gzwrite($fp_out, fread($fp_in, 1024*512)); |
|
483 | 483 | fclose($fp_in); |
484 | 484 | } else { |
485 | 485 | $error = true; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | } |
496 | 496 | |
497 | 497 | public function remove_accents($string) { |
498 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
498 | + if (!preg_match('/[\x80-\xff]/', $string)) return $string; |
|
499 | 499 | $chars = array( |
500 | 500 | // Decompositions for Latin-1 Supplement |
501 | 501 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
553 | 553 | chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
554 | 554 | chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
555 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
555 | + chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij', |
|
556 | 556 | chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
557 | 557 | chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
558 | 558 | chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
@@ -568,13 +568,13 @@ discard block |
||
568 | 568 | chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
569 | 569 | chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
570 | 570 | chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
571 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
572 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
573 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
574 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
575 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
576 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
577 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
571 | + chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', |
|
572 | + chr(197).chr(148) => 'R', chr(197).chr(149) => 'r', |
|
573 | + chr(197).chr(150) => 'R', chr(197).chr(151) => 'r', |
|
574 | + chr(197).chr(152) => 'R', chr(197).chr(153) => 'r', |
|
575 | + chr(197).chr(154) => 'S', chr(197).chr(155) => 's', |
|
576 | + chr(197).chr(156) => 'S', chr(197).chr(157) => 's', |
|
577 | + chr(197).chr(158) => 'S', chr(197).chr(159) => 's', |
|
578 | 578 | chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
579 | 579 | chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
580 | 580 | chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) { |
609 | 609 | if (is_numeric($string[$i]) && $concat_flag) { |
610 | 610 | $int .= $string[$i]; |
611 | - } elseif(!$concat && $concat_flag && strlen($int) > 0) { |
|
611 | + } elseif (!$concat && $concat_flag && strlen($int) > 0) { |
|
612 | 612 | $concat_flag = false; |
613 | 613 | } |
614 | 614 | } |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | $slice = array_slice($arr, $offset + 1, $length); |
655 | 655 | return implode("", $slice); |
656 | 656 | } else { |
657 | - return mb_substr($string,$offset,$length,'UTF-8'); |
|
657 | + return mb_substr($string, $offset, $length, 'UTF-8'); |
|
658 | 658 | } |
659 | 659 | } |
660 | 660 | |
@@ -664,14 +664,14 @@ discard block |
||
664 | 664 | //NOTE: use a trailing slash for folders!!! |
665 | 665 | //see http://bugs.php.net/bug.php?id=27609 |
666 | 666 | //see http://bugs.php.net/bug.php?id=30931 |
667 | - if ($path{strlen($path)-1}=='/') // recursively return a temporary file path |
|
667 | + if ($path{strlen($path) - 1} == '/') // recursively return a temporary file path |
|
668 | 668 | return $this->is__writable($path.uniqid(mt_rand()).'.tmp'); |
669 | 669 | else if (is_dir($path)) |
670 | 670 | return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
671 | 671 | // check tmp file for read/write capabilities |
672 | 672 | $rm = file_exists($path); |
673 | 673 | $f = @fopen($path, 'a'); |
674 | - if ($f===false) |
|
674 | + if ($f === false) |
|
675 | 675 | return false; |
676 | 676 | fclose($f); |
677 | 677 | if (!$rm) |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | require_once('require/class.Language.php'); |
4 | 4 | require_once('require/class.Translation.php'); |
5 | 5 | $type = ''; |
6 | -$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
6 | +$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
7 | 7 | if (isset($_GET['marine'])) { |
8 | 8 | require_once('require/class.Marine.php'); |
9 | 9 | require_once('require/class.MarineLive.php'); |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | $page_url = $globalURL.'/ident/'.$_GET['ident']; |
31 | 31 | } |
32 | 32 | |
33 | -if (!isset($_GET['ident'])){ |
|
33 | +if (!isset($_GET['ident'])) { |
|
34 | 34 | header('Location: '.$globalURL.''); |
35 | 35 | } else { |
36 | 36 | $Translation = new Translation(); |
37 | 37 | //calculuation for the pagination |
38 | - if(!isset($_GET['limit'])) |
|
38 | + if (!isset($_GET['limit'])) |
|
39 | 39 | { |
40 | 40 | $limit_start = 0; |
41 | 41 | $limit_end = 25; |
@@ -54,18 +54,18 @@ discard block |
||
54 | 54 | $limit_previous_1 = $limit_start - $absolute_difference; |
55 | 55 | $limit_previous_2 = $limit_end - $absolute_difference; |
56 | 56 | |
57 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
57 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
58 | 58 | if ($type == 'aircraft') { |
59 | 59 | if ($sort != '') |
60 | 60 | { |
61 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
61 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
62 | 62 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
63 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
63 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
64 | 64 | } |
65 | 65 | } else { |
66 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
66 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
67 | 67 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
68 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
68 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | if (empty($spotter_array)) { |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | $ident = $new_ident; |
75 | 75 | if ($sort != '') |
76 | 76 | { |
77 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
77 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
78 | 78 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
79 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
79 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
80 | 80 | } |
81 | 81 | } else { |
82 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
82 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
83 | 83 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
84 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
84 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -89,34 +89,34 @@ discard block |
||
89 | 89 | } elseif ($type == 'marine') { |
90 | 90 | if ($sort != '') |
91 | 91 | { |
92 | - $spotter_array = $Marine->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
92 | + $spotter_array = $Marine->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
93 | 93 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
94 | - $spotter_array = $MarineArchive->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
94 | + $spotter_array = $MarineArchive->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
95 | 95 | } |
96 | 96 | } else { |
97 | - $spotter_array = $Marine->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
97 | + $spotter_array = $Marine->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
98 | 98 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
99 | - $spotter_array = $MarineArchive->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
99 | + $spotter_array = $MarineArchive->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } elseif ($type == 'tracker') { |
103 | 103 | if ($sort != '') |
104 | 104 | { |
105 | - $spotter_array = $Tracker->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
105 | + $spotter_array = $Tracker->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
106 | 106 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
107 | - $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
107 | + $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
108 | 108 | } |
109 | 109 | } else { |
110 | - $spotter_array = $Tracker->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
110 | + $spotter_array = $Tracker->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
111 | 111 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
112 | - $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
112 | + $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | 117 | if (!empty($spotter_array)) |
118 | 118 | { |
119 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']); |
|
119 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['ident']); |
|
120 | 120 | $ident = $spotter_array[0]['ident']; |
121 | 121 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
122 | 122 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $altitude_data = ''; |
136 | 136 | $hour_data = ''; |
137 | 137 | $speed_data = ''; |
138 | - foreach($all_data as $data) |
|
138 | + foreach ($all_data as $data) |
|
139 | 139 | { |
140 | 140 | $hour_data .= '"'.$data['date'].'",'; |
141 | 141 | if (isset($data['real_altitude']) && $data['real_altitude'] != '') { |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | $speed_data .= $speed.','; |
164 | 164 | } |
165 | 165 | $hour_data = "['x',".substr($hour_data, 0, -1)."]"; |
166 | - $altitude_data = "['altitude',".substr($altitude_data,0,-1)."]"; |
|
167 | - $speed_data = "['speed',".substr($speed_data,0,-1)."]"; |
|
166 | + $altitude_data = "['altitude',".substr($altitude_data, 0, -1)."]"; |
|
167 | + $speed_data = "['speed',".substr($speed_data, 0, -1)."]"; |
|
168 | 168 | print 'c3.generate({ |
169 | 169 | bindto: "#chart", |
170 | 170 | data: { |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | |
209 | 209 | if ($type == 'aircraft') include('ident-sub-menu.php'); |
210 | 210 | print '<div class="table column">'; |
211 | - if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
212 | - elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
213 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
211 | + if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
212 | + elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
213 | + elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
214 | 214 | |
215 | 215 | include('table-output.php'); |
216 | 216 | print '<div class="pagination">'; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | require_once(dirname(__FILE__).'/class.create_db.php'); |
23 | 23 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
24 | 24 | require_once(dirname(__FILE__).'/class.settings.php'); |
25 | -$title="Install"; |
|
25 | +$title = "Install"; |
|
26 | 26 | require(dirname(__FILE__).'/../require/settings.php'); |
27 | 27 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
28 | 28 | require(dirname(__FILE__).'/header.php'); |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | if (!extension_loaded('curl')) { |
93 | 93 | $error[] = "Curl is not loaded."; |
94 | 94 | } |
95 | - if(function_exists('apache_get_modules') ){ |
|
96 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
95 | + if (function_exists('apache_get_modules')) { |
|
96 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
97 | 97 | $error[] = "mod_rewrite is not available."; |
98 | 98 | } |
99 | 99 | /* |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>'; |
110 | 110 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
111 | 111 | if (function_exists('get_headers')) { |
112 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
113 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
112 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
113 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
114 | 114 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
115 | 115 | } |
116 | 116 | } |
@@ -481,13 +481,13 @@ discard block |
||
481 | 481 | ?> |
482 | 482 | <tr> |
483 | 483 | <?php |
484 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
484 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
485 | 485 | ?> |
486 | 486 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
487 | 487 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
488 | 488 | <?php |
489 | 489 | } else { |
490 | - $hostport = explode(':',$source['host']); |
|
490 | + $hostport = explode(':', $source['host']); |
|
491 | 491 | if (isset($hostport[1])) { |
492 | 492 | $host = $hostport[0]; |
493 | 493 | $port = $hostport[1]; |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | <select name="timezones[]" id="timezones"> |
535 | 535 | <?php |
536 | 536 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
537 | - foreach($timezonelist as $timezones){ |
|
537 | + foreach ($timezonelist as $timezones) { |
|
538 | 538 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
539 | 539 | print '<option selected>'.$timezones.'</option>'; |
540 | 540 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | <select name="timezones[]" id="timezones"> |
587 | 587 | <?php |
588 | 588 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
589 | - foreach($timezonelist as $timezones){ |
|
589 | + foreach ($timezonelist as $timezones) { |
|
590 | 590 | if ($timezones == 'UTC') { |
591 | 591 | print '<option selected>'.$timezones.'</option>'; |
592 | 592 | } else print '<option>'.$timezones.'</option>'; |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | <br /> |
913 | 913 | <p> |
914 | 914 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
915 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
915 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
916 | 916 | </p> |
917 | 917 | <br /> |
918 | 918 | <p> |
@@ -968,14 +968,14 @@ discard block |
||
968 | 968 | $error = ''; |
969 | 969 | |
970 | 970 | if (isset($_POST['dbtype'])) { |
971 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
972 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
973 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
974 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
975 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
976 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
977 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
978 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
971 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
972 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
973 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
974 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
975 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
976 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
977 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
978 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
979 | 979 | |
980 | 980 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
981 | 981 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -995,49 +995,49 @@ discard block |
||
995 | 995 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
996 | 996 | */ |
997 | 997 | |
998 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
998 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
999 | 999 | |
1000 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
1001 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
1002 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
1003 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
1004 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
1000 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
1001 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
1002 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
1003 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
1004 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
1005 | 1005 | |
1006 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
1007 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
1008 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
1009 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
1010 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
1011 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
1012 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
1013 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
1014 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
1015 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1006 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
1007 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
1008 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
1009 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
1010 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
1011 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
1012 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
1013 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
1014 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
1015 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1016 | 1016 | |
1017 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
1018 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
1019 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
1020 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
1021 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
1022 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
1017 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
1018 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
1019 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
1020 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
1021 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
1022 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
1023 | 1023 | |
1024 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
1025 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
1024 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
1025 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
1026 | 1026 | |
1027 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
1028 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
1029 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
1027 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
1028 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
1029 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
1030 | 1030 | |
1031 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
1031 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
1032 | 1032 | if ($acars == 'acars') { |
1033 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
1033 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
1034 | 1034 | } else { |
1035 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
1035 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1039 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1040 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1038 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1039 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1040 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1041 | 1041 | |
1042 | 1042 | $source_name = $_POST['source_name']; |
1043 | 1043 | $source_latitude = $_POST['source_latitude']; |
@@ -1051,8 +1051,8 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | $sources = array(); |
1053 | 1053 | foreach ($source_name as $keys => $name) { |
1054 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1055 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1054 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
1055 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
1056 | 1056 | } |
1057 | 1057 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1058 | 1058 | |
@@ -1065,27 +1065,27 @@ discard block |
||
1065 | 1065 | $sbsurl = $_POST['sbsurl']; |
1066 | 1066 | */ |
1067 | 1067 | |
1068 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1069 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1070 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1071 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1072 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1073 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1074 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1075 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1068 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1069 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1070 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1071 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1072 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1073 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1074 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1075 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1076 | 1076 | |
1077 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1078 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1079 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1080 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1081 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1082 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1083 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1084 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1085 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1086 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1087 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1088 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1077 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1078 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1079 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1080 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1081 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1082 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1083 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1084 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1085 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1086 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1087 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1088 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1089 | 1089 | |
1090 | 1090 | /* |
1091 | 1091 | $globalSBS1Hosts = array(); |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | } |
1102 | 1102 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1103 | 1103 | */ |
1104 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1104 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1105 | 1105 | $host = $_POST['host']; |
1106 | 1106 | $port = $_POST['port']; |
1107 | 1107 | $name = $_POST['name']; |
@@ -1118,113 +1118,113 @@ discard block |
||
1118 | 1118 | else $cov = 'FALSE'; |
1119 | 1119 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1120 | 1120 | else $arch = 'FALSE'; |
1121 | - if (strpos($format[$key],'_callback')) { |
|
1122 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1121 | + if (strpos($format[$key], '_callback')) { |
|
1122 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1123 | 1123 | } elseif ($h != '' || $name[$key] != '') { |
1124 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1124 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1125 | 1125 | } |
1126 | 1126 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1127 | 1127 | } |
1128 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1128 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1129 | 1129 | |
1130 | 1130 | /* |
1131 | 1131 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1132 | 1132 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1133 | 1133 | */ |
1134 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1135 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1136 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1134 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1135 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1136 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1137 | 1137 | |
1138 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1139 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1138 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1139 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1140 | 1140 | |
1141 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1142 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1141 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1142 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1143 | 1143 | |
1144 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
1145 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
1144 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
1145 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
1146 | 1146 | |
1147 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1148 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1149 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1150 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1147 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1148 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1149 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1150 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1151 | 1151 | |
1152 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1153 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1154 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1152 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1153 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1154 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1155 | 1155 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1156 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1157 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1156 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1157 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1158 | 1158 | |
1159 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1160 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1161 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1162 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1163 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1164 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1165 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1166 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1159 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1160 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1161 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1162 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1163 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1164 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1165 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1166 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1167 | 1167 | |
1168 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1169 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1168 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1169 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1170 | 1170 | |
1171 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1172 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1171 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1172 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1173 | 1173 | |
1174 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1174 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1175 | 1175 | if ($archiveyear == "archiveyear") { |
1176 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1176 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1177 | 1177 | } else { |
1178 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1178 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1179 | 1179 | } |
1180 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1181 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1182 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1183 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1180 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1181 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1182 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1183 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1184 | 1184 | |
1185 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1186 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1187 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1188 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1185 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1186 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1187 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1188 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1189 | 1189 | |
1190 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1191 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1192 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1190 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1191 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1192 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1193 | 1193 | |
1194 | 1194 | // Create in settings.php keys not yet configurable if not already here |
1195 | 1195 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1196 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1196 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1197 | 1197 | |
1198 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1198 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1199 | 1199 | if ($resetyearstats == 'resetyearstats') { |
1200 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1200 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1201 | 1201 | } else { |
1202 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1202 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1205 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1206 | 1206 | if ($archive == 'archive') { |
1207 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1207 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1208 | 1208 | } else { |
1209 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1209 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1210 | 1210 | } |
1211 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
1211 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
1212 | 1212 | if ($archiveresults == 'archiveresults') { |
1213 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
1213 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
1214 | 1214 | } else { |
1215 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
1215 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
1216 | 1216 | } |
1217 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1217 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1218 | 1218 | if ($daemon == 'daemon') { |
1219 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1219 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1220 | 1220 | } else { |
1221 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1221 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1222 | 1222 | } |
1223 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1223 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1224 | 1224 | if ($schedules == 'schedules') { |
1225 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1225 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1226 | 1226 | } else { |
1227 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1227 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1228 | 1228 | } |
1229 | 1229 | |
1230 | 1230 | /* |
@@ -1235,227 +1235,227 @@ discard block |
||
1235 | 1235 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1236 | 1236 | } |
1237 | 1237 | */ |
1238 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1239 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1240 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1241 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1242 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1238 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1239 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1240 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1241 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1242 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1243 | 1243 | $va = false; |
1244 | 1244 | if ($globalivao == 'ivao') { |
1245 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1245 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1246 | 1246 | $va = true; |
1247 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1247 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1248 | 1248 | if ($globalvatsim == 'vatsim') { |
1249 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1249 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1250 | 1250 | $va = true; |
1251 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1251 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1252 | 1252 | if ($globalphpvms == 'phpvms') { |
1253 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1253 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1254 | 1254 | $va = true; |
1255 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1255 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1256 | 1256 | if ($globalvam == 'vam') { |
1257 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1257 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1258 | 1258 | $va = true; |
1259 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1259 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1260 | 1260 | if ($va) { |
1261 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1262 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1261 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1262 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1263 | 1263 | if ($globalva == 'va' || $va) { |
1264 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1265 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1264 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1265 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1266 | 1266 | } else { |
1267 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1268 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1269 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1267 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1268 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1269 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1270 | 1270 | } |
1271 | 1271 | |
1272 | 1272 | |
1273 | 1273 | |
1274 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1274 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1275 | 1275 | if ($notam == 'notam') { |
1276 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1276 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1277 | 1277 | } else { |
1278 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1278 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1279 | 1279 | } |
1280 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1280 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1281 | 1281 | if ($owner == 'owner') { |
1282 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1282 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1283 | 1283 | } else { |
1284 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1284 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1285 | 1285 | } |
1286 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1286 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1287 | 1287 | if ($map3d == 'map3d') { |
1288 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1288 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1289 | 1289 | } else { |
1290 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1290 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1291 | 1291 | } |
1292 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1292 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1293 | 1293 | if ($crash == 'crash') { |
1294 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1294 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1295 | 1295 | } else { |
1296 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1296 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1297 | 1297 | } |
1298 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1298 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1299 | 1299 | if ($mapsatellites == 'mapsatellites') { |
1300 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1300 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1301 | 1301 | } else { |
1302 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1302 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1303 | 1303 | } |
1304 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1304 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1305 | 1305 | if ($map3ddefault == 'map3ddefault') { |
1306 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1306 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1307 | 1307 | } else { |
1308 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1308 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1309 | 1309 | } |
1310 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1310 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1311 | 1311 | if ($translate == 'translate') { |
1312 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1312 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1313 | 1313 | } else { |
1314 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1314 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1315 | 1315 | } |
1316 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1316 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1317 | 1317 | if ($realairlines == 'realairlines') { |
1318 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1318 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1319 | 1319 | } else { |
1320 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1320 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1321 | 1321 | } |
1322 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1322 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1323 | 1323 | if ($estimation == 'estimation') { |
1324 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1324 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1325 | 1325 | } else { |
1326 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1326 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1327 | 1327 | } |
1328 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1328 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1329 | 1329 | if ($metar == 'metar') { |
1330 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1330 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1331 | 1331 | } else { |
1332 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1332 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1333 | 1333 | } |
1334 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1334 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1335 | 1335 | if ($metarcycle == 'metarcycle') { |
1336 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1336 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1337 | 1337 | } else { |
1338 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1338 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1339 | 1339 | } |
1340 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1340 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1341 | 1341 | if ($fork == 'fork') { |
1342 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1342 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1343 | 1343 | } else { |
1344 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1344 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1345 | 1345 | } |
1346 | 1346 | |
1347 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1347 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1348 | 1348 | if ($colormap == 'colormap') { |
1349 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1349 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1350 | 1350 | } else { |
1351 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1351 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | if (isset($_POST['aircrafticoncolor'])) { |
1355 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1356 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1355 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1356 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1357 | 1357 | } |
1358 | 1358 | |
1359 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1360 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1359 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1360 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1361 | 1361 | |
1362 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1363 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1364 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1365 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1366 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1367 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1362 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1363 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1364 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1365 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1366 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1367 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1368 | 1368 | |
1369 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1369 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1370 | 1370 | if ($mappopup == 'mappopup') { |
1371 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1371 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1372 | 1372 | } else { |
1373 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1373 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1374 | 1374 | } |
1375 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1375 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1376 | 1376 | if ($airportpopup == 'airportpopup') { |
1377 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1377 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1378 | 1378 | } else { |
1379 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1379 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1380 | 1380 | } |
1381 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1381 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1382 | 1382 | if ($maphistory == 'maphistory') { |
1383 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1383 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1384 | 1384 | } else { |
1385 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1385 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1386 | 1386 | } |
1387 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1387 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1388 | 1388 | if ($maptooltip == 'maptooltip') { |
1389 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1389 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1390 | 1390 | } else { |
1391 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1391 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1392 | 1392 | } |
1393 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1393 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1394 | 1394 | if ($flightroute == 'flightroute') { |
1395 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1395 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1396 | 1396 | } else { |
1397 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1397 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1398 | 1398 | } |
1399 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1399 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1400 | 1400 | if ($flightremainingroute == 'flightremainingroute') { |
1401 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1401 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1402 | 1402 | } else { |
1403 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1403 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1404 | 1404 | } |
1405 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1405 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1406 | 1406 | if ($allflights == 'allflights') { |
1407 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1407 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1408 | 1408 | } else { |
1409 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1409 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1410 | 1410 | } |
1411 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1411 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1412 | 1412 | if ($bbox == 'bbox') { |
1413 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1413 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1414 | 1414 | } else { |
1415 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1415 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1416 | 1416 | } |
1417 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1417 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1418 | 1418 | if ($groundaltitude == 'groundaltitude') { |
1419 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1419 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1420 | 1420 | } else { |
1421 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1421 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1422 | 1422 | } |
1423 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1423 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1424 | 1424 | if ($waypoints == 'waypoints') { |
1425 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1425 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1426 | 1426 | } else { |
1427 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1427 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1428 | 1428 | } |
1429 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1429 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1430 | 1430 | if ($geoid == 'geoid') { |
1431 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1431 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1432 | 1432 | } else { |
1433 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1433 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1434 | 1434 | } |
1435 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1436 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1435 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1436 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1437 | 1437 | |
1438 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1438 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1439 | 1439 | if ($noairlines == 'noairlines') { |
1440 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1440 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1441 | 1441 | } else { |
1442 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1442 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1443 | 1443 | } |
1444 | 1444 | |
1445 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1445 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1446 | 1446 | |
1447 | 1447 | // Set some defaults values... |
1448 | 1448 | if (!isset($globalAircraftImageSources)) { |
1449 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1450 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1449 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1450 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | if (!isset($globalSchedulesSources)) { |
1454 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1455 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1454 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1455 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1456 | 1456 | } |
1457 | 1457 | |
1458 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1458 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1459 | 1459 | |
1460 | 1460 | if ($error == '') settings::modify_settings($settings); |
1461 | 1461 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | //require_once('require/class.SpotterLive.php'); |
8 | 8 | require_once('require/class.SpotterArchive.php'); |
9 | 9 | |
10 | -if (!isset($_GET['owner'])){ |
|
10 | +if (!isset($_GET['owner'])) { |
|
11 | 11 | header('Location: '.$globalURL.''); |
12 | 12 | } else { |
13 | 13 | $Spotter = new Spotter(); |
14 | 14 | $SpotterArchive = new SpotterArchive(); |
15 | 15 | //$Translation = new Translation(); |
16 | 16 | //calculuation for the pagination |
17 | - if(!isset($_GET['limit'])) |
|
17 | + if (!isset($_GET['limit'])) |
|
18 | 18 | { |
19 | 19 | $limit_start = 0; |
20 | 20 | $limit_end = 25; |
@@ -35,29 +35,29 @@ discard block |
||
35 | 35 | |
36 | 36 | $page_url = $globalURL.'/owner/'.$_GET['owner']; |
37 | 37 | |
38 | - $owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
39 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
40 | - $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
41 | - $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
38 | + $owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
39 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
40 | + $year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
41 | + $month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
42 | 42 | $filter = array(); |
43 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
44 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
43 | + if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
44 | + if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
45 | 45 | if ($sort != '') |
46 | 46 | { |
47 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
|
47 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter); |
|
48 | 48 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
49 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
|
49 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter); |
|
50 | 50 | } |
51 | 51 | } else { |
52 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter); |
|
52 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter); |
|
53 | 53 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
54 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter); |
|
54 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | if (!empty($spotter_array)) |
59 | 59 | { |
60 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']); |
|
60 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']); |
|
61 | 61 | //$ident = $spotter_array[0]['ident']; |
62 | 62 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
63 | 63 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -117,23 +117,23 @@ discard block |
||
117 | 117 | $Stats = new Stats(); |
118 | 118 | if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner); |
119 | 119 | else $flights = 0; |
120 | - if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter); |
|
120 | + if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner, $filter); |
|
121 | 121 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
122 | - $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter)); |
|
122 | + $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner, $filter)); |
|
123 | 123 | print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>'; |
124 | - $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner,$filter)); |
|
124 | + $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner, $filter)); |
|
125 | 125 | print '<div><span class="label">'._("Aircrafts").'</span>'.$aircraft_registration.'</div>'; |
126 | - $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner,$filter)); |
|
126 | + $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner, $filter)); |
|
127 | 127 | print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>'; |
128 | - $airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter)); |
|
128 | + $airlines = count($Spotter->countAllAirlinesByOwner($owner, $filter)); |
|
129 | 129 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
130 | - $duration = $Spotter->getFlightDurationByOwner($owner,$filter); |
|
130 | + $duration = $Spotter->getFlightDurationByOwner($owner, $filter); |
|
131 | 131 | if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
132 | 132 | print '</div>'; |
133 | 133 | |
134 | 134 | include('owner-sub-menu.php'); |
135 | 135 | print '<div class="table column">'; |
136 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
136 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
137 | 137 | |
138 | 138 | include('table-output.php'); |
139 | 139 | print '<div class="pagination">'; |