@@ -16,15 +16,15 @@ discard block |
||
16 | 16 | * @param Array $filter the filter |
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
21 | - if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
|
22 | - if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter); |
|
21 | + if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName], $filter); |
|
22 | + if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter); |
|
23 | 23 | $filter_query_join = ''; |
24 | 24 | $filter_query_where = ''; |
25 | 25 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
26 | 26 | if ($filter['airlines'][0] != '') { |
27 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
27 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
33 | 33 | } |
34 | 34 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
35 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
35 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
36 | 36 | } |
37 | 37 | if (isset($filter['source']) && !empty($filter['source'])) { |
38 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
38 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
39 | 39 | } |
40 | 40 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
41 | 41 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
42 | 42 | } |
43 | 43 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
44 | 44 | if ($filter_query_where == '') { |
45 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
45 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
46 | 46 | } else { |
47 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
47 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | if ($limit != '') |
71 | 71 | { |
72 | 72 | $limit_array = explode(',', $limit); |
73 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
74 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
73 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
74 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
75 | 75 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
76 | 76 | { |
77 | 77 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | global $globalDBdriver, $globalLiveInterval; |
108 | 108 | date_default_timezone_set('UTC'); |
109 | 109 | |
110 | - $filter_query = $this->getFilter($filter,true,true); |
|
110 | + $filter_query = $this->getFilter($filter, true, true); |
|
111 | 111 | |
112 | 112 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
113 | 113 | if ($globalDBdriver == 'mysql') { |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao'; |
116 | 116 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
117 | 117 | |
118 | - $query = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
118 | + $query = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
119 | 119 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
120 | 120 | |
121 | 121 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date ORDER BY spotter_live.date GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() AT TIME ZONE 'UTC' - '30 SECONDS'->INTERVAL <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
126 | 126 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() AT TIME ZONE 'UTC' - '".$globalLiveInterval." SECONDS'->INTERVAL <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query"; |
127 | 127 | //$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao'; |
128 | - $query = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
128 | + $query = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
129 | 129 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
130 | 130 | } |
131 | 131 | // $spotter_array = Spotter->getDataFromDB($query.$limit_query); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | try { |
135 | 135 | $sth = $this->db->prepare($query); |
136 | 136 | $sth->execute(); |
137 | - } catch(PDOException $e) { |
|
137 | + } catch (PDOException $e) { |
|
138 | 138 | echo $e->getMessage(); |
139 | 139 | die; |
140 | 140 | } |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | global $globalDBdriver, $globalLiveInterval; |
155 | 155 | date_default_timezone_set('UTC'); |
156 | 156 | |
157 | - $filter_query = $this->getFilter($filter,true,true); |
|
157 | + $filter_query = $this->getFilter($filter, true, true); |
|
158 | 158 | |
159 | 159 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
160 | 160 | if ($globalDBdriver == 'mysql') { |
161 | 161 | |
162 | - $query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
162 | + $query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
163 | 163 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
164 | 164 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
165 | 165 | } else { |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | FROM spotter_live WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
169 | 169 | ".$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao ORDER BY spotter_live.flightaware_id, spotter_live.date'; |
170 | 170 | */ |
171 | - $query = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
171 | + $query = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
172 | 172 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
173 | 173 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
174 | 174 | // echo $query; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | try { |
178 | 178 | $sth = $this->db->prepare($query); |
179 | 179 | $sth->execute(); |
180 | - } catch(PDOException $e) { |
|
180 | + } catch (PDOException $e) { |
|
181 | 181 | echo $e->getMessage(); |
182 | 182 | die; |
183 | 183 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | public function getLiveSpotterCount($filter = array()) |
195 | 195 | { |
196 | 196 | global $globalDBdriver, $globalLiveInterval; |
197 | - $filter_query = $this->getFilter($filter,true,true); |
|
197 | + $filter_query = $this->getFilter($filter, true, true); |
|
198 | 198 | |
199 | 199 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
200 | 200 | if ($globalDBdriver == 'mysql') { |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | try { |
208 | 208 | $sth = $this->db->prepare($query); |
209 | 209 | $sth->execute(); |
210 | - } catch(PDOException $e) { |
|
210 | + } catch (PDOException $e) { |
|
211 | 211 | echo $e->getMessage(); |
212 | 212 | die; |
213 | 213 | } |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | $filter_query = $this->getFilter($filter); |
231 | 231 | |
232 | 232 | if (is_array($coord)) { |
233 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
234 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
235 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
236 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
233 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
234 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
235 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
236 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
237 | 237 | } else return array(); |
238 | 238 | if ($globalDBdriver == 'mysql') { |
239 | 239 | //$query = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | if ($interval == '1m') |
287 | 287 | { |
288 | 288 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
289 | - } else if ($interval == '15m'){ |
|
289 | + } else if ($interval == '15m') { |
|
290 | 290 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
291 | 291 | } |
292 | 292 | } |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
295 | 295 | } |
296 | 296 | |
297 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
297 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
298 | 298 | WHERE spotter_live.latitude <> '' |
299 | 299 | AND spotter_live.longitude <> '' |
300 | 300 | ".$additional_query." |
301 | 301 | HAVING distance < :radius |
302 | 302 | ORDER BY distance"; |
303 | 303 | |
304 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
304 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
305 | 305 | |
306 | 306 | return $spotter_array; |
307 | 307 | } |
@@ -319,9 +319,9 @@ discard block |
||
319 | 319 | date_default_timezone_set('UTC'); |
320 | 320 | |
321 | 321 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
322 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
322 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
323 | 323 | |
324 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
324 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
325 | 325 | |
326 | 326 | return $spotter_array; |
327 | 327 | } |
@@ -332,16 +332,16 @@ discard block |
||
332 | 332 | * @return Array the spotter information |
333 | 333 | * |
334 | 334 | */ |
335 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
335 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
336 | 336 | { |
337 | 337 | $Spotter = new Spotter($this->db); |
338 | 338 | date_default_timezone_set('UTC'); |
339 | 339 | |
340 | 340 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
341 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
341 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
342 | 342 | |
343 | - $date = date('c',$date); |
|
344 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
343 | + $date = date('c', $date); |
|
344 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
345 | 345 | |
346 | 346 | return $spotter_array; |
347 | 347 | } |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | date_default_timezone_set('UTC'); |
359 | 359 | |
360 | 360 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
361 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
361 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
362 | 362 | |
363 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
363 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
364 | 364 | |
365 | 365 | return $spotter_array; |
366 | 366 | } |
@@ -371,15 +371,15 @@ discard block |
||
371 | 371 | * @return Array the spotter information |
372 | 372 | * |
373 | 373 | */ |
374 | - public function getDateLiveSpotterDataById($id,$date) |
|
374 | + public function getDateLiveSpotterDataById($id, $date) |
|
375 | 375 | { |
376 | 376 | $Spotter = new Spotter($this->db); |
377 | 377 | date_default_timezone_set('UTC'); |
378 | 378 | |
379 | 379 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
380 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
381 | - $date = date('c',$date); |
|
382 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
380 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
381 | + $date = date('c', $date); |
|
382 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
383 | 383 | |
384 | 384 | return $spotter_array; |
385 | 385 | } |
@@ -396,13 +396,13 @@ discard block |
||
396 | 396 | date_default_timezone_set('UTC'); |
397 | 397 | |
398 | 398 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
399 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
399 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
400 | 400 | |
401 | 401 | try { |
402 | 402 | |
403 | 403 | $sth = $this->db->prepare($query); |
404 | 404 | $sth->execute(array(':ident' => $ident)); |
405 | - } catch(PDOException $e) { |
|
405 | + } catch (PDOException $e) { |
|
406 | 406 | echo $e->getMessage(); |
407 | 407 | die; |
408 | 408 | } |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * @return Array the spotter information |
418 | 418 | * |
419 | 419 | */ |
420 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
420 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
421 | 421 | { |
422 | 422 | global $globalDBdriver, $globalLiveInterval; |
423 | 423 | date_default_timezone_set('UTC'); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | try { |
437 | 437 | $sth = $this->db->prepare($query); |
438 | 438 | $sth->execute(array(':id' => $id)); |
439 | - } catch(PDOException $e) { |
|
439 | + } catch (PDOException $e) { |
|
440 | 440 | echo $e->getMessage(); |
441 | 441 | die; |
442 | 442 | } |
@@ -454,12 +454,12 @@ discard block |
||
454 | 454 | { |
455 | 455 | date_default_timezone_set('UTC'); |
456 | 456 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
457 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
457 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
458 | 458 | try { |
459 | 459 | |
460 | 460 | $sth = $this->db->prepare($query); |
461 | 461 | $sth->execute(array(':ident' => $ident)); |
462 | - } catch(PDOException $e) { |
|
462 | + } catch (PDOException $e) { |
|
463 | 463 | echo $e->getMessage(); |
464 | 464 | die; |
465 | 465 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | |
490 | 490 | $sth = $this->db->prepare($query); |
491 | 491 | $sth->execute(); |
492 | - } catch(PDOException $e) { |
|
492 | + } catch (PDOException $e) { |
|
493 | 493 | return "error"; |
494 | 494 | } |
495 | 495 | |
@@ -512,14 +512,14 @@ discard block |
||
512 | 512 | |
513 | 513 | $sth = $this->db->prepare($query); |
514 | 514 | $sth->execute(); |
515 | - } catch(PDOException $e) { |
|
515 | + } catch (PDOException $e) { |
|
516 | 516 | return "error"; |
517 | 517 | } |
518 | 518 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
519 | 519 | $i = 0; |
520 | - $j =0; |
|
520 | + $j = 0; |
|
521 | 521 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
522 | - foreach($all as $row) |
|
522 | + foreach ($all as $row) |
|
523 | 523 | { |
524 | 524 | $i++; |
525 | 525 | $j++; |
@@ -527,9 +527,9 @@ discard block |
||
527 | 527 | if ($globalDebug) echo "."; |
528 | 528 | try { |
529 | 529 | |
530 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
530 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
531 | 531 | $sth->execute(); |
532 | - } catch(PDOException $e) { |
|
532 | + } catch (PDOException $e) { |
|
533 | 533 | return "error"; |
534 | 534 | } |
535 | 535 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -540,9 +540,9 @@ discard block |
||
540 | 540 | if ($i > 0) { |
541 | 541 | try { |
542 | 542 | |
543 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
543 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
544 | 544 | $sth->execute(); |
545 | - } catch(PDOException $e) { |
|
545 | + } catch (PDOException $e) { |
|
546 | 546 | return "error"; |
547 | 547 | } |
548 | 548 | } |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | |
556 | 556 | $sth = $this->db->prepare($query); |
557 | 557 | $sth->execute(); |
558 | - } catch(PDOException $e) { |
|
558 | + } catch (PDOException $e) { |
|
559 | 559 | return "error"; |
560 | 560 | } |
561 | 561 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -603,13 +603,13 @@ discard block |
||
603 | 603 | public function deleteLiveSpotterDataByIdent($ident) |
604 | 604 | { |
605 | 605 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
606 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
606 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
607 | 607 | |
608 | 608 | try { |
609 | 609 | |
610 | 610 | $sth = $this->db->prepare($query); |
611 | 611 | $sth->execute(array(':ident' => $ident)); |
612 | - } catch(PDOException $e) { |
|
612 | + } catch (PDOException $e) { |
|
613 | 613 | return "error"; |
614 | 614 | } |
615 | 615 | |
@@ -625,13 +625,13 @@ discard block |
||
625 | 625 | public function deleteLiveSpotterDataById($id) |
626 | 626 | { |
627 | 627 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
628 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
628 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
629 | 629 | |
630 | 630 | try { |
631 | 631 | |
632 | 632 | $sth = $this->db->prepare($query); |
633 | 633 | $sth->execute(array(':id' => $id)); |
634 | - } catch(PDOException $e) { |
|
634 | + } catch (PDOException $e) { |
|
635 | 635 | return "error"; |
636 | 636 | } |
637 | 637 | |
@@ -649,13 +649,13 @@ discard block |
||
649 | 649 | { |
650 | 650 | global $globalDBdriver, $globalTimezone; |
651 | 651 | if ($globalDBdriver == 'mysql') { |
652 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
652 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
653 | 653 | WHERE spotter_live.ident = :ident |
654 | 654 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
655 | 655 | AND spotter_live.date < UTC_TIMESTAMP()'; |
656 | 656 | $query_data = array(':ident' => $ident); |
657 | 657 | } else { |
658 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
658 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
659 | 659 | WHERE spotter_live.ident = :ident |
660 | 660 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
661 | 661 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -664,8 +664,8 @@ discard block |
||
664 | 664 | |
665 | 665 | $sth = $this->db->prepare($query); |
666 | 666 | $sth->execute($query_data); |
667 | - $ident_result=''; |
|
668 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
667 | + $ident_result = ''; |
|
668 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
669 | 669 | { |
670 | 670 | $ident_result = $row['ident']; |
671 | 671 | } |
@@ -682,13 +682,13 @@ discard block |
||
682 | 682 | { |
683 | 683 | global $globalDBdriver, $globalTimezone; |
684 | 684 | if ($globalDBdriver == 'mysql') { |
685 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
685 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
686 | 686 | WHERE spotter_live.ident = :ident |
687 | 687 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
688 | 688 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
689 | 689 | $query_data = array(':ident' => $ident); |
690 | 690 | } else { |
691 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
691 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
692 | 692 | WHERE spotter_live.ident = :ident |
693 | 693 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
694 | 694 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -697,8 +697,8 @@ discard block |
||
697 | 697 | |
698 | 698 | $sth = $this->db->prepare($query); |
699 | 699 | $sth->execute($query_data); |
700 | - $ident_result=''; |
|
701 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
700 | + $ident_result = ''; |
|
701 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
702 | 702 | { |
703 | 703 | $ident_result = $row['flightaware_id']; |
704 | 704 | } |
@@ -715,13 +715,13 @@ discard block |
||
715 | 715 | { |
716 | 716 | global $globalDBdriver, $globalTimezone; |
717 | 717 | if ($globalDBdriver == 'mysql') { |
718 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
718 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
719 | 719 | WHERE spotter_live.flightaware_id = :id |
720 | 720 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
721 | 721 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
722 | 722 | $query_data = array(':id' => $id); |
723 | 723 | } else { |
724 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
724 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
725 | 725 | WHERE spotter_live.flightaware_id = :id |
726 | 726 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
727 | 727 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -730,8 +730,8 @@ discard block |
||
730 | 730 | |
731 | 731 | $sth = $this->db->prepare($query); |
732 | 732 | $sth->execute($query_data); |
733 | - $ident_result=''; |
|
734 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
733 | + $ident_result = ''; |
|
734 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
735 | 735 | { |
736 | 736 | $ident_result = $row['flightaware_id']; |
737 | 737 | } |
@@ -748,13 +748,13 @@ discard block |
||
748 | 748 | { |
749 | 749 | global $globalDBdriver, $globalTimezone; |
750 | 750 | if ($globalDBdriver == 'mysql') { |
751 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
751 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
752 | 752 | WHERE spotter_live.ModeS = :modes |
753 | 753 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
754 | 754 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
755 | 755 | $query_data = array(':modes' => $modes); |
756 | 756 | } else { |
757 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
757 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
758 | 758 | WHERE spotter_live.ModeS = :modes |
759 | 759 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
760 | 760 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -763,8 +763,8 @@ discard block |
||
763 | 763 | |
764 | 764 | $sth = $this->db->prepare($query); |
765 | 765 | $sth->execute($query_data); |
766 | - $ident_result=''; |
|
767 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
766 | + $ident_result = ''; |
|
767 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
768 | 768 | { |
769 | 769 | //$ident_result = $row['spotter_live_id']; |
770 | 770 | $ident_result = $row['flightaware_id']; |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | * @return String success or false |
784 | 784 | * |
785 | 785 | */ |
786 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
786 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
787 | 787 | { |
788 | 788 | global $globalURL, $globalArchive, $globalDebug; |
789 | 789 | $Common = new Common(); |
@@ -877,26 +877,26 @@ discard block |
||
877 | 877 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
878 | 878 | |
879 | 879 | |
880 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
881 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
882 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
883 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
884 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
885 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
886 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
887 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
888 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
889 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
890 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
891 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
892 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
893 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
894 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
895 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
896 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
897 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
898 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
899 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
880 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
881 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
882 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
883 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
884 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
885 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
886 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
887 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
888 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
889 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
890 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
891 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
892 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
893 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
894 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
895 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
896 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
897 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
898 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
899 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
900 | 900 | |
901 | 901 | $airline_name = ''; |
902 | 902 | $airline_icao = ''; |
@@ -918,26 +918,26 @@ discard block |
||
918 | 918 | $arrival_airport_country = ''; |
919 | 919 | |
920 | 920 | |
921 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
922 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
923 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
924 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
921 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
922 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
923 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
924 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
925 | 925 | |
926 | - $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
926 | + $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
927 | 927 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
928 | 928 | |
929 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
929 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
930 | 930 | //$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'],':airline_country' => $airline_array[0]['country'],':airline_type' => $airline_array[0]['type'],':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_array[0]['type'],':aircraft_manufacturer' => $aircraft_array[0]['manufacturer'],':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date); |
931 | 931 | try { |
932 | 932 | |
933 | 933 | $sth = $this->db->prepare($query); |
934 | 934 | $sth->execute($query_values); |
935 | - } catch(PDOException $e) { |
|
935 | + } catch (PDOException $e) { |
|
936 | 936 | return "error : ".$e->getMessage(); |
937 | 937 | } |
938 | 938 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
939 | 939 | if ($globalDebug) echo '(Add to SBS archive : '; |
940 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
940 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
941 | 941 | if ($globalDebug) echo $result.')'; |
942 | 942 | } |
943 | 943 | return "success"; |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | |
947 | 947 | public function getOrderBy() |
948 | 948 | { |
949 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
949 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
950 | 950 | return $orderby; |
951 | 951 | } |
952 | 952 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
5 | 5 | $global_query = "SELECT spotter_output.* FROM spotter_output"; |
6 | 6 | |
7 | -class Spotter{ |
|
7 | +class Spotter { |
|
8 | 8 | public $db; |
9 | 9 | |
10 | 10 | public function __construct($dbc = null) { |
@@ -17,15 +17,15 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
22 | - if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
|
23 | - if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter); |
|
22 | + if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName], $filter); |
|
23 | + if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter); |
|
24 | 24 | $filter_query_join = ''; |
25 | 25 | $filter_query_where = ''; |
26 | 26 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
27 | 27 | if ($filter['airlines'][0] != '') { |
28 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
28 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id "; |
34 | 34 | } |
35 | 35 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
36 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
36 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
37 | 37 | } |
38 | 38 | if (isset($filter['source']) && !empty($filter['source'])) { |
39 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
39 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
40 | 40 | } |
41 | 41 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
42 | 42 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
43 | 43 | } |
44 | 44 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
45 | 45 | if ($filter_query_where == '') { |
46 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
46 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
47 | 47 | } else { |
48 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
48 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $sth = $this->db->prepare($query.$limitQuery); |
94 | 94 | $sth->execute($params); |
95 | 95 | } catch (PDOException $e) { |
96 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
96 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
97 | 97 | exit(); |
98 | 98 | } |
99 | 99 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $spotter_array = array(); |
104 | 104 | |
105 | 105 | |
106 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
106 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
107 | 107 | { |
108 | 108 | $num_rows++; |
109 | 109 | $temp_array = array(); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if (isset($row['route_stop'])) { |
149 | 149 | $temp_array['route_stop'] = $row['route_stop']; |
150 | 150 | if ($row['route_stop'] != '') { |
151 | - $allroute = explode(' ',$row['route_stop']); |
|
151 | + $allroute = explode(' ', $row['route_stop']); |
|
152 | 152 | |
153 | 153 | foreach ($allroute as $route) { |
154 | 154 | $route_airport_array = $this->getAllAirportInfo($route); |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | { |
204 | 204 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
205 | 205 | } else { |
206 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
206 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
207 | 207 | } |
208 | 208 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
209 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
210 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
209 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
210 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
211 | 211 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
212 | 212 | } |
213 | 213 | |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
242 | 242 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
243 | 243 | if (is_numeric(substr($row['ident'], 2, 1))) { |
244 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource); |
|
244 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource); |
|
245 | 245 | } elseif (is_numeric(substr($row['ident'], 3, 1))) { |
246 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
246 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
247 | 247 | } else { |
248 | 248 | $airline_array = $this->getAllAirlineInfo('NA'); |
249 | 249 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $temp_array['airline_type'] = $row['airline_type']; |
270 | 270 | } |
271 | 271 | if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') { |
272 | - $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3)); |
|
272 | + $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3)); |
|
273 | 273 | //$acars_array = ACARS->getLiveAcarsData('BA40YL'); |
274 | 274 | if (count($acars_array) > 0) { |
275 | 275 | $temp_array['acars'] = $acars_array; |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
287 | 287 | } |
288 | 288 | |
289 | - if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
289 | + if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
290 | 290 | { |
291 | 291 | if ($globalIVAO) { |
292 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
293 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
292 | + if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']); |
|
293 | + else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']); |
|
294 | 294 | } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
295 | 295 | if (count($image_array) > 0) { |
296 | 296 | $temp_array['image'] = $image_array[0]['image']; |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | if (isset($row['arrival_airport_time']) && $row['arrival_airport_time'] != '') { |
314 | 314 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
315 | 315 | } |
316 | - if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
316 | + if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
317 | 317 | $schedule_array = $Schedule->getSchedule($temp_array['ident']); |
318 | 318 | //print_r($schedule_array); |
319 | 319 | if (count($schedule_array) > 0) { |
@@ -394,12 +394,12 @@ discard block |
||
394 | 394 | if (isset($row['squawk'])) { |
395 | 395 | $temp_array['squawk'] = $row['squawk']; |
396 | 396 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
397 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
|
398 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
397 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']); |
|
398 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
399 | 399 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
400 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
|
401 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
402 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
400 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']); |
|
401 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
402 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | $temp_array['query_number_rows'] = $num_rows; |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * @return Array the spotter information |
419 | 419 | * |
420 | 420 | */ |
421 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
|
421 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
422 | 422 | { |
423 | 423 | global $globalTimezone, $globalDBdriver; |
424 | 424 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | |
429 | 429 | $query_values = array(); |
430 | 430 | $additional_query = ''; |
431 | - $filter_query = $this->getFilter($filters,true,true); |
|
431 | + $filter_query = $this->getFilter($filters, true, true); |
|
432 | 432 | if ($q != "") |
433 | 433 | { |
434 | 434 | if (!is_string($q)) |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | return false; |
437 | 437 | } else { |
438 | 438 | $q_array = explode(" ", $q); |
439 | - foreach ($q_array as $q_item){ |
|
440 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
439 | + foreach ($q_array as $q_item) { |
|
440 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
441 | 441 | $additional_query .= " AND ("; |
442 | 442 | if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
443 | 443 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -469,37 +469,37 @@ discard block |
||
469 | 469 | |
470 | 470 | if ($registration != "") |
471 | 471 | { |
472 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
472 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
473 | 473 | if (!is_string($registration)) |
474 | 474 | { |
475 | 475 | return false; |
476 | 476 | } else { |
477 | 477 | $additional_query .= " AND spotter_output.registration = :registration"; |
478 | - $query_values = array_merge($query_values,array(':registration' => $registration)); |
|
478 | + $query_values = array_merge($query_values, array(':registration' => $registration)); |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | |
482 | 482 | if ($aircraft_icao != "") |
483 | 483 | { |
484 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
484 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
485 | 485 | if (!is_string($aircraft_icao)) |
486 | 486 | { |
487 | 487 | return false; |
488 | 488 | } else { |
489 | 489 | $additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao"; |
490 | - $query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao)); |
|
490 | + $query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao)); |
|
491 | 491 | } |
492 | 492 | } |
493 | 493 | |
494 | 494 | if ($aircraft_manufacturer != "") |
495 | 495 | { |
496 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
496 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
497 | 497 | if (!is_string($aircraft_manufacturer)) |
498 | 498 | { |
499 | 499 | return false; |
500 | 500 | } else { |
501 | 501 | $additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer"; |
502 | - $query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
502 | + $query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
503 | 503 | } |
504 | 504 | } |
505 | 505 | |
@@ -515,25 +515,25 @@ discard block |
||
515 | 515 | |
516 | 516 | if ($airline_icao != "") |
517 | 517 | { |
518 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
518 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
519 | 519 | if (!is_string($airline_icao)) |
520 | 520 | { |
521 | 521 | return false; |
522 | 522 | } else { |
523 | 523 | $additional_query .= " AND spotter_output.airline_icao = :airline_icao"; |
524 | - $query_values = array_merge($query_values,array(':airline_icao' => $airline_icao)); |
|
524 | + $query_values = array_merge($query_values, array(':airline_icao' => $airline_icao)); |
|
525 | 525 | } |
526 | 526 | } |
527 | 527 | |
528 | 528 | if ($airline_country != "") |
529 | 529 | { |
530 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
530 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
531 | 531 | if (!is_string($airline_country)) |
532 | 532 | { |
533 | 533 | return false; |
534 | 534 | } else { |
535 | 535 | $additional_query .= " AND spotter_output.airline_country = :airline_country"; |
536 | - $query_values = array_merge($query_values,array(':airline_country' => $airline_country)); |
|
536 | + $query_values = array_merge($query_values, array(':airline_country' => $airline_country)); |
|
537 | 537 | } |
538 | 538 | } |
539 | 539 | |
@@ -560,31 +560,31 @@ discard block |
||
560 | 560 | |
561 | 561 | if ($airport != "") |
562 | 562 | { |
563 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
563 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
564 | 564 | if (!is_string($airport)) |
565 | 565 | { |
566 | 566 | return false; |
567 | 567 | } else { |
568 | 568 | $additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)"; |
569 | - $query_values = array_merge($query_values,array(':airport' => $airport)); |
|
569 | + $query_values = array_merge($query_values, array(':airport' => $airport)); |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
573 | 573 | if ($airport_country != "") |
574 | 574 | { |
575 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
575 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
576 | 576 | if (!is_string($airport_country)) |
577 | 577 | { |
578 | 578 | return false; |
579 | 579 | } else { |
580 | 580 | $additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)"; |
581 | - $query_values = array_merge($query_values,array(':airport_country' => $airport_country)); |
|
581 | + $query_values = array_merge($query_values, array(':airport_country' => $airport_country)); |
|
582 | 582 | } |
583 | 583 | } |
584 | 584 | |
585 | 585 | if ($callsign != "") |
586 | 586 | { |
587 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
587 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
588 | 588 | if (!is_string($callsign)) |
589 | 589 | { |
590 | 590 | return false; |
@@ -592,79 +592,79 @@ discard block |
||
592 | 592 | $translate = $Translation->ident2icao($callsign); |
593 | 593 | if ($translate != $callsign) { |
594 | 594 | $additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)"; |
595 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
595 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
596 | 596 | } else { |
597 | 597 | $additional_query .= " AND spotter_output.ident = :callsign"; |
598 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
598 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
599 | 599 | } |
600 | 600 | } |
601 | 601 | } |
602 | 602 | |
603 | 603 | if ($owner != "") |
604 | 604 | { |
605 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
605 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
606 | 606 | if (!is_string($owner)) |
607 | 607 | { |
608 | 608 | return false; |
609 | 609 | } else { |
610 | 610 | $additional_query .= " AND spotter_output.owner_name = :owner"; |
611 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
611 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | |
615 | 615 | if ($pilot_name != "") |
616 | 616 | { |
617 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
617 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
618 | 618 | if (!is_string($pilot_name)) |
619 | 619 | { |
620 | 620 | return false; |
621 | 621 | } else { |
622 | 622 | $additional_query .= " AND spotter_output.pilot_name = :pilot_name"; |
623 | - $query_values = array_merge($query_values,array(':pilot_name' => $pilot_name)); |
|
623 | + $query_values = array_merge($query_values, array(':pilot_name' => $pilot_name)); |
|
624 | 624 | } |
625 | 625 | } |
626 | 626 | |
627 | 627 | if ($pilot_id != "") |
628 | 628 | { |
629 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
629 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
630 | 630 | if (!is_string($pilot_id)) |
631 | 631 | { |
632 | 632 | return false; |
633 | 633 | } else { |
634 | 634 | $additional_query .= " AND spotter_output.pilot_id = :pilot_id"; |
635 | - $query_values = array_merge($query_values,array(':pilot_id' => $pilot_id)); |
|
635 | + $query_values = array_merge($query_values, array(':pilot_id' => $pilot_id)); |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | |
639 | 639 | if ($departure_airport_route != "") |
640 | 640 | { |
641 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
641 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
642 | 642 | if (!is_string($departure_airport_route)) |
643 | 643 | { |
644 | 644 | return false; |
645 | 645 | } else { |
646 | 646 | $additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route"; |
647 | - $query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route)); |
|
647 | + $query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route)); |
|
648 | 648 | } |
649 | 649 | } |
650 | 650 | |
651 | 651 | if ($arrival_airport_route != "") |
652 | 652 | { |
653 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
653 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
654 | 654 | if (!is_string($arrival_airport_route)) |
655 | 655 | { |
656 | 656 | return false; |
657 | 657 | } else { |
658 | 658 | $additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route"; |
659 | - $query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route)); |
|
659 | + $query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route)); |
|
660 | 660 | } |
661 | 661 | } |
662 | 662 | |
663 | 663 | if ($altitude != "") |
664 | 664 | { |
665 | 665 | $altitude_array = explode(",", $altitude); |
666 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
667 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
666 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
667 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
668 | 668 | |
669 | 669 | if ($altitude_array[1] != "") |
670 | 670 | { |
@@ -680,8 +680,8 @@ discard block |
||
680 | 680 | if ($date_posted != "") |
681 | 681 | { |
682 | 682 | $date_array = explode(",", $date_posted); |
683 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
684 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
683 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
684 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
685 | 685 | |
686 | 686 | if ($globalTimezone != '') { |
687 | 687 | date_default_timezone_set($globalTimezone); |
@@ -712,8 +712,8 @@ discard block |
||
712 | 712 | { |
713 | 713 | $limit_array = explode(",", $limit); |
714 | 714 | |
715 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
716 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
715 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
716 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
717 | 717 | |
718 | 718 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
719 | 719 | { |
@@ -742,23 +742,23 @@ discard block |
||
742 | 742 | |
743 | 743 | |
744 | 744 | if ($origLat != "" && $origLon != "" && $dist != "") { |
745 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
745 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
746 | 746 | |
747 | 747 | if ($globalDBdriver == 'mysql') { |
748 | - $query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
748 | + $query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
749 | 749 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
750 | 750 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
751 | 751 | } else { |
752 | - $query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
752 | + $query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
753 | 753 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
754 | 754 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
755 | 755 | } |
756 | 756 | } else { |
757 | - $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
757 | + $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
758 | 758 | ".$additional_query." |
759 | 759 | ".$orderby_query; |
760 | 760 | } |
761 | - $spotter_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
761 | + $spotter_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
762 | 762 | return $spotter_array; |
763 | 763 | } |
764 | 764 | |
@@ -781,8 +781,8 @@ discard block |
||
781 | 781 | { |
782 | 782 | $limit_array = explode(",", $limit); |
783 | 783 | |
784 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
785 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
784 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
785 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
786 | 786 | |
787 | 787 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
788 | 788 | { |
@@ -799,9 +799,9 @@ discard block |
||
799 | 799 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
800 | 800 | } |
801 | 801 | |
802 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
802 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
803 | 803 | |
804 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query); |
|
804 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
|
805 | 805 | |
806 | 806 | return $spotter_array; |
807 | 807 | } |
@@ -847,34 +847,34 @@ discard block |
||
847 | 847 | { |
848 | 848 | return false; |
849 | 849 | } else { |
850 | - if ($interval == "30m"){ |
|
850 | + if ($interval == "30m") { |
|
851 | 851 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date '; |
852 | - } else if ($interval == "1h"){ |
|
852 | + } else if ($interval == "1h") { |
|
853 | 853 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date '; |
854 | - } else if ($interval == "3h"){ |
|
854 | + } else if ($interval == "3h") { |
|
855 | 855 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date '; |
856 | - } else if ($interval == "6h"){ |
|
856 | + } else if ($interval == "6h") { |
|
857 | 857 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date '; |
858 | - } else if ($interval == "12h"){ |
|
858 | + } else if ($interval == "12h") { |
|
859 | 859 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date '; |
860 | - } else if ($interval == "24h"){ |
|
860 | + } else if ($interval == "24h") { |
|
861 | 861 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date '; |
862 | - } else if ($interval == "7d"){ |
|
862 | + } else if ($interval == "7d") { |
|
863 | 863 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date '; |
864 | - } else if ($interval == "30d"){ |
|
864 | + } else if ($interval == "30d") { |
|
865 | 865 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date '; |
866 | 866 | } |
867 | 867 | } |
868 | 868 | } |
869 | 869 | |
870 | - $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
870 | + $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
871 | 871 | WHERE spotter_output.latitude <> '' |
872 | 872 | AND spotter_output.longitude <> '' |
873 | 873 | ".$additional_query." |
874 | 874 | HAVING distance < :radius |
875 | 875 | ORDER BY distance"; |
876 | 876 | |
877 | - $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query); |
|
877 | + $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query); |
|
878 | 878 | |
879 | 879 | return $spotter_array; |
880 | 880 | } |
@@ -886,21 +886,21 @@ discard block |
||
886 | 886 | * @return Array the spotter information |
887 | 887 | * |
888 | 888 | */ |
889 | - public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
|
889 | + public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array()) |
|
890 | 890 | { |
891 | 891 | global $global_query; |
892 | 892 | |
893 | 893 | date_default_timezone_set('UTC'); |
894 | 894 | |
895 | - $filter_query = $this->getFilter($filter,true,true); |
|
895 | + $filter_query = $this->getFilter($filter, true, true); |
|
896 | 896 | |
897 | 897 | $limit_query = ''; |
898 | 898 | if ($limit != "") |
899 | 899 | { |
900 | 900 | $limit_array = explode(",", $limit); |
901 | 901 | |
902 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
903 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
902 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
903 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
904 | 904 | |
905 | 905 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
906 | 906 | { |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
918 | 918 | } |
919 | 919 | |
920 | - $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
920 | + $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
921 | 921 | |
922 | 922 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
923 | 923 | |
@@ -936,15 +936,15 @@ discard block |
||
936 | 936 | global $global_query; |
937 | 937 | |
938 | 938 | date_default_timezone_set('UTC'); |
939 | - $filter_query = $this->getFilter($filter,true,true); |
|
939 | + $filter_query = $this->getFilter($filter, true, true); |
|
940 | 940 | |
941 | 941 | $limit_query = ''; |
942 | 942 | if ($limit != "") |
943 | 943 | { |
944 | 944 | $limit_array = explode(",", $limit); |
945 | 945 | |
946 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
947 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
946 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
947 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
948 | 948 | |
949 | 949 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
950 | 950 | { |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
962 | 962 | } |
963 | 963 | |
964 | - $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
964 | + $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
965 | 965 | |
966 | 966 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
967 | 967 | |
@@ -975,20 +975,20 @@ discard block |
||
975 | 975 | * @return Array the spotter information |
976 | 976 | * |
977 | 977 | */ |
978 | - public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
|
978 | + public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array()) |
|
979 | 979 | { |
980 | 980 | global $global_query; |
981 | 981 | |
982 | 982 | date_default_timezone_set('UTC'); |
983 | - $filter_query = $this->getFilter($filter,true,true); |
|
983 | + $filter_query = $this->getFilter($filter, true, true); |
|
984 | 984 | |
985 | 985 | $limit_query = ''; |
986 | 986 | if ($limit != "") |
987 | 987 | { |
988 | 988 | $limit_array = explode(",", $limit); |
989 | 989 | |
990 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
991 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
990 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
991 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
992 | 992 | |
993 | 993 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
994 | 994 | { |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
1006 | 1006 | } |
1007 | 1007 | |
1008 | - $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1008 | + $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1009 | 1009 | |
1010 | 1010 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1011 | 1011 | |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | |
1026 | 1026 | date_default_timezone_set('UTC'); |
1027 | 1027 | |
1028 | - $filter_query = $this->getFilter($filter,true,true); |
|
1028 | + $filter_query = $this->getFilter($filter, true, true); |
|
1029 | 1029 | |
1030 | 1030 | $limit_query = ''; |
1031 | 1031 | |
@@ -1033,8 +1033,8 @@ discard block |
||
1033 | 1033 | { |
1034 | 1034 | $limit_array = explode(",", $limit); |
1035 | 1035 | |
1036 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1037 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1036 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1037 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1038 | 1038 | |
1039 | 1039 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1040 | 1040 | { |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
1052 | 1052 | } |
1053 | 1053 | |
1054 | - $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1054 | + $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1055 | 1055 | |
1056 | 1056 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1057 | 1057 | |
@@ -1070,14 +1070,14 @@ discard block |
||
1070 | 1070 | global $global_query; |
1071 | 1071 | |
1072 | 1072 | date_default_timezone_set('UTC'); |
1073 | - $filter_query = $this->getFilter($filter,true,true); |
|
1073 | + $filter_query = $this->getFilter($filter, true, true); |
|
1074 | 1074 | $limit_query = ''; |
1075 | 1075 | if ($limit != "") |
1076 | 1076 | { |
1077 | 1077 | $limit_array = explode(",", $limit); |
1078 | 1078 | |
1079 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1080 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1079 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1080 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1081 | 1081 | |
1082 | 1082 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1083 | 1083 | { |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
1095 | 1095 | } |
1096 | 1096 | |
1097 | - $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1097 | + $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
1098 | 1098 | |
1099 | 1099 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1100 | 1100 | |
@@ -1118,9 +1118,9 @@ discard block |
||
1118 | 1118 | $query_values = array(':id' => $id); |
1119 | 1119 | |
1120 | 1120 | //$query = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." "; |
1121 | - $query = $global_query." WHERE ".$additional_query." "; |
|
1121 | + $query = $global_query." WHERE ".$additional_query." "; |
|
1122 | 1122 | |
1123 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
1123 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
1124 | 1124 | |
1125 | 1125 | return $spotter_array; |
1126 | 1126 | } |
@@ -1158,8 +1158,8 @@ discard block |
||
1158 | 1158 | { |
1159 | 1159 | $limit_array = explode(",", $limit); |
1160 | 1160 | |
1161 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1162 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1161 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1162 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1163 | 1163 | |
1164 | 1164 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1165 | 1165 | { |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | $query_values = array(); |
1201 | 1201 | $limit_query = ''; |
1202 | 1202 | $additional_query = ''; |
1203 | - $filter_query = $this->getFilter($filter,true,true); |
|
1203 | + $filter_query = $this->getFilter($filter, true, true); |
|
1204 | 1204 | |
1205 | 1205 | if ($aircraft_type != "") |
1206 | 1206 | { |
@@ -1217,8 +1217,8 @@ discard block |
||
1217 | 1217 | { |
1218 | 1218 | $limit_array = explode(",", $limit); |
1219 | 1219 | |
1220 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1221 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1220 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1221 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1222 | 1222 | |
1223 | 1223 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1224 | 1224 | { |
@@ -1274,8 +1274,8 @@ discard block |
||
1274 | 1274 | { |
1275 | 1275 | $limit_array = explode(",", $limit); |
1276 | 1276 | |
1277 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1278 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1277 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1278 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1279 | 1279 | |
1280 | 1280 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1281 | 1281 | { |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | } else { |
1292 | 1292 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
1293 | 1293 | } |
1294 | - $filter_query = $this->getFilter($filter,true,true); |
|
1294 | + $filter_query = $this->getFilter($filter, true, true); |
|
1295 | 1295 | |
1296 | 1296 | //$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query; |
1297 | 1297 | $query = $global_query.$filter_query." ".$additional_query." ".$orderby_query; |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | * @return Array the spotter information |
1311 | 1311 | * |
1312 | 1312 | */ |
1313 | - public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
|
1313 | + public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array()) |
|
1314 | 1314 | { |
1315 | 1315 | global $global_query; |
1316 | 1316 | |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | $query_values = array(); |
1320 | 1320 | $limit_query = ''; |
1321 | 1321 | $additional_query = ''; |
1322 | - $filter_query = $this->getFilter($filters,true,true); |
|
1322 | + $filter_query = $this->getFilter($filters, true, true); |
|
1323 | 1323 | |
1324 | 1324 | if ($airline != "") |
1325 | 1325 | { |
@@ -1336,8 +1336,8 @@ discard block |
||
1336 | 1336 | { |
1337 | 1337 | $limit_array = explode(",", $limit); |
1338 | 1338 | |
1339 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1340 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1339 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1340 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1341 | 1341 | |
1342 | 1342 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1343 | 1343 | { |
@@ -1367,7 +1367,7 @@ discard block |
||
1367 | 1367 | * @return Array the spotter information |
1368 | 1368 | * |
1369 | 1369 | */ |
1370 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1370 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1371 | 1371 | { |
1372 | 1372 | global $global_query; |
1373 | 1373 | |
@@ -1375,7 +1375,7 @@ discard block |
||
1375 | 1375 | $query_values = array(); |
1376 | 1376 | $limit_query = ''; |
1377 | 1377 | $additional_query = ''; |
1378 | - $filter_query = $this->getFilter($filters,true,true); |
|
1378 | + $filter_query = $this->getFilter($filters, true, true); |
|
1379 | 1379 | |
1380 | 1380 | if ($airport != "") |
1381 | 1381 | { |
@@ -1392,8 +1392,8 @@ discard block |
||
1392 | 1392 | { |
1393 | 1393 | $limit_array = explode(",", $limit); |
1394 | 1394 | |
1395 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1396 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1395 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1396 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1397 | 1397 | |
1398 | 1398 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1399 | 1399 | { |
@@ -1425,7 +1425,7 @@ discard block |
||
1425 | 1425 | * @return Array the spotter information |
1426 | 1426 | * |
1427 | 1427 | */ |
1428 | - public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
1428 | + public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
1429 | 1429 | { |
1430 | 1430 | global $global_query, $globalTimezone, $globalDBdriver; |
1431 | 1431 | |
@@ -1433,7 +1433,7 @@ discard block |
||
1433 | 1433 | $limit_query = ''; |
1434 | 1434 | $additional_query = ''; |
1435 | 1435 | |
1436 | - $filter_query = $this->getFilter($filter,true,true); |
|
1436 | + $filter_query = $this->getFilter($filter, true, true); |
|
1437 | 1437 | |
1438 | 1438 | if ($date != "") |
1439 | 1439 | { |
@@ -1459,8 +1459,8 @@ discard block |
||
1459 | 1459 | { |
1460 | 1460 | $limit_array = explode(",", $limit); |
1461 | 1461 | |
1462 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1463 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1462 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1463 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1464 | 1464 | |
1465 | 1465 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1466 | 1466 | { |
@@ -1490,7 +1490,7 @@ discard block |
||
1490 | 1490 | * @return Array the spotter information |
1491 | 1491 | * |
1492 | 1492 | */ |
1493 | - public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
|
1493 | + public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array()) |
|
1494 | 1494 | { |
1495 | 1495 | global $global_query; |
1496 | 1496 | |
@@ -1499,7 +1499,7 @@ discard block |
||
1499 | 1499 | $query_values = array(); |
1500 | 1500 | $limit_query = ''; |
1501 | 1501 | $additional_query = ''; |
1502 | - $filter_query = $this->getFilter($filters,true,true); |
|
1502 | + $filter_query = $this->getFilter($filters, true, true); |
|
1503 | 1503 | if ($country != "") |
1504 | 1504 | { |
1505 | 1505 | if (!is_string($country)) |
@@ -1516,8 +1516,8 @@ discard block |
||
1516 | 1516 | { |
1517 | 1517 | $limit_array = explode(",", $limit); |
1518 | 1518 | |
1519 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1520 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1519 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1520 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1521 | 1521 | |
1522 | 1522 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1523 | 1523 | { |
@@ -1557,7 +1557,7 @@ discard block |
||
1557 | 1557 | $query_values = array(); |
1558 | 1558 | $additional_query = ''; |
1559 | 1559 | $limit_query = ''; |
1560 | - $filter_query = $this->getFilter($filters,true,true); |
|
1560 | + $filter_query = $this->getFilter($filters, true, true); |
|
1561 | 1561 | |
1562 | 1562 | if ($aircraft_manufacturer != "") |
1563 | 1563 | { |
@@ -1574,8 +1574,8 @@ discard block |
||
1574 | 1574 | { |
1575 | 1575 | $limit_array = explode(",", $limit); |
1576 | 1576 | |
1577 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1578 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1577 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1578 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1579 | 1579 | |
1580 | 1580 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1581 | 1581 | { |
@@ -1617,14 +1617,14 @@ discard block |
||
1617 | 1617 | $query_values = array(); |
1618 | 1618 | $additional_query = ''; |
1619 | 1619 | $limit_query = ''; |
1620 | - $filter_query = $this->getFilter($filters,true,true); |
|
1620 | + $filter_query = $this->getFilter($filters, true, true); |
|
1621 | 1621 | if ($departure_airport_icao != "") |
1622 | 1622 | { |
1623 | 1623 | if (!is_string($departure_airport_icao)) |
1624 | 1624 | { |
1625 | 1625 | return false; |
1626 | 1626 | } else { |
1627 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1627 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
1628 | 1628 | $additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)"; |
1629 | 1629 | $query_values = array(':departure_airport_icao' => $departure_airport_icao); |
1630 | 1630 | } |
@@ -1636,9 +1636,9 @@ discard block |
||
1636 | 1636 | { |
1637 | 1637 | return false; |
1638 | 1638 | } else { |
1639 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1639 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
1640 | 1640 | $additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)"; |
1641 | - $query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
1641 | + $query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
1642 | 1642 | } |
1643 | 1643 | } |
1644 | 1644 | |
@@ -1646,8 +1646,8 @@ discard block |
||
1646 | 1646 | { |
1647 | 1647 | $limit_array = explode(",", $limit); |
1648 | 1648 | |
1649 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1650 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1649 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1650 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1651 | 1651 | |
1652 | 1652 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1653 | 1653 | { |
@@ -1686,15 +1686,15 @@ discard block |
||
1686 | 1686 | global $global_query; |
1687 | 1687 | |
1688 | 1688 | date_default_timezone_set('UTC'); |
1689 | - $filter_query = $this->getFilter($filter,true,true); |
|
1689 | + $filter_query = $this->getFilter($filter, true, true); |
|
1690 | 1690 | $limit_query = ''; |
1691 | 1691 | |
1692 | 1692 | if ($limit != "") |
1693 | 1693 | { |
1694 | 1694 | $limit_array = explode(",", $limit); |
1695 | 1695 | |
1696 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1697 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1696 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1697 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1698 | 1698 | |
1699 | 1699 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1700 | 1700 | { |
@@ -1711,7 +1711,7 @@ discard block |
||
1711 | 1711 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
1712 | 1712 | } |
1713 | 1713 | |
1714 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
1714 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
1715 | 1715 | |
1716 | 1716 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
1717 | 1717 | |
@@ -1724,19 +1724,19 @@ discard block |
||
1724 | 1724 | * @return String the highlight text |
1725 | 1725 | * |
1726 | 1726 | */ |
1727 | - public function getHighlightByRegistration($registration,$filter = array()) |
|
1727 | + public function getHighlightByRegistration($registration, $filter = array()) |
|
1728 | 1728 | { |
1729 | 1729 | global $global_query; |
1730 | 1730 | |
1731 | 1731 | date_default_timezone_set('UTC'); |
1732 | - $filter_query = $this->getFilter($filter,true,true); |
|
1733 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
1732 | + $filter_query = $this->getFilter($filter, true, true); |
|
1733 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
1734 | 1734 | |
1735 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
1735 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
1736 | 1736 | $sth = $this->db->prepare($query); |
1737 | 1737 | $sth->execute(array(':registration' => $registration)); |
1738 | 1738 | |
1739 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1739 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1740 | 1740 | { |
1741 | 1741 | $highlight = $row['highlight']; |
1742 | 1742 | } |
@@ -1752,14 +1752,14 @@ discard block |
||
1752 | 1752 | * @return String usage |
1753 | 1753 | * |
1754 | 1754 | */ |
1755 | - public function getSquawkUsage($squawk = '',$country = 'FR') |
|
1755 | + public function getSquawkUsage($squawk = '', $country = 'FR') |
|
1756 | 1756 | { |
1757 | 1757 | |
1758 | - $squawk = filter_var($squawk,FILTER_SANITIZE_STRING); |
|
1759 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
1758 | + $squawk = filter_var($squawk, FILTER_SANITIZE_STRING); |
|
1759 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
1760 | 1760 | |
1761 | 1761 | $query = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1"; |
1762 | - $query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country); |
|
1762 | + $query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country); |
|
1763 | 1763 | |
1764 | 1764 | $sth = $this->db->prepare($query); |
1765 | 1765 | $sth->execute($query_values); |
@@ -1781,9 +1781,9 @@ discard block |
||
1781 | 1781 | public function getAirportIcao($airport_iata = '') |
1782 | 1782 | { |
1783 | 1783 | |
1784 | - $airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING); |
|
1784 | + $airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING); |
|
1785 | 1785 | |
1786 | - $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
1786 | + $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
1787 | 1787 | $query_values = array(':airport' => $airport_iata); |
1788 | 1788 | |
1789 | 1789 | $sth = $this->db->prepare($query); |
@@ -1805,12 +1805,12 @@ discard block |
||
1805 | 1805 | * @return Float distance to the airport |
1806 | 1806 | * |
1807 | 1807 | */ |
1808 | - public function getAirportDistance($airport_icao,$latitude,$longitude) |
|
1808 | + public function getAirportDistance($airport_icao, $latitude, $longitude) |
|
1809 | 1809 | { |
1810 | 1810 | |
1811 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
1811 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
1812 | 1812 | |
1813 | - $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
1813 | + $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
1814 | 1814 | $query_values = array(':airport' => $airport_icao); |
1815 | 1815 | $sth = $this->db->prepare($query); |
1816 | 1816 | $sth->execute($query_values); |
@@ -1820,7 +1820,7 @@ discard block |
||
1820 | 1820 | $airport_latitude = $row['latitude']; |
1821 | 1821 | $airport_longitude = $row['longitude']; |
1822 | 1822 | $Common = new Common(); |
1823 | - return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
|
1823 | + return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude); |
|
1824 | 1824 | } else return ''; |
1825 | 1825 | } |
1826 | 1826 | |
@@ -1834,11 +1834,11 @@ discard block |
||
1834 | 1834 | public function getAllAirportInfo($airport = '') |
1835 | 1835 | { |
1836 | 1836 | |
1837 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
1837 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
1838 | 1838 | |
1839 | 1839 | $query_values = array(); |
1840 | 1840 | if ($airport == 'NA') { |
1841 | - return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => '')); |
|
1841 | + return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => '')); |
|
1842 | 1842 | } elseif ($airport == '') { |
1843 | 1843 | $query = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport"; |
1844 | 1844 | } else { |
@@ -1886,14 +1886,14 @@ discard block |
||
1886 | 1886 | { |
1887 | 1887 | $lst_countries = ''; |
1888 | 1888 | foreach ($countries as $country) { |
1889 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
1889 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
1890 | 1890 | if ($lst_countries == '') { |
1891 | 1891 | $lst_countries = "'".$country."'"; |
1892 | 1892 | } else { |
1893 | 1893 | $lst_countries .= ",'".$country."'"; |
1894 | 1894 | } |
1895 | 1895 | } |
1896 | - $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
1896 | + $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
1897 | 1897 | |
1898 | 1898 | $sth = $this->db->prepare($query); |
1899 | 1899 | $sth->execute(); |
@@ -1901,7 +1901,7 @@ discard block |
||
1901 | 1901 | $airport_array = array(); |
1902 | 1902 | $temp_array = array(); |
1903 | 1903 | |
1904 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1904 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1905 | 1905 | { |
1906 | 1906 | $temp_array['name'] = $row['name']; |
1907 | 1907 | $temp_array['city'] = $row['city']; |
@@ -1929,10 +1929,10 @@ discard block |
||
1929 | 1929 | { |
1930 | 1930 | global $globalDBdriver; |
1931 | 1931 | if (is_array($coord)) { |
1932 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1933 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1934 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1935 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1932 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1933 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1934 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1935 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1936 | 1936 | } else return array(); |
1937 | 1937 | if ($globalDBdriver == 'mysql') { |
1938 | 1938 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
@@ -1944,7 +1944,7 @@ discard block |
||
1944 | 1944 | |
1945 | 1945 | $airport_array = array(); |
1946 | 1946 | |
1947 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1947 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1948 | 1948 | { |
1949 | 1949 | $temp_array = $row; |
1950 | 1950 | |
@@ -1964,13 +1964,13 @@ discard block |
||
1964 | 1964 | public function getAllWaypointsInfobyCoord($coord) |
1965 | 1965 | { |
1966 | 1966 | if (is_array($coord)) { |
1967 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1968 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1969 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1970 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1967 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1968 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1969 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1970 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1971 | 1971 | } else return array(); |
1972 | 1972 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
1973 | - $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
1973 | + $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
1974 | 1974 | //$query = "SELECT waypoints.* FROM waypoints"; |
1975 | 1975 | //$query = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end"; |
1976 | 1976 | //$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
@@ -1982,7 +1982,7 @@ discard block |
||
1982 | 1982 | |
1983 | 1983 | $waypoints_array = array(); |
1984 | 1984 | |
1985 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1985 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1986 | 1986 | { |
1987 | 1987 | $temp_array = $row; |
1988 | 1988 | |
@@ -2004,10 +2004,10 @@ discard block |
||
2004 | 2004 | { |
2005 | 2005 | global $globalUseRealAirlines; |
2006 | 2006 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
2007 | - $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
|
2007 | + $airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING)); |
|
2008 | 2008 | if ($airline_icao == 'NA') { |
2009 | 2009 | $airline_array = array(); |
2010 | - $airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
2010 | + $airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
2011 | 2011 | return $airline_array; |
2012 | 2012 | } else { |
2013 | 2013 | if (strlen($airline_icao) == 2) { |
@@ -2028,7 +2028,7 @@ discard block |
||
2028 | 2028 | if ($fromsource === NULL) { |
2029 | 2029 | $sth->execute(array(':airline_icao' => $airline_icao)); |
2030 | 2030 | } else { |
2031 | - $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
|
2031 | + $sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource)); |
|
2032 | 2032 | } |
2033 | 2033 | /* |
2034 | 2034 | $airline_array = array(); |
@@ -2070,12 +2070,12 @@ discard block |
||
2070 | 2070 | */ |
2071 | 2071 | public function getAllAircraftInfo($aircraft_type) |
2072 | 2072 | { |
2073 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
2073 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
2074 | 2074 | |
2075 | 2075 | if ($aircraft_type == 'NA') { |
2076 | - return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
2076 | + return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
2077 | 2077 | } |
2078 | - $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
2078 | + $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
2079 | 2079 | |
2080 | 2080 | $sth = $this->db->prepare($query); |
2081 | 2081 | $sth->execute(array(':aircraft_type' => $aircraft_type)); |
@@ -2107,7 +2107,7 @@ discard block |
||
2107 | 2107 | */ |
2108 | 2108 | public function getAircraftIcao($aircraft_type) |
2109 | 2109 | { |
2110 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
2110 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
2111 | 2111 | $all_aircraft = array('737-300' => 'B733', |
2112 | 2112 | '777-200' => 'B772', |
2113 | 2113 | '777-200ER' => 'B772', |
@@ -2119,10 +2119,10 @@ discard block |
||
2119 | 2119 | 'A380' => 'A388'); |
2120 | 2120 | if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
2121 | 2121 | |
2122 | - $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
2122 | + $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
2123 | 2123 | $aircraft_type = strtoupper($aircraft_type); |
2124 | 2124 | $sth = $this->db->prepare($query); |
2125 | - $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
|
2125 | + $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,)); |
|
2126 | 2126 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
2127 | 2127 | if (isset($result[0]['icao'])) return $result[0]['icao']; |
2128 | 2128 | else return ''; |
@@ -2137,9 +2137,9 @@ discard block |
||
2137 | 2137 | */ |
2138 | 2138 | public function getAllAircraftType($aircraft_modes) |
2139 | 2139 | { |
2140 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
2140 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
2141 | 2141 | |
2142 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
2142 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
2143 | 2143 | |
2144 | 2144 | $sth = $this->db->prepare($query); |
2145 | 2145 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -2160,8 +2160,8 @@ discard block |
||
2160 | 2160 | */ |
2161 | 2161 | public function getOperator($operator) |
2162 | 2162 | { |
2163 | - $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
|
2164 | - $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
2163 | + $operator = filter_var($operator, FILTER_SANITIZE_STRING); |
|
2164 | + $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
2165 | 2165 | |
2166 | 2166 | $sth = $this->db->prepare($query); |
2167 | 2167 | $sth->execute(array(':operator' => $operator)); |
@@ -2182,9 +2182,9 @@ discard block |
||
2182 | 2182 | */ |
2183 | 2183 | public function getRouteInfo($callsign) |
2184 | 2184 | { |
2185 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
2185 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
2186 | 2186 | if ($callsign == '') return array(); |
2187 | - $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
2187 | + $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
2188 | 2188 | |
2189 | 2189 | $sth = $this->db->prepare($query); |
2190 | 2190 | $sth->execute(array(':callsign' => $callsign)); |
@@ -2205,9 +2205,9 @@ discard block |
||
2205 | 2205 | */ |
2206 | 2206 | public function getAircraftInfoByRegistration($registration) |
2207 | 2207 | { |
2208 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
2208 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
2209 | 2209 | |
2210 | - $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
2210 | + $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
2211 | 2211 | |
2212 | 2212 | $sth = $this->db->prepare($query); |
2213 | 2213 | $sth->execute(array(':registration' => $registration)); |
@@ -2215,7 +2215,7 @@ discard block |
||
2215 | 2215 | $aircraft_array = array(); |
2216 | 2216 | $temp_array = array(); |
2217 | 2217 | |
2218 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2218 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2219 | 2219 | { |
2220 | 2220 | $temp_array['airline_icao'] = $row['airline_icao']; |
2221 | 2221 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -2237,7 +2237,7 @@ discard block |
||
2237 | 2237 | */ |
2238 | 2238 | public function getAircraftOwnerByRegistration($registration) |
2239 | 2239 | { |
2240 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
2240 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
2241 | 2241 | $Connection = new Connection($this->db); |
2242 | 2242 | if ($Connection->tableExists('aircraft_owner')) { |
2243 | 2243 | $query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1"; |
@@ -2259,7 +2259,7 @@ discard block |
||
2259 | 2259 | public function getAllFlightsforSitemap() |
2260 | 2260 | { |
2261 | 2261 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
2262 | - $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
2262 | + $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
2263 | 2263 | |
2264 | 2264 | $sth = $this->db->prepare($query); |
2265 | 2265 | $sth->execute(); |
@@ -2306,7 +2306,7 @@ discard block |
||
2306 | 2306 | $manufacturer_array = array(); |
2307 | 2307 | $temp_array = array(); |
2308 | 2308 | |
2309 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2309 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2310 | 2310 | { |
2311 | 2311 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
2312 | 2312 | |
@@ -2332,7 +2332,7 @@ discard block |
||
2332 | 2332 | ORDER BY spotter_output.aircraft_name ASC"; |
2333 | 2333 | |
2334 | 2334 | */ |
2335 | - $filter_query = $this->getFilter($filters,true,true); |
|
2335 | + $filter_query = $this->getFilter($filters, true, true); |
|
2336 | 2336 | $query = "SELECT DISTINCT icao AS aircraft_icao, type AS aircraft_name, manufacturer AS aircraft_manufacturer FROM aircraft".$filter_query." icao <> '' ORDER BY aircraft_manufacturer ASC"; |
2337 | 2337 | |
2338 | 2338 | $sth = $this->db->prepare($query); |
@@ -2341,7 +2341,7 @@ discard block |
||
2341 | 2341 | $aircraft_array = array(); |
2342 | 2342 | $temp_array = array(); |
2343 | 2343 | |
2344 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2344 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2345 | 2345 | { |
2346 | 2346 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
2347 | 2347 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
@@ -2362,8 +2362,8 @@ discard block |
||
2362 | 2362 | */ |
2363 | 2363 | public function getAllAircraftRegistrations($filters = array()) |
2364 | 2364 | { |
2365 | - $filter_query = $this->getFilter($filters,true,true); |
|
2366 | - $query = "SELECT DISTINCT spotter_output.registration |
|
2365 | + $filter_query = $this->getFilter($filters, true, true); |
|
2366 | + $query = "SELECT DISTINCT spotter_output.registration |
|
2367 | 2367 | FROM spotter_output".$filter_query." spotter_output.registration <> '' |
2368 | 2368 | ORDER BY spotter_output.registration ASC"; |
2369 | 2369 | |
@@ -2373,7 +2373,7 @@ discard block |
||
2373 | 2373 | $aircraft_array = array(); |
2374 | 2374 | $temp_array = array(); |
2375 | 2375 | |
2376 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2376 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2377 | 2377 | { |
2378 | 2378 | $temp_array['registration'] = $row['registration']; |
2379 | 2379 | |
@@ -2390,11 +2390,11 @@ discard block |
||
2390 | 2390 | * @return Array list of source name |
2391 | 2391 | * |
2392 | 2392 | */ |
2393 | - public function getAllSourceName($type = '',$filters = array()) |
|
2393 | + public function getAllSourceName($type = '', $filters = array()) |
|
2394 | 2394 | { |
2395 | - $filter_query = $this->getFilter($filters,true,true); |
|
2395 | + $filter_query = $this->getFilter($filters, true, true); |
|
2396 | 2396 | $query_values = array(); |
2397 | - $query = "SELECT DISTINCT spotter_output.source_name |
|
2397 | + $query = "SELECT DISTINCT spotter_output.source_name |
|
2398 | 2398 | FROM spotter_output".$filter_query." spotter_output.source_name <> ''"; |
2399 | 2399 | if ($type != '') { |
2400 | 2400 | $query_values = array(':type' => $type); |
@@ -2409,7 +2409,7 @@ discard block |
||
2409 | 2409 | $source_array = array(); |
2410 | 2410 | $temp_array = array(); |
2411 | 2411 | |
2412 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2412 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2413 | 2413 | { |
2414 | 2414 | $temp_array['source_name'] = $row['source_name']; |
2415 | 2415 | $source_array[] = $temp_array; |
@@ -2425,11 +2425,11 @@ discard block |
||
2425 | 2425 | * @return Array list of airline names |
2426 | 2426 | * |
2427 | 2427 | */ |
2428 | - public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
|
2428 | + public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array()) |
|
2429 | 2429 | { |
2430 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
2431 | - $filter_query = $this->getFilter($filters,true,true); |
|
2432 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
2430 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
2431 | + $filter_query = $this->getFilter($filters, true, true); |
|
2432 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
2433 | 2433 | if ($airline_type == '' || $airline_type == 'all') { |
2434 | 2434 | /* |
2435 | 2435 | $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
@@ -2448,7 +2448,7 @@ discard block |
||
2448 | 2448 | $query_data = array(':forsource' => $forsource); |
2449 | 2449 | } |
2450 | 2450 | } else { |
2451 | - $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
2451 | + $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
2452 | 2452 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
2453 | 2453 | AND spotter_output.airline_type = :airline_type |
2454 | 2454 | ORDER BY spotter_output.airline_icao ASC"; |
@@ -2461,7 +2461,7 @@ discard block |
||
2461 | 2461 | $airline_array = array(); |
2462 | 2462 | $temp_array = array(); |
2463 | 2463 | |
2464 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2464 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2465 | 2465 | { |
2466 | 2466 | $temp_array['airline_icao'] = $row['airline_icao']; |
2467 | 2467 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -2481,8 +2481,8 @@ discard block |
||
2481 | 2481 | */ |
2482 | 2482 | public function getAllAirlineCountries($filters = array()) |
2483 | 2483 | { |
2484 | - $filter_query = $this->getFilter($filters,true,true); |
|
2485 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
2484 | + $filter_query = $this->getFilter($filters, true, true); |
|
2485 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
2486 | 2486 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
2487 | 2487 | ORDER BY spotter_output.airline_country ASC"; |
2488 | 2488 | |
@@ -2493,7 +2493,7 @@ discard block |
||
2493 | 2493 | $airline_array = array(); |
2494 | 2494 | $temp_array = array(); |
2495 | 2495 | |
2496 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2496 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2497 | 2497 | { |
2498 | 2498 | $temp_array['airline_country'] = $row['airline_country']; |
2499 | 2499 | |
@@ -2513,9 +2513,9 @@ discard block |
||
2513 | 2513 | */ |
2514 | 2514 | public function getAllAirportNames($filters = array()) |
2515 | 2515 | { |
2516 | - $filter_query = $this->getFilter($filters,true,true); |
|
2516 | + $filter_query = $this->getFilter($filters, true, true); |
|
2517 | 2517 | $airport_array = array(); |
2518 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
2518 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
2519 | 2519 | FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' |
2520 | 2520 | ORDER BY spotter_output.departure_airport_city ASC"; |
2521 | 2521 | |
@@ -2524,7 +2524,7 @@ discard block |
||
2524 | 2524 | $sth->execute(); |
2525 | 2525 | |
2526 | 2526 | $temp_array = array(); |
2527 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2527 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2528 | 2528 | { |
2529 | 2529 | $temp_array['airport_icao'] = $row['airport_icao']; |
2530 | 2530 | $temp_array['airport_name'] = $row['airport_name']; |
@@ -2534,14 +2534,14 @@ discard block |
||
2534 | 2534 | $airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array; |
2535 | 2535 | } |
2536 | 2536 | |
2537 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
2537 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
2538 | 2538 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' |
2539 | 2539 | ORDER BY spotter_output.arrival_airport_city ASC"; |
2540 | 2540 | |
2541 | 2541 | $sth = $this->db->prepare($query); |
2542 | 2542 | $sth->execute(); |
2543 | 2543 | |
2544 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2544 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2545 | 2545 | { |
2546 | 2546 | // if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao']) |
2547 | 2547 | // { |
@@ -2581,21 +2581,21 @@ discard block |
||
2581 | 2581 | |
2582 | 2582 | $temp_array = array(); |
2583 | 2583 | |
2584 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2584 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2585 | 2585 | { |
2586 | 2586 | $temp_array['airport_country'] = $row['airport_country']; |
2587 | 2587 | |
2588 | 2588 | $airport_array[$row['airport_country']] = $temp_array; |
2589 | 2589 | } |
2590 | - $filter_query = $this->getFilter($filters,true,true); |
|
2591 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
2590 | + $filter_query = $this->getFilter($filters, true, true); |
|
2591 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
2592 | 2592 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
2593 | 2593 | ORDER BY spotter_output.arrival_airport_country ASC"; |
2594 | 2594 | |
2595 | 2595 | $sth = $this->db->prepare($query); |
2596 | 2596 | $sth->execute(); |
2597 | 2597 | |
2598 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2598 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2599 | 2599 | { |
2600 | 2600 | if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country']) |
2601 | 2601 | { |
@@ -2618,9 +2618,9 @@ discard block |
||
2618 | 2618 | */ |
2619 | 2619 | public function getAllCountries($filters = array()) |
2620 | 2620 | { |
2621 | - $Connection= new Connection($this->db); |
|
2621 | + $Connection = new Connection($this->db); |
|
2622 | 2622 | if ($Connection->tableExists('countries')) { |
2623 | - $query = "SELECT countries.name AS airport_country |
|
2623 | + $query = "SELECT countries.name AS airport_country |
|
2624 | 2624 | FROM countries |
2625 | 2625 | ORDER BY countries.name ASC"; |
2626 | 2626 | $sth = $this->db->prepare($query); |
@@ -2629,14 +2629,14 @@ discard block |
||
2629 | 2629 | $temp_array = array(); |
2630 | 2630 | $country_array = array(); |
2631 | 2631 | |
2632 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2632 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2633 | 2633 | { |
2634 | 2634 | $temp_array['country'] = $row['airport_country']; |
2635 | 2635 | $country_array[$row['airport_country']] = $temp_array; |
2636 | 2636 | } |
2637 | 2637 | } else { |
2638 | - $filter_query = $this->getFilter($filters,true,true); |
|
2639 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
2638 | + $filter_query = $this->getFilter($filters, true, true); |
|
2639 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
2640 | 2640 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' |
2641 | 2641 | ORDER BY spotter_output.departure_airport_country ASC"; |
2642 | 2642 | |
@@ -2645,20 +2645,20 @@ discard block |
||
2645 | 2645 | |
2646 | 2646 | $temp_array = array(); |
2647 | 2647 | $country_array = array(); |
2648 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2648 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2649 | 2649 | { |
2650 | 2650 | $temp_array['country'] = $row['airport_country']; |
2651 | 2651 | $country_array[$row['airport_country']] = $temp_array; |
2652 | 2652 | } |
2653 | 2653 | |
2654 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
2654 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
2655 | 2655 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
2656 | 2656 | ORDER BY spotter_output.arrival_airport_country ASC"; |
2657 | 2657 | |
2658 | 2658 | $sth = $this->db->prepare($query); |
2659 | 2659 | $sth->execute(); |
2660 | 2660 | |
2661 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2661 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2662 | 2662 | { |
2663 | 2663 | if ($country_array[$row['airport_country']]['country'] != $row['airport_country']) |
2664 | 2664 | { |
@@ -2668,14 +2668,14 @@ discard block |
||
2668 | 2668 | } |
2669 | 2669 | } |
2670 | 2670 | |
2671 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
2671 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
2672 | 2672 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
2673 | 2673 | ORDER BY spotter_output.airline_country ASC"; |
2674 | 2674 | |
2675 | 2675 | $sth = $this->db->prepare($query); |
2676 | 2676 | $sth->execute(); |
2677 | 2677 | |
2678 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2678 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2679 | 2679 | { |
2680 | 2680 | if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country']) |
2681 | 2681 | { |
@@ -2699,8 +2699,8 @@ discard block |
||
2699 | 2699 | */ |
2700 | 2700 | public function getAllIdents($filters = array()) |
2701 | 2701 | { |
2702 | - $filter_query = $this->getFilter($filters,true,true); |
|
2703 | - $query = "SELECT DISTINCT spotter_output.ident |
|
2702 | + $filter_query = $this->getFilter($filters, true, true); |
|
2703 | + $query = "SELECT DISTINCT spotter_output.ident |
|
2704 | 2704 | FROM spotter_output".$filter_query." spotter_output.ident <> '' |
2705 | 2705 | ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0"; |
2706 | 2706 | |
@@ -2710,7 +2710,7 @@ discard block |
||
2710 | 2710 | $ident_array = array(); |
2711 | 2711 | $temp_array = array(); |
2712 | 2712 | |
2713 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2713 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2714 | 2714 | { |
2715 | 2715 | $temp_array['ident'] = $row['ident']; |
2716 | 2716 | $ident_array[] = $temp_array; |
@@ -2724,9 +2724,9 @@ discard block |
||
2724 | 2724 | * @return Array number, icao, name and city of airports |
2725 | 2725 | */ |
2726 | 2726 | |
2727 | - public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
|
2727 | + public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) { |
|
2728 | 2728 | global $globalTimezone, $globalDBdriver; |
2729 | - $filter_query = $this->getFilter($filters,true,true); |
|
2729 | + $filter_query = $this->getFilter($filters, true, true); |
|
2730 | 2730 | if ($globalTimezone != '') { |
2731 | 2731 | date_default_timezone_set($globalTimezone); |
2732 | 2732 | $datetime = new DateTime(); |
@@ -2791,7 +2791,7 @@ discard block |
||
2791 | 2791 | |
2792 | 2792 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
2793 | 2793 | global $globalTimezone, $globalDBdriver; |
2794 | - $filter_query = $this->getFilter($filters,true,true); |
|
2794 | + $filter_query = $this->getFilter($filters, true, true); |
|
2795 | 2795 | if ($globalTimezone != '') { |
2796 | 2796 | date_default_timezone_set($globalTimezone); |
2797 | 2797 | $datetime = new DateTime(); |
@@ -2875,7 +2875,7 @@ discard block |
||
2875 | 2875 | |
2876 | 2876 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
2877 | 2877 | global $globalTimezone, $globalDBdriver; |
2878 | - $filter_query = $this->getFilter($filters,true,true); |
|
2878 | + $filter_query = $this->getFilter($filters, true, true); |
|
2879 | 2879 | if ($globalTimezone != '') { |
2880 | 2880 | date_default_timezone_set($globalTimezone); |
2881 | 2881 | $datetime = new DateTime(); |
@@ -2908,9 +2908,9 @@ discard block |
||
2908 | 2908 | * @return Array number, icao, name and city of airports |
2909 | 2909 | */ |
2910 | 2910 | |
2911 | - public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
|
2911 | + public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) { |
|
2912 | 2912 | global $globalTimezone, $globalDBdriver; |
2913 | - $filter_query = $this->getFilter($filters,true,true); |
|
2913 | + $filter_query = $this->getFilter($filters, true, true); |
|
2914 | 2914 | if ($globalTimezone != '') { |
2915 | 2915 | date_default_timezone_set($globalTimezone); |
2916 | 2916 | $datetime = new DateTime(); |
@@ -3042,12 +3042,12 @@ discard block |
||
3042 | 3042 | } else $offset = '+00:00'; |
3043 | 3043 | |
3044 | 3044 | if ($globalDBdriver == 'mysql') { |
3045 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
3045 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
3046 | 3046 | FROM spotter_output |
3047 | 3047 | WHERE spotter_output.date <> '' |
3048 | 3048 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
3049 | 3049 | } else { |
3050 | - $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
3050 | + $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
3051 | 3051 | FROM spotter_output |
3052 | 3052 | WHERE spotter_output.date <> '' |
3053 | 3053 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
@@ -3059,7 +3059,7 @@ discard block |
||
3059 | 3059 | $date_array = array(); |
3060 | 3060 | $temp_array = array(); |
3061 | 3061 | |
3062 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3062 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3063 | 3063 | { |
3064 | 3064 | $temp_array['date'] = $row['date']; |
3065 | 3065 | |
@@ -3079,7 +3079,7 @@ discard block |
||
3079 | 3079 | */ |
3080 | 3080 | public function getAllRoutes() |
3081 | 3081 | { |
3082 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
3082 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
3083 | 3083 | FROM spotter_output |
3084 | 3084 | WHERE spotter_output.ident <> '' |
3085 | 3085 | GROUP BY route |
@@ -3090,7 +3090,7 @@ discard block |
||
3090 | 3090 | |
3091 | 3091 | $routes_array = array(); |
3092 | 3092 | $temp_array = array(); |
3093 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3093 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3094 | 3094 | { |
3095 | 3095 | $temp_array['route'] = $row['route']; |
3096 | 3096 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -3109,21 +3109,21 @@ discard block |
||
3109 | 3109 | * @return String success or false |
3110 | 3110 | * |
3111 | 3111 | */ |
3112 | - public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
|
3112 | + public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL) |
|
3113 | 3113 | { |
3114 | 3114 | if (!is_numeric(substr($ident, 0, 3))) |
3115 | 3115 | { |
3116 | 3116 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
3117 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
3117 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
3118 | 3118 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
3119 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
3119 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
3120 | 3120 | } else { |
3121 | 3121 | $airline_array = $this->getAllAirlineInfo("NA"); |
3122 | 3122 | } |
3123 | 3123 | if (count($airline_array) == 0) { |
3124 | 3124 | $airline_array = $this->getAllAirlineInfo("NA"); |
3125 | 3125 | } |
3126 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
3126 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
3127 | 3127 | $airline_array = $this->getAllAirlineInfo("NA"); |
3128 | 3128 | } |
3129 | 3129 | } else { |
@@ -3136,7 +3136,7 @@ discard block |
||
3136 | 3136 | |
3137 | 3137 | |
3138 | 3138 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
3139 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
3139 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type); |
|
3140 | 3140 | |
3141 | 3141 | try { |
3142 | 3142 | $sth = $this->db->prepare($query); |
@@ -3157,11 +3157,11 @@ discard block |
||
3157 | 3157 | * @return String success or false |
3158 | 3158 | * |
3159 | 3159 | */ |
3160 | - public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
|
3160 | + public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '') |
|
3161 | 3161 | { |
3162 | 3162 | if ($groundspeed == '') $groundspeed = NULL; |
3163 | 3163 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
3164 | - $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
3164 | + $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
3165 | 3165 | |
3166 | 3166 | try { |
3167 | 3167 | $sth = $this->db->prepare($query); |
@@ -3201,7 +3201,7 @@ discard block |
||
3201 | 3201 | * @param String $verticalrate vertival rate of flight |
3202 | 3202 | * @return String success or false |
3203 | 3203 | */ |
3204 | - public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
|
3204 | + public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '') |
|
3205 | 3205 | { |
3206 | 3206 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
3207 | 3207 | |
@@ -3225,13 +3225,13 @@ discard block |
||
3225 | 3225 | if ($ModeS != '') { |
3226 | 3226 | $timeelapsed = microtime(true); |
3227 | 3227 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
3228 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3228 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3229 | 3229 | } else { |
3230 | - $myhex = explode('-',$flightaware_id); |
|
3230 | + $myhex = explode('-', $flightaware_id); |
|
3231 | 3231 | if (count($myhex) > 0) { |
3232 | 3232 | $timeelapsed = microtime(true); |
3233 | 3233 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
3234 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3234 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3235 | 3235 | } |
3236 | 3236 | } |
3237 | 3237 | } |
@@ -3253,24 +3253,24 @@ discard block |
||
3253 | 3253 | { |
3254 | 3254 | $timeelapsed = microtime(true); |
3255 | 3255 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
3256 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
3256 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
3257 | 3257 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
3258 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
3258 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
3259 | 3259 | } else { |
3260 | 3260 | $airline_array = $this->getAllAirlineInfo("NA"); |
3261 | 3261 | } |
3262 | 3262 | if (count($airline_array) == 0) { |
3263 | 3263 | $airline_array = $this->getAllAirlineInfo("NA"); |
3264 | 3264 | } |
3265 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
3265 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
3266 | 3266 | $airline_array = $this->getAllAirlineInfo("NA"); |
3267 | 3267 | } |
3268 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3268 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3269 | 3269 | |
3270 | 3270 | } else { |
3271 | 3271 | $timeelapsed = microtime(true); |
3272 | 3272 | $airline_array = $this->getAllAirlineInfo("NA"); |
3273 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3273 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3274 | 3274 | } |
3275 | 3275 | } |
3276 | 3276 | } else $airline_array = array(); |
@@ -3287,27 +3287,27 @@ discard block |
||
3287 | 3287 | { |
3288 | 3288 | $timeelapsed = microtime(true); |
3289 | 3289 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3290 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3290 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3291 | 3291 | } else { |
3292 | 3292 | $timeelapsed = microtime(true); |
3293 | 3293 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3294 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3294 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3295 | 3295 | } |
3296 | 3296 | } |
3297 | 3297 | } else { |
3298 | 3298 | if ($ModeS != '') { |
3299 | 3299 | $timeelapsed = microtime(true); |
3300 | 3300 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
3301 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3301 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3302 | 3302 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
3303 | 3303 | { |
3304 | 3304 | $timeelapsed = microtime(true); |
3305 | 3305 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3306 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3306 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3307 | 3307 | } else { |
3308 | 3308 | $timeelapsed = microtime(true); |
3309 | 3309 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3310 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3310 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3311 | 3311 | } |
3312 | 3312 | } |
3313 | 3313 | } |
@@ -3322,7 +3322,7 @@ discard block |
||
3322 | 3322 | } else { |
3323 | 3323 | $timeelapsed = microtime(true); |
3324 | 3324 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
3325 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3325 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3326 | 3326 | } |
3327 | 3327 | } |
3328 | 3328 | |
@@ -3336,7 +3336,7 @@ discard block |
||
3336 | 3336 | } else { |
3337 | 3337 | $timeelapsed = microtime(true); |
3338 | 3338 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
3339 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3339 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3340 | 3340 | } |
3341 | 3341 | } |
3342 | 3342 | |
@@ -3400,7 +3400,7 @@ discard block |
||
3400 | 3400 | { |
3401 | 3401 | $timeelapsed = microtime(true); |
3402 | 3402 | $image_array = $Image->getSpotterImage($registration); |
3403 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3403 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3404 | 3404 | if (!isset($image_array[0]['registration'])) |
3405 | 3405 | { |
3406 | 3406 | //echo "Add image !!!! \n"; |
@@ -3408,7 +3408,7 @@ discard block |
||
3408 | 3408 | } |
3409 | 3409 | $timeelapsed = microtime(true); |
3410 | 3410 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
3411 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3411 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3412 | 3412 | if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
3413 | 3413 | } |
3414 | 3414 | |
@@ -3416,33 +3416,33 @@ discard block |
||
3416 | 3416 | { |
3417 | 3417 | if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
3418 | 3418 | else $airline_icao = ''; |
3419 | - $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
3419 | + $image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
3420 | 3420 | if (!isset($image_array[0]['registration'])) |
3421 | 3421 | { |
3422 | 3422 | //echo "Add image !!!! \n"; |
3423 | - $Image->addSpotterImage('',$aircraft_icao,$airline_icao); |
|
3423 | + $Image->addSpotterImage('', $aircraft_icao, $airline_icao); |
|
3424 | 3424 | } |
3425 | 3425 | } |
3426 | 3426 | |
3427 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
3428 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
3429 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
3430 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
3431 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
3432 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
3433 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
3434 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
3435 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
3436 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
3437 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
3438 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
3439 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
3440 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
3441 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
3442 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
3443 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
3444 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
3445 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
3427 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
3428 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
3429 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
3430 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
3431 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
3432 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
3433 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
3434 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
3435 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
3436 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
3437 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
3438 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
3439 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
3440 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
3441 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
3442 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
3443 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
3444 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
3445 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
3446 | 3446 | |
3447 | 3447 | if (count($airline_array) == 0) |
3448 | 3448 | { |
@@ -3470,7 +3470,7 @@ discard block |
||
3470 | 3470 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
3471 | 3471 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
3472 | 3472 | if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
3473 | - $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
3473 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
3474 | 3474 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
3475 | 3475 | |
3476 | 3476 | $airline_name = $airline_array[0]['name']; |
@@ -3480,7 +3480,7 @@ discard block |
||
3480 | 3480 | if ($airline_type == '') { |
3481 | 3481 | $timeelapsed = microtime(true); |
3482 | 3482 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
3483 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3483 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
3484 | 3484 | } |
3485 | 3485 | if ($airline_type == null) $airline_type = ''; |
3486 | 3486 | $aircraft_type = $aircraft_array[0]['type']; |
@@ -3491,7 +3491,7 @@ discard block |
||
3491 | 3491 | $arrival_airport_name = $arrival_airport_array[0]['name']; |
3492 | 3492 | $arrival_airport_city = $arrival_airport_array[0]['city']; |
3493 | 3493 | $arrival_airport_country = $arrival_airport_array[0]['country']; |
3494 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
3494 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
3495 | 3495 | |
3496 | 3496 | try { |
3497 | 3497 | |
@@ -3517,13 +3517,13 @@ discard block |
||
3517 | 3517 | { |
3518 | 3518 | global $globalDBdriver, $globalTimezone; |
3519 | 3519 | if ($globalDBdriver == 'mysql') { |
3520 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
3520 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
3521 | 3521 | WHERE spotter_output.ident = :ident |
3522 | 3522 | AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
3523 | 3523 | AND spotter_output.date < UTC_TIMESTAMP()"; |
3524 | 3524 | $query_data = array(':ident' => $ident); |
3525 | 3525 | } else { |
3526 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
3526 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
3527 | 3527 | WHERE spotter_output.ident = :ident |
3528 | 3528 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
3529 | 3529 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -3532,8 +3532,8 @@ discard block |
||
3532 | 3532 | |
3533 | 3533 | $sth = $this->db->prepare($query); |
3534 | 3534 | $sth->execute($query_data); |
3535 | - $ident_result=''; |
|
3536 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3535 | + $ident_result = ''; |
|
3536 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3537 | 3537 | { |
3538 | 3538 | $ident_result = $row['ident']; |
3539 | 3539 | } |
@@ -3559,8 +3559,8 @@ discard block |
||
3559 | 3559 | return false; |
3560 | 3560 | } else { |
3561 | 3561 | $q_array = explode(" ", $q); |
3562 | - foreach ($q_array as $q_item){ |
|
3563 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
3562 | + foreach ($q_array as $q_item) { |
|
3563 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
3564 | 3564 | $additional_query .= " AND ("; |
3565 | 3565 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
3566 | 3566 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
@@ -3575,11 +3575,11 @@ discard block |
||
3575 | 3575 | } |
3576 | 3576 | } |
3577 | 3577 | if ($globalDBdriver == 'mysql') { |
3578 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
3578 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
3579 | 3579 | WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
3580 | 3580 | AND spotter_output.date < UTC_TIMESTAMP()"; |
3581 | 3581 | } else { |
3582 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
3582 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
3583 | 3583 | WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
3584 | 3584 | AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
3585 | 3585 | } |
@@ -3596,11 +3596,11 @@ discard block |
||
3596 | 3596 | * @return Array the airline list |
3597 | 3597 | * |
3598 | 3598 | */ |
3599 | - public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
3599 | + public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
3600 | 3600 | { |
3601 | 3601 | global $globalDBdriver; |
3602 | - $filter_query = $this->getFilter($filters,true,true); |
|
3603 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3602 | + $filter_query = $this->getFilter($filters, true, true); |
|
3603 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3604 | 3604 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' "; |
3605 | 3605 | if ($olderthanmonths > 0) { |
3606 | 3606 | if ($globalDBdriver == 'mysql') { |
@@ -3624,7 +3624,7 @@ discard block |
||
3624 | 3624 | |
3625 | 3625 | $airline_array = array(); |
3626 | 3626 | $temp_array = array(); |
3627 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3627 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3628 | 3628 | { |
3629 | 3629 | $temp_array['airline_name'] = $row['airline_name']; |
3630 | 3630 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3641,11 +3641,11 @@ discard block |
||
3641 | 3641 | * @return Array the pilots list |
3642 | 3642 | * |
3643 | 3643 | */ |
3644 | - public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
3644 | + public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
3645 | 3645 | { |
3646 | 3646 | global $globalDBdriver; |
3647 | - $filter_query = $this->getFilter($filters,true,true); |
|
3648 | - $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
|
3647 | + $filter_query = $this->getFilter($filters, true, true); |
|
3648 | + $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
|
3649 | 3649 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
3650 | 3650 | if ($olderthanmonths > 0) { |
3651 | 3651 | if ($globalDBdriver == 'mysql') { |
@@ -3671,7 +3671,7 @@ discard block |
||
3671 | 3671 | $airline_array = array(); |
3672 | 3672 | $temp_array = array(); |
3673 | 3673 | |
3674 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3674 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3675 | 3675 | { |
3676 | 3676 | $temp_array['pilot_name'] = $row['pilot_name']; |
3677 | 3677 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3690,7 +3690,7 @@ discard block |
||
3690 | 3690 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
3691 | 3691 | { |
3692 | 3692 | global $globalDBdriver; |
3693 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
|
3693 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
|
3694 | 3694 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
3695 | 3695 | if ($olderthanmonths > 0) { |
3696 | 3696 | if ($globalDBdriver == 'mysql') { |
@@ -3716,7 +3716,7 @@ discard block |
||
3716 | 3716 | $airline_array = array(); |
3717 | 3717 | $temp_array = array(); |
3718 | 3718 | |
3719 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3719 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3720 | 3720 | { |
3721 | 3721 | $temp_array['pilot_name'] = $row['pilot_name']; |
3722 | 3722 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3733,11 +3733,11 @@ discard block |
||
3733 | 3733 | * @return Array the pilots list |
3734 | 3734 | * |
3735 | 3735 | */ |
3736 | - public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
3736 | + public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
3737 | 3737 | { |
3738 | 3738 | global $globalDBdriver; |
3739 | - $filter_query = $this->getFilter($filters,true,true); |
|
3740 | - $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
3739 | + $filter_query = $this->getFilter($filters, true, true); |
|
3740 | + $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
3741 | 3741 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
3742 | 3742 | if ($olderthanmonths > 0) { |
3743 | 3743 | if ($globalDBdriver == 'mysql') { |
@@ -3763,7 +3763,7 @@ discard block |
||
3763 | 3763 | $airline_array = array(); |
3764 | 3764 | $temp_array = array(); |
3765 | 3765 | |
3766 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3766 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3767 | 3767 | { |
3768 | 3768 | $temp_array['owner_name'] = $row['owner_name']; |
3769 | 3769 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3778,11 +3778,11 @@ discard block |
||
3778 | 3778 | * @return Array the pilots list |
3779 | 3779 | * |
3780 | 3780 | */ |
3781 | - public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
3781 | + public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
3782 | 3782 | { |
3783 | 3783 | global $globalDBdriver; |
3784 | - $filter_query = $this->getFilter($filters,true,true); |
|
3785 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
3784 | + $filter_query = $this->getFilter($filters, true, true); |
|
3785 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
3786 | 3786 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
3787 | 3787 | if ($olderthanmonths > 0) { |
3788 | 3788 | if ($globalDBdriver == 'mysql') { |
@@ -3808,7 +3808,7 @@ discard block |
||
3808 | 3808 | $airline_array = array(); |
3809 | 3809 | $temp_array = array(); |
3810 | 3810 | |
3811 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3811 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3812 | 3812 | { |
3813 | 3813 | $temp_array['owner_name'] = $row['owner_name']; |
3814 | 3814 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3824,11 +3824,11 @@ discard block |
||
3824 | 3824 | * @return Array the airline list |
3825 | 3825 | * |
3826 | 3826 | */ |
3827 | - public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
|
3827 | + public function countAllAirlinesByAircraft($aircraft_icao, $filters = array()) |
|
3828 | 3828 | { |
3829 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
3830 | - $filter_query = $this->getFilter($filters,true,true); |
|
3831 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3829 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
3830 | + $filter_query = $this->getFilter($filters, true, true); |
|
3831 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3832 | 3832 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
3833 | 3833 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
3834 | 3834 | ORDER BY airline_count DESC"; |
@@ -3840,7 +3840,7 @@ discard block |
||
3840 | 3840 | $airline_array = array(); |
3841 | 3841 | $temp_array = array(); |
3842 | 3842 | |
3843 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3843 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3844 | 3844 | { |
3845 | 3845 | $temp_array['airline_name'] = $row['airline_name']; |
3846 | 3846 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3860,11 +3860,11 @@ discard block |
||
3860 | 3860 | * @return Array the airline country list |
3861 | 3861 | * |
3862 | 3862 | */ |
3863 | - public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
|
3863 | + public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array()) |
|
3864 | 3864 | { |
3865 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
3866 | - $filter_query = $this->getFilter($filters,true,true); |
|
3867 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
3865 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
3866 | + $filter_query = $this->getFilter($filters, true, true); |
|
3867 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
3868 | 3868 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
3869 | 3869 | GROUP BY spotter_output.airline_country |
3870 | 3870 | ORDER BY airline_country_count DESC |
@@ -3877,7 +3877,7 @@ discard block |
||
3877 | 3877 | $airline_country_array = array(); |
3878 | 3878 | $temp_array = array(); |
3879 | 3879 | |
3880 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3880 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3881 | 3881 | { |
3882 | 3882 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
3883 | 3883 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -3896,11 +3896,11 @@ discard block |
||
3896 | 3896 | * @return Array the airline list |
3897 | 3897 | * |
3898 | 3898 | */ |
3899 | - public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
|
3899 | + public function countAllAirlinesByAirport($airport_icao, $filters = array()) |
|
3900 | 3900 | { |
3901 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
3902 | - $filter_query = $this->getFilter($filters,true,true); |
|
3903 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3901 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
3902 | + $filter_query = $this->getFilter($filters, true, true); |
|
3903 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3904 | 3904 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
3905 | 3905 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
3906 | 3906 | ORDER BY airline_count DESC"; |
@@ -3912,7 +3912,7 @@ discard block |
||
3912 | 3912 | $airline_array = array(); |
3913 | 3913 | $temp_array = array(); |
3914 | 3914 | |
3915 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3915 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3916 | 3916 | { |
3917 | 3917 | $temp_array['airline_name'] = $row['airline_name']; |
3918 | 3918 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3931,11 +3931,11 @@ discard block |
||
3931 | 3931 | * @return Array the airline country list |
3932 | 3932 | * |
3933 | 3933 | */ |
3934 | - public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
|
3934 | + public function countAllAirlineCountriesByAirport($airport_icao, $filters = array()) |
|
3935 | 3935 | { |
3936 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
3937 | - $filter_query = $this->getFilter($filters,true,true); |
|
3938 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
3936 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
3937 | + $filter_query = $this->getFilter($filters, true, true); |
|
3938 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
3939 | 3939 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
3940 | 3940 | GROUP BY spotter_output.airline_country |
3941 | 3941 | ORDER BY airline_country_count DESC |
@@ -3948,7 +3948,7 @@ discard block |
||
3948 | 3948 | $airline_country_array = array(); |
3949 | 3949 | $temp_array = array(); |
3950 | 3950 | |
3951 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3951 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3952 | 3952 | { |
3953 | 3953 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
3954 | 3954 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -3965,11 +3965,11 @@ discard block |
||
3965 | 3965 | * @return Array the airline list |
3966 | 3966 | * |
3967 | 3967 | */ |
3968 | - public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
3968 | + public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
3969 | 3969 | { |
3970 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
3971 | - $filter_query = $this->getFilter($filters,true,true); |
|
3972 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3970 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
3971 | + $filter_query = $this->getFilter($filters, true, true); |
|
3972 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
3973 | 3973 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
3974 | 3974 | GROUP BY spotter_output.airline_name |
3975 | 3975 | ORDER BY airline_count DESC"; |
@@ -3980,7 +3980,7 @@ discard block |
||
3980 | 3980 | $airline_array = array(); |
3981 | 3981 | $temp_array = array(); |
3982 | 3982 | |
3983 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3983 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
3984 | 3984 | { |
3985 | 3985 | $temp_array['airline_name'] = $row['airline_name']; |
3986 | 3986 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4000,11 +4000,11 @@ discard block |
||
4000 | 4000 | * @return Array the airline country list |
4001 | 4001 | * |
4002 | 4002 | */ |
4003 | - public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
4003 | + public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
4004 | 4004 | { |
4005 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
4006 | - $filter_query = $this->getFilter($filters,true,true); |
|
4007 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4005 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
4006 | + $filter_query = $this->getFilter($filters, true, true); |
|
4007 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4008 | 4008 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
4009 | 4009 | GROUP BY spotter_output.airline_country |
4010 | 4010 | ORDER BY airline_country_count DESC |
@@ -4017,7 +4017,7 @@ discard block |
||
4017 | 4017 | $airline_country_array = array(); |
4018 | 4018 | $temp_array = array(); |
4019 | 4019 | |
4020 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4020 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4021 | 4021 | { |
4022 | 4022 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4023 | 4023 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4033,11 +4033,11 @@ discard block |
||
4033 | 4033 | * @return Array the airline list |
4034 | 4034 | * |
4035 | 4035 | */ |
4036 | - public function countAllAirlinesByDate($date,$filters = array()) |
|
4036 | + public function countAllAirlinesByDate($date, $filters = array()) |
|
4037 | 4037 | { |
4038 | 4038 | global $globalTimezone, $globalDBdriver; |
4039 | - $filter_query = $this->getFilter($filters,true,true); |
|
4040 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4039 | + $filter_query = $this->getFilter($filters, true, true); |
|
4040 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4041 | 4041 | if ($globalTimezone != '') { |
4042 | 4042 | date_default_timezone_set($globalTimezone); |
4043 | 4043 | $datetime = new DateTime($date); |
@@ -4045,12 +4045,12 @@ discard block |
||
4045 | 4045 | } else $offset = '+00:00'; |
4046 | 4046 | |
4047 | 4047 | if ($globalDBdriver == 'mysql') { |
4048 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4048 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4049 | 4049 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4050 | 4050 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
4051 | 4051 | ORDER BY airline_count DESC"; |
4052 | 4052 | } else { |
4053 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4053 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4054 | 4054 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4055 | 4055 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
4056 | 4056 | ORDER BY airline_count DESC"; |
@@ -4061,7 +4061,7 @@ discard block |
||
4061 | 4061 | |
4062 | 4062 | $airline_array = array(); |
4063 | 4063 | $temp_array = array(); |
4064 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4064 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4065 | 4065 | { |
4066 | 4066 | $temp_array['airline_name'] = $row['airline_name']; |
4067 | 4067 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4081,11 +4081,11 @@ discard block |
||
4081 | 4081 | * @return Array the airline country list |
4082 | 4082 | * |
4083 | 4083 | */ |
4084 | - public function countAllAirlineCountriesByDate($date,$filters = array()) |
|
4084 | + public function countAllAirlineCountriesByDate($date, $filters = array()) |
|
4085 | 4085 | { |
4086 | 4086 | global $globalTimezone, $globalDBdriver; |
4087 | - $filter_query = $this->getFilter($filters,true,true); |
|
4088 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4087 | + $filter_query = $this->getFilter($filters, true, true); |
|
4088 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4089 | 4089 | if ($globalTimezone != '') { |
4090 | 4090 | date_default_timezone_set($globalTimezone); |
4091 | 4091 | $datetime = new DateTime($date); |
@@ -4093,13 +4093,13 @@ discard block |
||
4093 | 4093 | } else $offset = '+00:00'; |
4094 | 4094 | |
4095 | 4095 | if ($globalDBdriver == 'mysql') { |
4096 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4096 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4097 | 4097 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4098 | 4098 | GROUP BY spotter_output.airline_country |
4099 | 4099 | ORDER BY airline_country_count DESC |
4100 | 4100 | LIMIT 10 OFFSET 0"; |
4101 | 4101 | } else { |
4102 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4102 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4103 | 4103 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4104 | 4104 | GROUP BY spotter_output.airline_country |
4105 | 4105 | ORDER BY airline_country_count DESC |
@@ -4111,7 +4111,7 @@ discard block |
||
4111 | 4111 | |
4112 | 4112 | $airline_country_array = array(); |
4113 | 4113 | $temp_array = array(); |
4114 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4114 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4115 | 4115 | { |
4116 | 4116 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4117 | 4117 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4128,11 +4128,11 @@ discard block |
||
4128 | 4128 | * @return Array the airline list |
4129 | 4129 | * |
4130 | 4130 | */ |
4131 | - public function countAllAirlinesByIdent($ident,$filters = array()) |
|
4131 | + public function countAllAirlinesByIdent($ident, $filters = array()) |
|
4132 | 4132 | { |
4133 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
4134 | - $filter_query = $this->getFilter($filters,true,true); |
|
4135 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4133 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
4134 | + $filter_query = $this->getFilter($filters, true, true); |
|
4135 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4136 | 4136 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
4137 | 4137 | GROUP BY spotter_output.airline_name |
4138 | 4138 | ORDER BY airline_count DESC"; |
@@ -4144,7 +4144,7 @@ discard block |
||
4144 | 4144 | $airline_array = array(); |
4145 | 4145 | $temp_array = array(); |
4146 | 4146 | |
4147 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4147 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4148 | 4148 | { |
4149 | 4149 | $temp_array['airline_name'] = $row['airline_name']; |
4150 | 4150 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4162,25 +4162,25 @@ discard block |
||
4162 | 4162 | * @return Array the airline list |
4163 | 4163 | * |
4164 | 4164 | */ |
4165 | - public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
4165 | + public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
4166 | 4166 | { |
4167 | - $filter_query = $this->getFilter($filters,true,true); |
|
4168 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
4169 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
4167 | + $filter_query = $this->getFilter($filters, true, true); |
|
4168 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
4169 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
4170 | 4170 | |
4171 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4171 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4172 | 4172 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
4173 | 4173 | GROUP BY spotter_output.airline_name |
4174 | 4174 | ORDER BY airline_count DESC"; |
4175 | 4175 | |
4176 | 4176 | |
4177 | 4177 | $sth = $this->db->prepare($query); |
4178 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
4178 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
4179 | 4179 | |
4180 | 4180 | $airline_array = array(); |
4181 | 4181 | $temp_array = array(); |
4182 | 4182 | |
4183 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4183 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4184 | 4184 | { |
4185 | 4185 | $temp_array['airline_name'] = $row['airline_name']; |
4186 | 4186 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4198,13 +4198,13 @@ discard block |
||
4198 | 4198 | * @return Array the airline country list |
4199 | 4199 | * |
4200 | 4200 | */ |
4201 | - public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
|
4201 | + public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
4202 | 4202 | { |
4203 | - $filter_query = $this->getFilter($filters,true,true); |
|
4204 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
4205 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
4203 | + $filter_query = $this->getFilter($filters, true, true); |
|
4204 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
4205 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
4206 | 4206 | |
4207 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4207 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4208 | 4208 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
4209 | 4209 | GROUP BY spotter_output.airline_country |
4210 | 4210 | ORDER BY airline_country_count DESC |
@@ -4212,11 +4212,11 @@ discard block |
||
4212 | 4212 | |
4213 | 4213 | |
4214 | 4214 | $sth = $this->db->prepare($query); |
4215 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
4215 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
4216 | 4216 | |
4217 | 4217 | $airline_country_array = array(); |
4218 | 4218 | $temp_array = array(); |
4219 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4219 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4220 | 4220 | { |
4221 | 4221 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4222 | 4222 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4234,11 +4234,11 @@ discard block |
||
4234 | 4234 | * @return Array the airline list |
4235 | 4235 | * |
4236 | 4236 | */ |
4237 | - public function countAllAirlinesByCountry($country,$filters = array()) |
|
4237 | + public function countAllAirlinesByCountry($country, $filters = array()) |
|
4238 | 4238 | { |
4239 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
4240 | - $filter_query = $this->getFilter($filters,true,true); |
|
4241 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4239 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
4240 | + $filter_query = $this->getFilter($filters, true, true); |
|
4241 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
4242 | 4242 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
4243 | 4243 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
4244 | 4244 | ORDER BY airline_count DESC"; |
@@ -4249,7 +4249,7 @@ discard block |
||
4249 | 4249 | |
4250 | 4250 | $airline_array = array(); |
4251 | 4251 | $temp_array = array(); |
4252 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4252 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4253 | 4253 | { |
4254 | 4254 | $temp_array['airline_name'] = $row['airline_name']; |
4255 | 4255 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4268,11 +4268,11 @@ discard block |
||
4268 | 4268 | * @return Array the airline country list |
4269 | 4269 | * |
4270 | 4270 | */ |
4271 | - public function countAllAirlineCountriesByCountry($country,$filters = array()) |
|
4271 | + public function countAllAirlineCountriesByCountry($country, $filters = array()) |
|
4272 | 4272 | { |
4273 | - $filter_query = $this->getFilter($filters,true,true); |
|
4274 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
4275 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4273 | + $filter_query = $this->getFilter($filters, true, true); |
|
4274 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
4275 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4276 | 4276 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
4277 | 4277 | GROUP BY spotter_output.airline_country |
4278 | 4278 | ORDER BY airline_country_count DESC |
@@ -4284,7 +4284,7 @@ discard block |
||
4284 | 4284 | |
4285 | 4285 | $airline_country_array = array(); |
4286 | 4286 | $temp_array = array(); |
4287 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4287 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4288 | 4288 | { |
4289 | 4289 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4290 | 4290 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4303,8 +4303,8 @@ discard block |
||
4303 | 4303 | */ |
4304 | 4304 | public function countAllAirlineCountries($limit = true, $filters = array()) |
4305 | 4305 | { |
4306 | - $filter_query = $this->getFilter($filters,true,true); |
|
4307 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4306 | + $filter_query = $this->getFilter($filters, true, true); |
|
4307 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
4308 | 4308 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
4309 | 4309 | GROUP BY spotter_output.airline_country |
4310 | 4310 | ORDER BY airline_country_count DESC"; |
@@ -4315,7 +4315,7 @@ discard block |
||
4315 | 4315 | |
4316 | 4316 | $airline_array = array(); |
4317 | 4317 | $temp_array = array(); |
4318 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4318 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4319 | 4319 | { |
4320 | 4320 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
4321 | 4321 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4331,11 +4331,11 @@ discard block |
||
4331 | 4331 | * @return Array the airline country list |
4332 | 4332 | * |
4333 | 4333 | */ |
4334 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
4334 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
4335 | 4335 | { |
4336 | 4336 | global $globalDBdriver; |
4337 | 4337 | //$filter_query = $this->getFilter($filters,true,true); |
4338 | - $Connection= new Connection($this->db); |
|
4338 | + $Connection = new Connection($this->db); |
|
4339 | 4339 | if (!$Connection->tableExists('countries')) return array(); |
4340 | 4340 | /* |
4341 | 4341 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -4370,7 +4370,7 @@ discard block |
||
4370 | 4370 | $flight_array = array(); |
4371 | 4371 | $temp_array = array(); |
4372 | 4372 | |
4373 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4373 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4374 | 4374 | { |
4375 | 4375 | $temp_array['flight_count'] = $row['nb']; |
4376 | 4376 | $temp_array['flight_country'] = $row['name']; |
@@ -4388,12 +4388,12 @@ discard block |
||
4388 | 4388 | * @return Array the aircraft list |
4389 | 4389 | * |
4390 | 4390 | */ |
4391 | - public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
4391 | + public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
4392 | 4392 | { |
4393 | 4393 | global $globalDBdriver; |
4394 | - $filter_query = $this->getFilter($filters,true,true); |
|
4394 | + $filter_query = $this->getFilter($filters, true, true); |
|
4395 | 4395 | |
4396 | - $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4396 | + $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4397 | 4397 | FROM spotter_output ".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> ''"; |
4398 | 4398 | if ($olderthanmonths > 0) { |
4399 | 4399 | if ($globalDBdriver == 'mysql') { |
@@ -4418,7 +4418,7 @@ discard block |
||
4418 | 4418 | |
4419 | 4419 | $aircraft_array = array(); |
4420 | 4420 | $temp_array = array(); |
4421 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4421 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4422 | 4422 | { |
4423 | 4423 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4424 | 4424 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4435,11 +4435,11 @@ discard block |
||
4435 | 4435 | * @return Array the aircraft list |
4436 | 4436 | * |
4437 | 4437 | */ |
4438 | - public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
4438 | + public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
4439 | 4439 | { |
4440 | 4440 | global $globalDBdriver; |
4441 | - $filter_query = $this->getFilter($filters,true,true); |
|
4442 | - $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4441 | + $filter_query = $this->getFilter($filters, true, true); |
|
4442 | + $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
4443 | 4443 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
4444 | 4444 | if ($olderthanmonths > 0) { |
4445 | 4445 | if ($globalDBdriver == 'mysql') { |
@@ -4464,7 +4464,7 @@ discard block |
||
4464 | 4464 | |
4465 | 4465 | $aircraft_array = array(); |
4466 | 4466 | $temp_array = array(); |
4467 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4467 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4468 | 4468 | { |
4469 | 4469 | $temp_array['airline_icao'] = $row['airline_icao']; |
4470 | 4470 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4483,13 +4483,13 @@ discard block |
||
4483 | 4483 | * @return Array the aircraft list |
4484 | 4484 | * |
4485 | 4485 | */ |
4486 | - public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
|
4486 | + public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array()) |
|
4487 | 4487 | { |
4488 | 4488 | $Image = new Image($this->db); |
4489 | - $filter_query = $this->getFilter($filters,true,true); |
|
4490 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
4489 | + $filter_query = $this->getFilter($filters, true, true); |
|
4490 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
4491 | 4491 | |
4492 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4492 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4493 | 4493 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
4494 | 4494 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
4495 | 4495 | ORDER BY registration_count DESC"; |
@@ -4500,14 +4500,14 @@ discard block |
||
4500 | 4500 | $aircraft_array = array(); |
4501 | 4501 | $temp_array = array(); |
4502 | 4502 | |
4503 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4503 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4504 | 4504 | { |
4505 | 4505 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4506 | 4506 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4507 | 4507 | $temp_array['registration'] = $row['registration']; |
4508 | 4508 | $temp_array['airline_name'] = $row['airline_name']; |
4509 | 4509 | $temp_array['image_thumbnail'] = ""; |
4510 | - if($row['registration'] != "") |
|
4510 | + if ($row['registration'] != "") |
|
4511 | 4511 | { |
4512 | 4512 | $image_array = $Image->getSpotterImage($row['registration']); |
4513 | 4513 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4526,11 +4526,11 @@ discard block |
||
4526 | 4526 | * @return Array the aircraft list |
4527 | 4527 | * |
4528 | 4528 | */ |
4529 | - public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
|
4529 | + public function countAllAircraftTypesByAirline($airline_icao, $filters = array()) |
|
4530 | 4530 | { |
4531 | - $filter_query = $this->getFilter($filters,true,true); |
|
4532 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
4533 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4531 | + $filter_query = $this->getFilter($filters, true, true); |
|
4532 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
4533 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4534 | 4534 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao |
4535 | 4535 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
4536 | 4536 | ORDER BY aircraft_icao_count DESC"; |
@@ -4541,7 +4541,7 @@ discard block |
||
4541 | 4541 | $aircraft_array = array(); |
4542 | 4542 | $temp_array = array(); |
4543 | 4543 | |
4544 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4544 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4545 | 4545 | { |
4546 | 4546 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4547 | 4547 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4559,13 +4559,13 @@ discard block |
||
4559 | 4559 | * @return Array the aircraft list |
4560 | 4560 | * |
4561 | 4561 | */ |
4562 | - public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
|
4562 | + public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array()) |
|
4563 | 4563 | { |
4564 | - $filter_query = $this->getFilter($filters,true,true); |
|
4564 | + $filter_query = $this->getFilter($filters, true, true); |
|
4565 | 4565 | $Image = new Image($this->db); |
4566 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
4566 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
4567 | 4567 | |
4568 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4568 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4569 | 4569 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao |
4570 | 4570 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
4571 | 4571 | ORDER BY registration_count DESC"; |
@@ -4575,14 +4575,14 @@ discard block |
||
4575 | 4575 | |
4576 | 4576 | $aircraft_array = array(); |
4577 | 4577 | $temp_array = array(); |
4578 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4578 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4579 | 4579 | { |
4580 | 4580 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4581 | 4581 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4582 | 4582 | $temp_array['registration'] = $row['registration']; |
4583 | 4583 | $temp_array['airline_name'] = $row['airline_name']; |
4584 | 4584 | $temp_array['image_thumbnail'] = ""; |
4585 | - if($row['registration'] != "") |
|
4585 | + if ($row['registration'] != "") |
|
4586 | 4586 | { |
4587 | 4587 | $image_array = $Image->getSpotterImage($row['registration']); |
4588 | 4588 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4601,11 +4601,11 @@ discard block |
||
4601 | 4601 | * @return Array the aircraft list |
4602 | 4602 | * |
4603 | 4603 | */ |
4604 | - public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
|
4604 | + public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array()) |
|
4605 | 4605 | { |
4606 | - $filter_query = $this->getFilter($filters,true,true); |
|
4607 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
4608 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4606 | + $filter_query = $this->getFilter($filters, true, true); |
|
4607 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
4608 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4609 | 4609 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao |
4610 | 4610 | GROUP BY spotter_output.aircraft_manufacturer |
4611 | 4611 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4616,7 +4616,7 @@ discard block |
||
4616 | 4616 | $aircraft_array = array(); |
4617 | 4617 | $temp_array = array(); |
4618 | 4618 | |
4619 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4619 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4620 | 4620 | { |
4621 | 4621 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
4622 | 4622 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4633,12 +4633,12 @@ discard block |
||
4633 | 4633 | * @return Array the aircraft list |
4634 | 4634 | * |
4635 | 4635 | */ |
4636 | - public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
|
4636 | + public function countAllAircraftTypesByAirport($airport_icao, $filters = array()) |
|
4637 | 4637 | { |
4638 | - $filter_query = $this->getFilter($filters,true,true); |
|
4639 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
4638 | + $filter_query = $this->getFilter($filters, true, true); |
|
4639 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
4640 | 4640 | |
4641 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4641 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4642 | 4642 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
4643 | 4643 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
4644 | 4644 | ORDER BY aircraft_icao_count DESC"; |
@@ -4648,7 +4648,7 @@ discard block |
||
4648 | 4648 | |
4649 | 4649 | $aircraft_array = array(); |
4650 | 4650 | $temp_array = array(); |
4651 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4651 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4652 | 4652 | { |
4653 | 4653 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4654 | 4654 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4666,13 +4666,13 @@ discard block |
||
4666 | 4666 | * @return Array the aircraft list |
4667 | 4667 | * |
4668 | 4668 | */ |
4669 | - public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
|
4669 | + public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array()) |
|
4670 | 4670 | { |
4671 | - $filter_query = $this->getFilter($filters,true,true); |
|
4671 | + $filter_query = $this->getFilter($filters, true, true); |
|
4672 | 4672 | $Image = new Image($this->db); |
4673 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
4673 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
4674 | 4674 | |
4675 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4675 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4676 | 4676 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
4677 | 4677 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
4678 | 4678 | ORDER BY registration_count DESC"; |
@@ -4682,14 +4682,14 @@ discard block |
||
4682 | 4682 | |
4683 | 4683 | $aircraft_array = array(); |
4684 | 4684 | $temp_array = array(); |
4685 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4685 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4686 | 4686 | { |
4687 | 4687 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4688 | 4688 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4689 | 4689 | $temp_array['registration'] = $row['registration']; |
4690 | 4690 | $temp_array['airline_name'] = $row['airline_name']; |
4691 | 4691 | $temp_array['image_thumbnail'] = ""; |
4692 | - if($row['registration'] != "") |
|
4692 | + if ($row['registration'] != "") |
|
4693 | 4693 | { |
4694 | 4694 | $image_array = $Image->getSpotterImage($row['registration']); |
4695 | 4695 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4707,11 +4707,11 @@ discard block |
||
4707 | 4707 | * @return Array the aircraft list |
4708 | 4708 | * |
4709 | 4709 | */ |
4710 | - public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
|
4710 | + public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array()) |
|
4711 | 4711 | { |
4712 | - $filter_query = $this->getFilter($filters,true,true); |
|
4713 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
4714 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4712 | + $filter_query = $this->getFilter($filters, true, true); |
|
4713 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
4714 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4715 | 4715 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
4716 | 4716 | GROUP BY spotter_output.aircraft_manufacturer |
4717 | 4717 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4722,7 +4722,7 @@ discard block |
||
4722 | 4722 | |
4723 | 4723 | $aircraft_array = array(); |
4724 | 4724 | $temp_array = array(); |
4725 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4725 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4726 | 4726 | { |
4727 | 4727 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
4728 | 4728 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4737,12 +4737,12 @@ discard block |
||
4737 | 4737 | * @return Array the aircraft list |
4738 | 4738 | * |
4739 | 4739 | */ |
4740 | - public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
4740 | + public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
4741 | 4741 | { |
4742 | - $filter_query = $this->getFilter($filters,true,true); |
|
4743 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
4742 | + $filter_query = $this->getFilter($filters, true, true); |
|
4743 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
4744 | 4744 | |
4745 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4745 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4746 | 4746 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
4747 | 4747 | GROUP BY spotter_output.aircraft_name |
4748 | 4748 | ORDER BY aircraft_icao_count DESC"; |
@@ -4751,7 +4751,7 @@ discard block |
||
4751 | 4751 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
4752 | 4752 | $aircraft_array = array(); |
4753 | 4753 | $temp_array = array(); |
4754 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4754 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4755 | 4755 | { |
4756 | 4756 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4757 | 4757 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4770,11 +4770,11 @@ discard block |
||
4770 | 4770 | */ |
4771 | 4771 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
4772 | 4772 | { |
4773 | - $filter_query = $this->getFilter($filters,true,true); |
|
4773 | + $filter_query = $this->getFilter($filters, true, true); |
|
4774 | 4774 | $Image = new Image($this->db); |
4775 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
4775 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
4776 | 4776 | |
4777 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4777 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4778 | 4778 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
4779 | 4779 | GROUP BY spotter_output.registration |
4780 | 4780 | ORDER BY registration_count DESC"; |
@@ -4784,14 +4784,14 @@ discard block |
||
4784 | 4784 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
4785 | 4785 | $aircraft_array = array(); |
4786 | 4786 | $temp_array = array(); |
4787 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4787 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4788 | 4788 | { |
4789 | 4789 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4790 | 4790 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4791 | 4791 | $temp_array['registration'] = $row['registration']; |
4792 | 4792 | $temp_array['airline_name'] = $row['airline_name']; |
4793 | 4793 | $temp_array['image_thumbnail'] = ""; |
4794 | - if($row['registration'] != "") |
|
4794 | + if ($row['registration'] != "") |
|
4795 | 4795 | { |
4796 | 4796 | $image_array = $Image->getSpotterImage($row['registration']); |
4797 | 4797 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4808,11 +4808,11 @@ discard block |
||
4808 | 4808 | * @return Array the aircraft list |
4809 | 4809 | * |
4810 | 4810 | */ |
4811 | - public function countAllAircraftTypesByDate($date,$filters = array()) |
|
4811 | + public function countAllAircraftTypesByDate($date, $filters = array()) |
|
4812 | 4812 | { |
4813 | 4813 | global $globalTimezone, $globalDBdriver; |
4814 | - $filter_query = $this->getFilter($filters,true,true); |
|
4815 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4814 | + $filter_query = $this->getFilter($filters, true, true); |
|
4815 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4816 | 4816 | if ($globalTimezone != '') { |
4817 | 4817 | date_default_timezone_set($globalTimezone); |
4818 | 4818 | $datetime = new DateTime($date); |
@@ -4820,12 +4820,12 @@ discard block |
||
4820 | 4820 | } else $offset = '+00:00'; |
4821 | 4821 | |
4822 | 4822 | if ($globalDBdriver == 'mysql') { |
4823 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4823 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4824 | 4824 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4825 | 4825 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
4826 | 4826 | ORDER BY aircraft_icao_count DESC"; |
4827 | 4827 | } else { |
4828 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4828 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4829 | 4829 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4830 | 4830 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
4831 | 4831 | ORDER BY aircraft_icao_count DESC"; |
@@ -4836,7 +4836,7 @@ discard block |
||
4836 | 4836 | |
4837 | 4837 | $aircraft_array = array(); |
4838 | 4838 | $temp_array = array(); |
4839 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4839 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4840 | 4840 | { |
4841 | 4841 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4842 | 4842 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4854,12 +4854,12 @@ discard block |
||
4854 | 4854 | * @return Array the aircraft list |
4855 | 4855 | * |
4856 | 4856 | */ |
4857 | - public function countAllAircraftRegistrationByDate($date,$filters = array()) |
|
4857 | + public function countAllAircraftRegistrationByDate($date, $filters = array()) |
|
4858 | 4858 | { |
4859 | 4859 | global $globalTimezone, $globalDBdriver; |
4860 | - $filter_query = $this->getFilter($filters,true,true); |
|
4860 | + $filter_query = $this->getFilter($filters, true, true); |
|
4861 | 4861 | $Image = new Image($this->db); |
4862 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4862 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4863 | 4863 | if ($globalTimezone != '') { |
4864 | 4864 | date_default_timezone_set($globalTimezone); |
4865 | 4865 | $datetime = new DateTime($date); |
@@ -4867,12 +4867,12 @@ discard block |
||
4867 | 4867 | } else $offset = '+00:00'; |
4868 | 4868 | |
4869 | 4869 | if ($globalDBdriver == 'mysql') { |
4870 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4870 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4871 | 4871 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4872 | 4872 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
4873 | 4873 | ORDER BY registration_count DESC"; |
4874 | 4874 | } else { |
4875 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4875 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4876 | 4876 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4877 | 4877 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
4878 | 4878 | ORDER BY registration_count DESC"; |
@@ -4883,14 +4883,14 @@ discard block |
||
4883 | 4883 | |
4884 | 4884 | $aircraft_array = array(); |
4885 | 4885 | $temp_array = array(); |
4886 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4886 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4887 | 4887 | { |
4888 | 4888 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4889 | 4889 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
4890 | 4890 | $temp_array['registration'] = $row['registration']; |
4891 | 4891 | $temp_array['airline_name'] = $row['airline_name']; |
4892 | 4892 | $temp_array['image_thumbnail'] = ""; |
4893 | - if($row['registration'] != "") |
|
4893 | + if ($row['registration'] != "") |
|
4894 | 4894 | { |
4895 | 4895 | $image_array = $Image->getSpotterImage($row['registration']); |
4896 | 4896 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4909,11 +4909,11 @@ discard block |
||
4909 | 4909 | * @return Array the aircraft manufacturer list |
4910 | 4910 | * |
4911 | 4911 | */ |
4912 | - public function countAllAircraftManufacturerByDate($date,$filters = array()) |
|
4912 | + public function countAllAircraftManufacturerByDate($date, $filters = array()) |
|
4913 | 4913 | { |
4914 | 4914 | global $globalTimezone, $globalDBdriver; |
4915 | - $filter_query = $this->getFilter($filters,true,true); |
|
4916 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
4915 | + $filter_query = $this->getFilter($filters, true, true); |
|
4916 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
4917 | 4917 | if ($globalTimezone != '') { |
4918 | 4918 | date_default_timezone_set($globalTimezone); |
4919 | 4919 | $datetime = new DateTime($date); |
@@ -4921,12 +4921,12 @@ discard block |
||
4921 | 4921 | } else $offset = '+00:00'; |
4922 | 4922 | |
4923 | 4923 | if ($globalDBdriver == 'mysql') { |
4924 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4924 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4925 | 4925 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
4926 | 4926 | GROUP BY spotter_output.aircraft_manufacturer |
4927 | 4927 | ORDER BY aircraft_manufacturer_count DESC"; |
4928 | 4928 | } else { |
4929 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4929 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
4930 | 4930 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
4931 | 4931 | GROUP BY spotter_output.aircraft_manufacturer |
4932 | 4932 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4938,7 +4938,7 @@ discard block |
||
4938 | 4938 | $aircraft_array = array(); |
4939 | 4939 | $temp_array = array(); |
4940 | 4940 | |
4941 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4941 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4942 | 4942 | { |
4943 | 4943 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
4944 | 4944 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4955,11 +4955,11 @@ discard block |
||
4955 | 4955 | * @return Array the aircraft list |
4956 | 4956 | * |
4957 | 4957 | */ |
4958 | - public function countAllAircraftTypesByIdent($ident,$filters = array()) |
|
4958 | + public function countAllAircraftTypesByIdent($ident, $filters = array()) |
|
4959 | 4959 | { |
4960 | - $filter_query = $this->getFilter($filters,true,true); |
|
4961 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
4962 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4960 | + $filter_query = $this->getFilter($filters, true, true); |
|
4961 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
4962 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
4963 | 4963 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
4964 | 4964 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
4965 | 4965 | ORDER BY aircraft_icao_count DESC"; |
@@ -4970,7 +4970,7 @@ discard block |
||
4970 | 4970 | $aircraft_array = array(); |
4971 | 4971 | $temp_array = array(); |
4972 | 4972 | |
4973 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4973 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
4974 | 4974 | { |
4975 | 4975 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
4976 | 4976 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4988,13 +4988,13 @@ discard block |
||
4988 | 4988 | * @return Array the aircraft list |
4989 | 4989 | * |
4990 | 4990 | */ |
4991 | - public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
|
4991 | + public function countAllAircraftRegistrationByIdent($ident, $filters = array()) |
|
4992 | 4992 | { |
4993 | - $filter_query = $this->getFilter($filters,true,true); |
|
4993 | + $filter_query = $this->getFilter($filters, true, true); |
|
4994 | 4994 | $Image = new Image($this->db); |
4995 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
4995 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
4996 | 4996 | |
4997 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4997 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
4998 | 4998 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident |
4999 | 4999 | GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
5000 | 5000 | ORDER BY registration_count DESC"; |
@@ -5006,14 +5006,14 @@ discard block |
||
5006 | 5006 | $aircraft_array = array(); |
5007 | 5007 | $temp_array = array(); |
5008 | 5008 | |
5009 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5009 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5010 | 5010 | { |
5011 | 5011 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5012 | 5012 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5013 | 5013 | $temp_array['registration'] = $row['registration']; |
5014 | 5014 | $temp_array['airline_name'] = $row['airline_name']; |
5015 | 5015 | $temp_array['image_thumbnail'] = ""; |
5016 | - if($row['registration'] != "") |
|
5016 | + if ($row['registration'] != "") |
|
5017 | 5017 | { |
5018 | 5018 | $image_array = $Image->getSpotterImage($row['registration']); |
5019 | 5019 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5032,11 +5032,11 @@ discard block |
||
5032 | 5032 | * @return Array the aircraft manufacturer list |
5033 | 5033 | * |
5034 | 5034 | */ |
5035 | - public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
|
5035 | + public function countAllAircraftManufacturerByIdent($ident, $filters = array()) |
|
5036 | 5036 | { |
5037 | - $filter_query = $this->getFilter($filters,true,true); |
|
5038 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
5039 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5037 | + $filter_query = $this->getFilter($filters, true, true); |
|
5038 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
5039 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5040 | 5040 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident |
5041 | 5041 | GROUP BY spotter_output.aircraft_manufacturer |
5042 | 5042 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5046,7 +5046,7 @@ discard block |
||
5046 | 5046 | $sth->execute(array(':ident' => $ident)); |
5047 | 5047 | $aircraft_array = array(); |
5048 | 5048 | $temp_array = array(); |
5049 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5049 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5050 | 5050 | { |
5051 | 5051 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5052 | 5052 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5062,24 +5062,24 @@ discard block |
||
5062 | 5062 | * @return Array the aircraft list |
5063 | 5063 | * |
5064 | 5064 | */ |
5065 | - public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
5065 | + public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
5066 | 5066 | { |
5067 | - $filter_query = $this->getFilter($filters,true,true); |
|
5068 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
5069 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
5067 | + $filter_query = $this->getFilter($filters, true, true); |
|
5068 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
5069 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
5070 | 5070 | |
5071 | 5071 | |
5072 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5072 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5073 | 5073 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
5074 | 5074 | GROUP BY spotter_output.aircraft_name |
5075 | 5075 | ORDER BY aircraft_icao_count DESC"; |
5076 | 5076 | |
5077 | 5077 | |
5078 | 5078 | $sth = $this->db->prepare($query); |
5079 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
5079 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
5080 | 5080 | $aircraft_array = array(); |
5081 | 5081 | $temp_array = array(); |
5082 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5082 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5083 | 5083 | { |
5084 | 5084 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5085 | 5085 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5095,33 +5095,33 @@ discard block |
||
5095 | 5095 | * @return Array the aircraft list |
5096 | 5096 | * |
5097 | 5097 | */ |
5098 | - public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
5098 | + public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
5099 | 5099 | { |
5100 | - $filter_query = $this->getFilter($filters,true,true); |
|
5100 | + $filter_query = $this->getFilter($filters, true, true); |
|
5101 | 5101 | $Image = new Image($this->db); |
5102 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
5103 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
5102 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
5103 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
5104 | 5104 | |
5105 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5105 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5106 | 5106 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
5107 | 5107 | GROUP BY spotter_output.registration |
5108 | 5108 | ORDER BY registration_count DESC"; |
5109 | 5109 | |
5110 | 5110 | |
5111 | 5111 | $sth = $this->db->prepare($query); |
5112 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
5112 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
5113 | 5113 | |
5114 | 5114 | $aircraft_array = array(); |
5115 | 5115 | $temp_array = array(); |
5116 | 5116 | |
5117 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5117 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5118 | 5118 | { |
5119 | 5119 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5120 | 5120 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5121 | 5121 | $temp_array['registration'] = $row['registration']; |
5122 | 5122 | $temp_array['airline_name'] = $row['airline_name']; |
5123 | 5123 | $temp_array['image_thumbnail'] = ""; |
5124 | - if($row['registration'] != "") |
|
5124 | + if ($row['registration'] != "") |
|
5125 | 5125 | { |
5126 | 5126 | $image_array = $Image->getSpotterImage($row['registration']); |
5127 | 5127 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5141,25 +5141,25 @@ discard block |
||
5141 | 5141 | * @return Array the aircraft manufacturer list |
5142 | 5142 | * |
5143 | 5143 | */ |
5144 | - public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
5144 | + public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
5145 | 5145 | { |
5146 | - $filter_query = $this->getFilter($filters,true,true); |
|
5147 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
5148 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
5146 | + $filter_query = $this->getFilter($filters, true, true); |
|
5147 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
5148 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
5149 | 5149 | |
5150 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5150 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5151 | 5151 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
5152 | 5152 | GROUP BY spotter_output.aircraft_manufacturer |
5153 | 5153 | ORDER BY aircraft_manufacturer_count DESC"; |
5154 | 5154 | |
5155 | 5155 | |
5156 | 5156 | $sth = $this->db->prepare($query); |
5157 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
5157 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
5158 | 5158 | |
5159 | 5159 | $aircraft_array = array(); |
5160 | 5160 | $temp_array = array(); |
5161 | 5161 | |
5162 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5162 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5163 | 5163 | { |
5164 | 5164 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5165 | 5165 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5179,11 +5179,11 @@ discard block |
||
5179 | 5179 | * @return Array the aircraft list |
5180 | 5180 | * |
5181 | 5181 | */ |
5182 | - public function countAllAircraftTypesByCountry($country,$filters = array()) |
|
5182 | + public function countAllAircraftTypesByCountry($country, $filters = array()) |
|
5183 | 5183 | { |
5184 | - $filter_query = $this->getFilter($filters,true,true); |
|
5185 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
5186 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5184 | + $filter_query = $this->getFilter($filters, true, true); |
|
5185 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
5186 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
5187 | 5187 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
5188 | 5188 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
5189 | 5189 | ORDER BY aircraft_icao_count DESC"; |
@@ -5195,7 +5195,7 @@ discard block |
||
5195 | 5195 | $aircraft_array = array(); |
5196 | 5196 | $temp_array = array(); |
5197 | 5197 | |
5198 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5198 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5199 | 5199 | { |
5200 | 5200 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5201 | 5201 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5214,12 +5214,12 @@ discard block |
||
5214 | 5214 | * @return Array the aircraft list |
5215 | 5215 | * |
5216 | 5216 | */ |
5217 | - public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
|
5217 | + public function countAllAircraftRegistrationByCountry($country, $filters = array()) |
|
5218 | 5218 | { |
5219 | - $filter_query = $this->getFilter($filters,true,true); |
|
5219 | + $filter_query = $this->getFilter($filters, true, true); |
|
5220 | 5220 | $Image = new Image($this->db); |
5221 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
5222 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5221 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
5222 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
5223 | 5223 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
5224 | 5224 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
5225 | 5225 | ORDER BY registration_count DESC"; |
@@ -5231,14 +5231,14 @@ discard block |
||
5231 | 5231 | $aircraft_array = array(); |
5232 | 5232 | $temp_array = array(); |
5233 | 5233 | |
5234 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5234 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5235 | 5235 | { |
5236 | 5236 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
5237 | 5237 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5238 | 5238 | $temp_array['registration'] = $row['registration']; |
5239 | 5239 | $temp_array['airline_name'] = $row['airline_name']; |
5240 | 5240 | $temp_array['image_thumbnail'] = ""; |
5241 | - if($row['registration'] != "") |
|
5241 | + if ($row['registration'] != "") |
|
5242 | 5242 | { |
5243 | 5243 | $image_array = $Image->getSpotterImage($row['registration']); |
5244 | 5244 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5258,11 +5258,11 @@ discard block |
||
5258 | 5258 | * @return Array the aircraft manufacturer list |
5259 | 5259 | * |
5260 | 5260 | */ |
5261 | - public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
|
5261 | + public function countAllAircraftManufacturerByCountry($country, $filters = array()) |
|
5262 | 5262 | { |
5263 | - $filter_query = $this->getFilter($filters,true,true); |
|
5264 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
5265 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5263 | + $filter_query = $this->getFilter($filters, true, true); |
|
5264 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
5265 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5266 | 5266 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
5267 | 5267 | GROUP BY spotter_output.aircraft_manufacturer |
5268 | 5268 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5274,7 +5274,7 @@ discard block |
||
5274 | 5274 | $aircraft_array = array(); |
5275 | 5275 | $temp_array = array(); |
5276 | 5276 | |
5277 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5277 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5278 | 5278 | { |
5279 | 5279 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5280 | 5280 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5295,8 +5295,8 @@ discard block |
||
5295 | 5295 | */ |
5296 | 5296 | public function countAllAircraftManufacturers($filters = array()) |
5297 | 5297 | { |
5298 | - $filter_query = $this->getFilter($filters,true,true); |
|
5299 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5298 | + $filter_query = $this->getFilter($filters, true, true); |
|
5299 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
5300 | 5300 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
5301 | 5301 | $query .= " GROUP BY spotter_output.aircraft_manufacturer |
5302 | 5302 | ORDER BY aircraft_manufacturer_count DESC |
@@ -5309,7 +5309,7 @@ discard block |
||
5309 | 5309 | $manufacturer_array = array(); |
5310 | 5310 | $temp_array = array(); |
5311 | 5311 | |
5312 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5312 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5313 | 5313 | { |
5314 | 5314 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
5315 | 5315 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5328,12 +5328,12 @@ discard block |
||
5328 | 5328 | * @return Array the aircraft list |
5329 | 5329 | * |
5330 | 5330 | */ |
5331 | - public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
5331 | + public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5332 | 5332 | { |
5333 | 5333 | global $globalDBdriver; |
5334 | 5334 | $Image = new Image($this->db); |
5335 | - $filter_query = $this->getFilter($filters,true,true); |
|
5336 | - $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
5335 | + $filter_query = $this->getFilter($filters, true, true); |
|
5336 | + $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
5337 | 5337 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
5338 | 5338 | if ($olderthanmonths > 0) { |
5339 | 5339 | if ($globalDBdriver == 'mysql') { |
@@ -5361,7 +5361,7 @@ discard block |
||
5361 | 5361 | $aircraft_array = array(); |
5362 | 5362 | $temp_array = array(); |
5363 | 5363 | |
5364 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5364 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5365 | 5365 | { |
5366 | 5366 | $temp_array['registration'] = $row['registration']; |
5367 | 5367 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5369,7 +5369,7 @@ discard block |
||
5369 | 5369 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5370 | 5370 | $temp_array['airline_name'] = $row['airline_name']; |
5371 | 5371 | $temp_array['image_thumbnail'] = ""; |
5372 | - if($row['registration'] != "") |
|
5372 | + if ($row['registration'] != "") |
|
5373 | 5373 | { |
5374 | 5374 | $image_array = $Image->getSpotterImage($row['registration']); |
5375 | 5375 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5388,12 +5388,12 @@ discard block |
||
5388 | 5388 | * @return Array the aircraft list |
5389 | 5389 | * |
5390 | 5390 | */ |
5391 | - public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
5391 | + public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5392 | 5392 | { |
5393 | 5393 | global $globalDBdriver; |
5394 | - $filter_query = $this->getFilter($filters,true,true); |
|
5394 | + $filter_query = $this->getFilter($filters, true, true); |
|
5395 | 5395 | $Image = new Image($this->db); |
5396 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
5396 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
5397 | 5397 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
5398 | 5398 | if ($olderthanmonths > 0) { |
5399 | 5399 | if ($globalDBdriver == 'mysql') { |
@@ -5421,7 +5421,7 @@ discard block |
||
5421 | 5421 | $aircraft_array = array(); |
5422 | 5422 | $temp_array = array(); |
5423 | 5423 | |
5424 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5424 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5425 | 5425 | { |
5426 | 5426 | $temp_array['registration'] = $row['registration']; |
5427 | 5427 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5430,7 +5430,7 @@ discard block |
||
5430 | 5430 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
5431 | 5431 | $temp_array['airline_name'] = $row['airline_name']; |
5432 | 5432 | $temp_array['image_thumbnail'] = ""; |
5433 | - if($row['registration'] != "") |
|
5433 | + if ($row['registration'] != "") |
|
5434 | 5434 | { |
5435 | 5435 | $image_array = $Image->getSpotterImage($row['registration']); |
5436 | 5436 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5449,11 +5449,11 @@ discard block |
||
5449 | 5449 | * @return Array the airport list |
5450 | 5450 | * |
5451 | 5451 | */ |
5452 | - public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
5452 | + public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5453 | 5453 | { |
5454 | 5454 | global $globalDBdriver; |
5455 | - $filter_query = $this->getFilter($filters,true,true); |
|
5456 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5455 | + $filter_query = $this->getFilter($filters, true, true); |
|
5456 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5457 | 5457 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
5458 | 5458 | if ($olderthanmonths > 0) { |
5459 | 5459 | if ($globalDBdriver == 'mysql') { |
@@ -5482,7 +5482,7 @@ discard block |
||
5482 | 5482 | $airport_array = array(); |
5483 | 5483 | $temp_array = array(); |
5484 | 5484 | |
5485 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5485 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5486 | 5486 | { |
5487 | 5487 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5488 | 5488 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5501,11 +5501,11 @@ discard block |
||
5501 | 5501 | * @return Array the airport list |
5502 | 5502 | * |
5503 | 5503 | */ |
5504 | - public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
5504 | + public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5505 | 5505 | { |
5506 | 5506 | global $globalDBdriver; |
5507 | - $filter_query = $this->getFilter($filters,true,true); |
|
5508 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5507 | + $filter_query = $this->getFilter($filters, true, true); |
|
5508 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5509 | 5509 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' "; |
5510 | 5510 | if ($olderthanmonths > 0) { |
5511 | 5511 | if ($globalDBdriver == 'mysql') { |
@@ -5534,7 +5534,7 @@ discard block |
||
5534 | 5534 | $airport_array = array(); |
5535 | 5535 | $temp_array = array(); |
5536 | 5536 | |
5537 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5537 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5538 | 5538 | { |
5539 | 5539 | $temp_array['airline_icao'] = $row['airline_icao']; |
5540 | 5540 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5554,11 +5554,11 @@ discard block |
||
5554 | 5554 | * @return Array the airport list |
5555 | 5555 | * |
5556 | 5556 | */ |
5557 | - public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
5557 | + public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5558 | 5558 | { |
5559 | 5559 | global $globalDBdriver; |
5560 | - $filter_query = $this->getFilter($filters,true,true); |
|
5561 | - $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
5560 | + $filter_query = $this->getFilter($filters, true, true); |
|
5561 | + $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
5562 | 5562 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
5563 | 5563 | if ($olderthanmonths > 0) { |
5564 | 5564 | if ($globalDBdriver == 'mysql') { |
@@ -5586,7 +5586,7 @@ discard block |
||
5586 | 5586 | $airport_array = array(); |
5587 | 5587 | $temp_array = array(); |
5588 | 5588 | |
5589 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5589 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5590 | 5590 | { |
5591 | 5591 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5592 | 5592 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5605,11 +5605,11 @@ discard block |
||
5605 | 5605 | * @return Array the airport list |
5606 | 5606 | * |
5607 | 5607 | */ |
5608 | - public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
5608 | + public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
5609 | 5609 | { |
5610 | 5610 | global $globalDBdriver; |
5611 | - $filter_query = $this->getFilter($filters,true,true); |
|
5612 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
5611 | + $filter_query = $this->getFilter($filters, true, true); |
|
5612 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
5613 | 5613 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
5614 | 5614 | if ($olderthanmonths > 0) { |
5615 | 5615 | if ($globalDBdriver == 'mysql') { |
@@ -5638,7 +5638,7 @@ discard block |
||
5638 | 5638 | $airport_array = array(); |
5639 | 5639 | $temp_array = array(); |
5640 | 5640 | |
5641 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5641 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5642 | 5642 | { |
5643 | 5643 | $temp_array['airline_icao'] = $row['airline_icao']; |
5644 | 5644 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5658,11 +5658,11 @@ discard block |
||
5658 | 5658 | * @return Array the airport list |
5659 | 5659 | * |
5660 | 5660 | */ |
5661 | - public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
|
5661 | + public function countAllDepartureAirportsByAirline($airline_icao, $filters = array()) |
|
5662 | 5662 | { |
5663 | - $filter_query = $this->getFilter($filters,true,true); |
|
5664 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
5665 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5663 | + $filter_query = $this->getFilter($filters, true, true); |
|
5664 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
5665 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5666 | 5666 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao |
5667 | 5667 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
5668 | 5668 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5674,7 +5674,7 @@ discard block |
||
5674 | 5674 | $airport_array = array(); |
5675 | 5675 | $temp_array = array(); |
5676 | 5676 | |
5677 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5677 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5678 | 5678 | { |
5679 | 5679 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5680 | 5680 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5696,11 +5696,11 @@ discard block |
||
5696 | 5696 | * @return Array the airport list |
5697 | 5697 | * |
5698 | 5698 | */ |
5699 | - public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
|
5699 | + public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array()) |
|
5700 | 5700 | { |
5701 | - $filter_query = $this->getFilter($filters,true,true); |
|
5702 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
5703 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5701 | + $filter_query = $this->getFilter($filters, true, true); |
|
5702 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
5703 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5704 | 5704 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
5705 | 5705 | GROUP BY spotter_output.departure_airport_country |
5706 | 5706 | ORDER BY airport_departure_country_count DESC"; |
@@ -5712,7 +5712,7 @@ discard block |
||
5712 | 5712 | $airport_array = array(); |
5713 | 5713 | $temp_array = array(); |
5714 | 5714 | |
5715 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5715 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5716 | 5716 | { |
5717 | 5717 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
5718 | 5718 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5731,11 +5731,11 @@ discard block |
||
5731 | 5731 | * @return Array the airport list |
5732 | 5732 | * |
5733 | 5733 | */ |
5734 | - public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
|
5734 | + public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array()) |
|
5735 | 5735 | { |
5736 | - $filter_query = $this->getFilter($filters,true,true); |
|
5737 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
5738 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5736 | + $filter_query = $this->getFilter($filters, true, true); |
|
5737 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
5738 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5739 | 5739 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao |
5740 | 5740 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
5741 | 5741 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5747,7 +5747,7 @@ discard block |
||
5747 | 5747 | $airport_array = array(); |
5748 | 5748 | $temp_array = array(); |
5749 | 5749 | |
5750 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5750 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5751 | 5751 | { |
5752 | 5752 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5753 | 5753 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5768,11 +5768,11 @@ discard block |
||
5768 | 5768 | * @return Array the airport list |
5769 | 5769 | * |
5770 | 5770 | */ |
5771 | - public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
5771 | + public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
5772 | 5772 | { |
5773 | - $filter_query = $this->getFilter($filters,true,true); |
|
5774 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
5775 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5773 | + $filter_query = $this->getFilter($filters, true, true); |
|
5774 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
5775 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5776 | 5776 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
5777 | 5777 | GROUP BY spotter_output.departure_airport_country |
5778 | 5778 | ORDER BY airport_departure_country_count DESC"; |
@@ -5784,7 +5784,7 @@ discard block |
||
5784 | 5784 | $airport_array = array(); |
5785 | 5785 | $temp_array = array(); |
5786 | 5786 | |
5787 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5787 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5788 | 5788 | { |
5789 | 5789 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
5790 | 5790 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5802,11 +5802,11 @@ discard block |
||
5802 | 5802 | * @return Array the airport list |
5803 | 5803 | * |
5804 | 5804 | */ |
5805 | - public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
|
5805 | + public function countAllDepartureAirportsByRegistration($registration, $filters = array()) |
|
5806 | 5806 | { |
5807 | - $filter_query = $this->getFilter($filters,true,true); |
|
5808 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
5809 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5807 | + $filter_query = $this->getFilter($filters, true, true); |
|
5808 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
5809 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5810 | 5810 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration |
5811 | 5811 | GROUP BY spotter_output.departure_airport_icao |
5812 | 5812 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5818,7 +5818,7 @@ discard block |
||
5818 | 5818 | $airport_array = array(); |
5819 | 5819 | $temp_array = array(); |
5820 | 5820 | |
5821 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5821 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5822 | 5822 | { |
5823 | 5823 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5824 | 5824 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5839,11 +5839,11 @@ discard block |
||
5839 | 5839 | * @return Array the airport list |
5840 | 5840 | * |
5841 | 5841 | */ |
5842 | - public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
|
5842 | + public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array()) |
|
5843 | 5843 | { |
5844 | - $filter_query = $this->getFilter($filters,true,true); |
|
5845 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
5846 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5844 | + $filter_query = $this->getFilter($filters, true, true); |
|
5845 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
5846 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5847 | 5847 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration |
5848 | 5848 | GROUP BY spotter_output.departure_airport_country |
5849 | 5849 | ORDER BY airport_departure_country_count DESC"; |
@@ -5855,7 +5855,7 @@ discard block |
||
5855 | 5855 | $airport_array = array(); |
5856 | 5856 | $temp_array = array(); |
5857 | 5857 | |
5858 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5858 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5859 | 5859 | { |
5860 | 5860 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
5861 | 5861 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5873,11 +5873,11 @@ discard block |
||
5873 | 5873 | * @return Array the airport list |
5874 | 5874 | * |
5875 | 5875 | */ |
5876 | - public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
|
5876 | + public function countAllDepartureAirportsByAirport($airport_icao, $filters = array()) |
|
5877 | 5877 | { |
5878 | - $filter_query = $this->getFilter($filters,true,true); |
|
5879 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
5880 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5878 | + $filter_query = $this->getFilter($filters, true, true); |
|
5879 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
5880 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5881 | 5881 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao |
5882 | 5882 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
5883 | 5883 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5889,7 +5889,7 @@ discard block |
||
5889 | 5889 | $airport_array = array(); |
5890 | 5890 | $temp_array = array(); |
5891 | 5891 | |
5892 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5892 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5893 | 5893 | { |
5894 | 5894 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5895 | 5895 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5910,11 +5910,11 @@ discard block |
||
5910 | 5910 | * @return Array the airport list |
5911 | 5911 | * |
5912 | 5912 | */ |
5913 | - public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
|
5913 | + public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array()) |
|
5914 | 5914 | { |
5915 | - $filter_query = $this->getFilter($filters,true,true); |
|
5916 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
5917 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5915 | + $filter_query = $this->getFilter($filters, true, true); |
|
5916 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
5917 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5918 | 5918 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao |
5919 | 5919 | GROUP BY spotter_output.departure_airport_country |
5920 | 5920 | ORDER BY airport_departure_country_count DESC"; |
@@ -5926,7 +5926,7 @@ discard block |
||
5926 | 5926 | $airport_array = array(); |
5927 | 5927 | $temp_array = array(); |
5928 | 5928 | |
5929 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5929 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5930 | 5930 | { |
5931 | 5931 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
5932 | 5932 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5945,11 +5945,11 @@ discard block |
||
5945 | 5945 | * @return Array the airport list |
5946 | 5946 | * |
5947 | 5947 | */ |
5948 | - public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
5948 | + public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
5949 | 5949 | { |
5950 | - $filter_query = $this->getFilter($filters,true,true); |
|
5951 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
5952 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5950 | + $filter_query = $this->getFilter($filters, true, true); |
|
5951 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
5952 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5953 | 5953 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
5954 | 5954 | GROUP BY spotter_output.departure_airport_icao |
5955 | 5955 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5961,7 +5961,7 @@ discard block |
||
5961 | 5961 | $airport_array = array(); |
5962 | 5962 | $temp_array = array(); |
5963 | 5963 | |
5964 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5964 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
5965 | 5965 | { |
5966 | 5966 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
5967 | 5967 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5982,11 +5982,11 @@ discard block |
||
5982 | 5982 | * @return Array the airport list |
5983 | 5983 | * |
5984 | 5984 | */ |
5985 | - public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
5985 | + public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
5986 | 5986 | { |
5987 | - $filter_query = $this->getFilter($filters,true,true); |
|
5988 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
5989 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5987 | + $filter_query = $this->getFilter($filters, true, true); |
|
5988 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
5989 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
5990 | 5990 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
5991 | 5991 | GROUP BY spotter_output.departure_airport_country |
5992 | 5992 | ORDER BY airport_departure_country_count DESC"; |
@@ -5998,7 +5998,7 @@ discard block |
||
5998 | 5998 | $airport_array = array(); |
5999 | 5999 | $temp_array = array(); |
6000 | 6000 | |
6001 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6001 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6002 | 6002 | { |
6003 | 6003 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6004 | 6004 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6016,11 +6016,11 @@ discard block |
||
6016 | 6016 | * @return Array the airport list |
6017 | 6017 | * |
6018 | 6018 | */ |
6019 | - public function countAllDepartureAirportsByDate($date,$filters = array()) |
|
6019 | + public function countAllDepartureAirportsByDate($date, $filters = array()) |
|
6020 | 6020 | { |
6021 | 6021 | global $globalTimezone, $globalDBdriver; |
6022 | - $filter_query = $this->getFilter($filters,true,true); |
|
6023 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
6022 | + $filter_query = $this->getFilter($filters, true, true); |
|
6023 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
6024 | 6024 | if ($globalTimezone != '') { |
6025 | 6025 | date_default_timezone_set($globalTimezone); |
6026 | 6026 | $datetime = new DateTime($date); |
@@ -6028,12 +6028,12 @@ discard block |
||
6028 | 6028 | } else $offset = '+00:00'; |
6029 | 6029 | |
6030 | 6030 | if ($globalDBdriver == 'mysql') { |
6031 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6031 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6032 | 6032 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
6033 | 6033 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6034 | 6034 | ORDER BY airport_departure_icao_count DESC"; |
6035 | 6035 | } else { |
6036 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6036 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6037 | 6037 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
6038 | 6038 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6039 | 6039 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6045,7 +6045,7 @@ discard block |
||
6045 | 6045 | $airport_array = array(); |
6046 | 6046 | $temp_array = array(); |
6047 | 6047 | |
6048 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6048 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6049 | 6049 | { |
6050 | 6050 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
6051 | 6051 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6066,11 +6066,11 @@ discard block |
||
6066 | 6066 | * @return Array the airport list |
6067 | 6067 | * |
6068 | 6068 | */ |
6069 | - public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
|
6069 | + public function countAllDepartureAirportCountriesByDate($date, $filters = array()) |
|
6070 | 6070 | { |
6071 | 6071 | global $globalTimezone, $globalDBdriver; |
6072 | - $filter_query = $this->getFilter($filters,true,true); |
|
6073 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
6072 | + $filter_query = $this->getFilter($filters, true, true); |
|
6073 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
6074 | 6074 | if ($globalTimezone != '') { |
6075 | 6075 | date_default_timezone_set($globalTimezone); |
6076 | 6076 | $datetime = new DateTime($date); |
@@ -6078,12 +6078,12 @@ discard block |
||
6078 | 6078 | } else $offset = '+00:00'; |
6079 | 6079 | |
6080 | 6080 | if ($globalDBdriver == 'mysql') { |
6081 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6081 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6082 | 6082 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
6083 | 6083 | GROUP BY spotter_output.departure_airport_country |
6084 | 6084 | ORDER BY airport_departure_country_count DESC"; |
6085 | 6085 | } else { |
6086 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6086 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6087 | 6087 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
6088 | 6088 | GROUP BY spotter_output.departure_airport_country |
6089 | 6089 | ORDER BY airport_departure_country_count DESC"; |
@@ -6095,7 +6095,7 @@ discard block |
||
6095 | 6095 | $airport_array = array(); |
6096 | 6096 | $temp_array = array(); |
6097 | 6097 | |
6098 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6098 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6099 | 6099 | { |
6100 | 6100 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6101 | 6101 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6113,11 +6113,11 @@ discard block |
||
6113 | 6113 | * @return Array the airport list |
6114 | 6114 | * |
6115 | 6115 | */ |
6116 | - public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
|
6116 | + public function countAllDepartureAirportsByIdent($ident, $filters = array()) |
|
6117 | 6117 | { |
6118 | - $filter_query = $this->getFilter($filters,true,true); |
|
6119 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
6120 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6118 | + $filter_query = $this->getFilter($filters, true, true); |
|
6119 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
6120 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6121 | 6121 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident |
6122 | 6122 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6123 | 6123 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6129,7 +6129,7 @@ discard block |
||
6129 | 6129 | $airport_array = array(); |
6130 | 6130 | $temp_array = array(); |
6131 | 6131 | |
6132 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6132 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6133 | 6133 | { |
6134 | 6134 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
6135 | 6135 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6151,11 +6151,11 @@ discard block |
||
6151 | 6151 | * @return Array the airport list |
6152 | 6152 | * |
6153 | 6153 | */ |
6154 | - public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
|
6154 | + public function countAllDepartureAirportCountriesByIdent($ident, $filters = array()) |
|
6155 | 6155 | { |
6156 | - $filter_query = $this->getFilter($filters,true,true); |
|
6157 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
6158 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6156 | + $filter_query = $this->getFilter($filters, true, true); |
|
6157 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
6158 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6159 | 6159 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident |
6160 | 6160 | GROUP BY spotter_output.departure_airport_country |
6161 | 6161 | ORDER BY airport_departure_country_count DESC"; |
@@ -6167,7 +6167,7 @@ discard block |
||
6167 | 6167 | $airport_array = array(); |
6168 | 6168 | $temp_array = array(); |
6169 | 6169 | |
6170 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6170 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6171 | 6171 | { |
6172 | 6172 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6173 | 6173 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6186,12 +6186,12 @@ discard block |
||
6186 | 6186 | * @return Array the airport list |
6187 | 6187 | * |
6188 | 6188 | */ |
6189 | - public function countAllDepartureAirportsByCountry($country,$filters = array()) |
|
6189 | + public function countAllDepartureAirportsByCountry($country, $filters = array()) |
|
6190 | 6190 | { |
6191 | - $filter_query = $this->getFilter($filters,true,true); |
|
6192 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
6191 | + $filter_query = $this->getFilter($filters, true, true); |
|
6192 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
6193 | 6193 | |
6194 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6194 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
6195 | 6195 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
6196 | 6196 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6197 | 6197 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6203,7 +6203,7 @@ discard block |
||
6203 | 6203 | $airport_array = array(); |
6204 | 6204 | $temp_array = array(); |
6205 | 6205 | |
6206 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6206 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6207 | 6207 | { |
6208 | 6208 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
6209 | 6209 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6224,11 +6224,11 @@ discard block |
||
6224 | 6224 | * @return Array the airport list |
6225 | 6225 | * |
6226 | 6226 | */ |
6227 | - public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
|
6227 | + public function countAllDepartureAirportCountriesByCountry($country, $filters = array()) |
|
6228 | 6228 | { |
6229 | - $filter_query = $this->getFilter($filters,true,true); |
|
6230 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
6231 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6229 | + $filter_query = $this->getFilter($filters, true, true); |
|
6230 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
6231 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
6232 | 6232 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
6233 | 6233 | GROUP BY spotter_output.departure_airport_country |
6234 | 6234 | ORDER BY airport_departure_country_count DESC"; |
@@ -6240,7 +6240,7 @@ discard block |
||
6240 | 6240 | $airport_array = array(); |
6241 | 6241 | $temp_array = array(); |
6242 | 6242 | |
6243 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6243 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6244 | 6244 | { |
6245 | 6245 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
6246 | 6246 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6258,11 +6258,11 @@ discard block |
||
6258 | 6258 | * @return Array the airport list |
6259 | 6259 | * |
6260 | 6260 | */ |
6261 | - public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
6261 | + public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
6262 | 6262 | { |
6263 | 6263 | global $globalDBdriver; |
6264 | - $filter_query = $this->getFilter($filters,true,true); |
|
6265 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6264 | + $filter_query = $this->getFilter($filters, true, true); |
|
6265 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6266 | 6266 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
6267 | 6267 | if ($olderthanmonths > 0) { |
6268 | 6268 | if ($globalDBdriver == 'mysql') { |
@@ -6297,7 +6297,7 @@ discard block |
||
6297 | 6297 | $airport_array = array(); |
6298 | 6298 | $temp_array = array(); |
6299 | 6299 | |
6300 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6300 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6301 | 6301 | { |
6302 | 6302 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6303 | 6303 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6320,11 +6320,11 @@ discard block |
||
6320 | 6320 | * @return Array the airport list |
6321 | 6321 | * |
6322 | 6322 | */ |
6323 | - public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
6323 | + public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
6324 | 6324 | { |
6325 | 6325 | global $globalDBdriver; |
6326 | - $filter_query = $this->getFilter($filters,true,true); |
|
6327 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6326 | + $filter_query = $this->getFilter($filters, true, true); |
|
6327 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6328 | 6328 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' "; |
6329 | 6329 | if ($olderthanmonths > 0) { |
6330 | 6330 | if ($globalDBdriver == 'mysql') { |
@@ -6359,7 +6359,7 @@ discard block |
||
6359 | 6359 | $airport_array = array(); |
6360 | 6360 | $temp_array = array(); |
6361 | 6361 | |
6362 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6362 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6363 | 6363 | { |
6364 | 6364 | $temp_array['airline_icao'] = $row['airline_icao']; |
6365 | 6365 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
@@ -6384,11 +6384,11 @@ discard block |
||
6384 | 6384 | * @return Array the airport list |
6385 | 6385 | * |
6386 | 6386 | */ |
6387 | - public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
6387 | + public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
6388 | 6388 | { |
6389 | 6389 | global $globalDBdriver; |
6390 | - $filter_query = $this->getFilter($filters,true,true); |
|
6391 | - $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
6390 | + $filter_query = $this->getFilter($filters, true, true); |
|
6391 | + $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
6392 | 6392 | FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
6393 | 6393 | if ($olderthanmonths > 0) { |
6394 | 6394 | if ($globalDBdriver == 'mysql') { |
@@ -6422,7 +6422,7 @@ discard block |
||
6422 | 6422 | $airport_array = array(); |
6423 | 6423 | $temp_array = array(); |
6424 | 6424 | |
6425 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6425 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6426 | 6426 | { |
6427 | 6427 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6428 | 6428 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6445,11 +6445,11 @@ discard block |
||
6445 | 6445 | * @return Array the airport list |
6446 | 6446 | * |
6447 | 6447 | */ |
6448 | - public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
6448 | + public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
6449 | 6449 | { |
6450 | 6450 | global $globalDBdriver; |
6451 | - $filter_query = $this->getFilter($filters,true,true); |
|
6452 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
6451 | + $filter_query = $this->getFilter($filters, true, true); |
|
6452 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
6453 | 6453 | FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
6454 | 6454 | if ($olderthanmonths > 0) { |
6455 | 6455 | if ($globalDBdriver == 'mysql') { |
@@ -6484,7 +6484,7 @@ discard block |
||
6484 | 6484 | $airport_array = array(); |
6485 | 6485 | $temp_array = array(); |
6486 | 6486 | |
6487 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6487 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6488 | 6488 | { |
6489 | 6489 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6490 | 6490 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6510,9 +6510,9 @@ discard block |
||
6510 | 6510 | */ |
6511 | 6511 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
6512 | 6512 | { |
6513 | - $filter_query = $this->getFilter($filters,true,true); |
|
6514 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
6515 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6513 | + $filter_query = $this->getFilter($filters, true, true); |
|
6514 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
6515 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6516 | 6516 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao |
6517 | 6517 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6518 | 6518 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6523,7 +6523,7 @@ discard block |
||
6523 | 6523 | $airport_array = array(); |
6524 | 6524 | $temp_array = array(); |
6525 | 6525 | |
6526 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6526 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6527 | 6527 | { |
6528 | 6528 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6529 | 6529 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6544,12 +6544,12 @@ discard block |
||
6544 | 6544 | * @return Array the airport list |
6545 | 6545 | * |
6546 | 6546 | */ |
6547 | - public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
|
6547 | + public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array()) |
|
6548 | 6548 | { |
6549 | - $filter_query = $this->getFilter($filters,true,true); |
|
6550 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
6549 | + $filter_query = $this->getFilter($filters, true, true); |
|
6550 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
6551 | 6551 | |
6552 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6552 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6553 | 6553 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
6554 | 6554 | GROUP BY spotter_output.arrival_airport_country |
6555 | 6555 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6561,7 +6561,7 @@ discard block |
||
6561 | 6561 | $airport_array = array(); |
6562 | 6562 | $temp_array = array(); |
6563 | 6563 | |
6564 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6564 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6565 | 6565 | { |
6566 | 6566 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6567 | 6567 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6579,11 +6579,11 @@ discard block |
||
6579 | 6579 | * @return Array the airport list |
6580 | 6580 | * |
6581 | 6581 | */ |
6582 | - public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
|
6582 | + public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array()) |
|
6583 | 6583 | { |
6584 | - $filter_query = $this->getFilter($filters,true,true); |
|
6585 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
6586 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6584 | + $filter_query = $this->getFilter($filters, true, true); |
|
6585 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
6586 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6587 | 6587 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao |
6588 | 6588 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6589 | 6589 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6595,7 +6595,7 @@ discard block |
||
6595 | 6595 | $airport_array = array(); |
6596 | 6596 | $temp_array = array(); |
6597 | 6597 | |
6598 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6598 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6599 | 6599 | { |
6600 | 6600 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6601 | 6601 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6617,11 +6617,11 @@ discard block |
||
6617 | 6617 | * @return Array the airport list |
6618 | 6618 | * |
6619 | 6619 | */ |
6620 | - public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
6620 | + public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
6621 | 6621 | { |
6622 | - $filter_query = $this->getFilter($filters,true,true); |
|
6623 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
6624 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6622 | + $filter_query = $this->getFilter($filters, true, true); |
|
6623 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
6624 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6625 | 6625 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
6626 | 6626 | GROUP BY spotter_output.arrival_airport_country |
6627 | 6627 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6633,7 +6633,7 @@ discard block |
||
6633 | 6633 | $airport_array = array(); |
6634 | 6634 | $temp_array = array(); |
6635 | 6635 | |
6636 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6636 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6637 | 6637 | { |
6638 | 6638 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6639 | 6639 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6651,12 +6651,12 @@ discard block |
||
6651 | 6651 | * @return Array the airport list |
6652 | 6652 | * |
6653 | 6653 | */ |
6654 | - public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
|
6654 | + public function countAllArrivalAirportsByRegistration($registration, $filters = array()) |
|
6655 | 6655 | { |
6656 | - $filter_query = $this->getFilter($filters,true,true); |
|
6657 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
6656 | + $filter_query = $this->getFilter($filters, true, true); |
|
6657 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
6658 | 6658 | |
6659 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6659 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6660 | 6660 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration |
6661 | 6661 | GROUP BY spotter_output.arrival_airport_icao |
6662 | 6662 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6668,7 +6668,7 @@ discard block |
||
6668 | 6668 | $airport_array = array(); |
6669 | 6669 | $temp_array = array(); |
6670 | 6670 | |
6671 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6671 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6672 | 6672 | { |
6673 | 6673 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6674 | 6674 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6689,11 +6689,11 @@ discard block |
||
6689 | 6689 | * @return Array the airport list |
6690 | 6690 | * |
6691 | 6691 | */ |
6692 | - public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
|
6692 | + public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array()) |
|
6693 | 6693 | { |
6694 | - $filter_query = $this->getFilter($filters,true,true); |
|
6695 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
6696 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6694 | + $filter_query = $this->getFilter($filters, true, true); |
|
6695 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
6696 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6697 | 6697 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration |
6698 | 6698 | GROUP BY spotter_output.arrival_airport_country |
6699 | 6699 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6705,7 +6705,7 @@ discard block |
||
6705 | 6705 | $airport_array = array(); |
6706 | 6706 | $temp_array = array(); |
6707 | 6707 | |
6708 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6708 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6709 | 6709 | { |
6710 | 6710 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6711 | 6711 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6724,11 +6724,11 @@ discard block |
||
6724 | 6724 | * @return Array the airport list |
6725 | 6725 | * |
6726 | 6726 | */ |
6727 | - public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
|
6727 | + public function countAllArrivalAirportsByAirport($airport_icao, $filters = array()) |
|
6728 | 6728 | { |
6729 | - $filter_query = $this->getFilter($filters,true,true); |
|
6730 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
6731 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6729 | + $filter_query = $this->getFilter($filters, true, true); |
|
6730 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
6731 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6732 | 6732 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao |
6733 | 6733 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6734 | 6734 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6740,7 +6740,7 @@ discard block |
||
6740 | 6740 | $airport_array = array(); |
6741 | 6741 | $temp_array = array(); |
6742 | 6742 | |
6743 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6743 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6744 | 6744 | { |
6745 | 6745 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6746 | 6746 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6761,11 +6761,11 @@ discard block |
||
6761 | 6761 | * @return Array the airport list |
6762 | 6762 | * |
6763 | 6763 | */ |
6764 | - public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
|
6764 | + public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array()) |
|
6765 | 6765 | { |
6766 | - $filter_query = $this->getFilter($filters,true,true); |
|
6767 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
6768 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6766 | + $filter_query = $this->getFilter($filters, true, true); |
|
6767 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
6768 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6769 | 6769 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao |
6770 | 6770 | GROUP BY spotter_output.arrival_airport_country |
6771 | 6771 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6777,7 +6777,7 @@ discard block |
||
6777 | 6777 | $airport_array = array(); |
6778 | 6778 | $temp_array = array(); |
6779 | 6779 | |
6780 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6780 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6781 | 6781 | { |
6782 | 6782 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6783 | 6783 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6795,11 +6795,11 @@ discard block |
||
6795 | 6795 | * @return Array the airport list |
6796 | 6796 | * |
6797 | 6797 | */ |
6798 | - public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
6798 | + public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
6799 | 6799 | { |
6800 | - $filter_query = $this->getFilter($filters,true,true); |
|
6801 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
6802 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6800 | + $filter_query = $this->getFilter($filters, true, true); |
|
6801 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
6802 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6803 | 6803 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
6804 | 6804 | GROUP BY spotter_output.arrival_airport_icao |
6805 | 6805 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6811,7 +6811,7 @@ discard block |
||
6811 | 6811 | $airport_array = array(); |
6812 | 6812 | $temp_array = array(); |
6813 | 6813 | |
6814 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6814 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6815 | 6815 | { |
6816 | 6816 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6817 | 6817 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6833,11 +6833,11 @@ discard block |
||
6833 | 6833 | * @return Array the airport list |
6834 | 6834 | * |
6835 | 6835 | */ |
6836 | - public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
6836 | + public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
6837 | 6837 | { |
6838 | - $filter_query = $this->getFilter($filters,true,true); |
|
6839 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
6840 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6838 | + $filter_query = $this->getFilter($filters, true, true); |
|
6839 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
6840 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6841 | 6841 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
6842 | 6842 | GROUP BY spotter_output.arrival_airport_country |
6843 | 6843 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6849,7 +6849,7 @@ discard block |
||
6849 | 6849 | $airport_array = array(); |
6850 | 6850 | $temp_array = array(); |
6851 | 6851 | |
6852 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6852 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6853 | 6853 | { |
6854 | 6854 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6855 | 6855 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6868,11 +6868,11 @@ discard block |
||
6868 | 6868 | * @return Array the airport list |
6869 | 6869 | * |
6870 | 6870 | */ |
6871 | - public function countAllArrivalAirportsByDate($date,$filters = array()) |
|
6871 | + public function countAllArrivalAirportsByDate($date, $filters = array()) |
|
6872 | 6872 | { |
6873 | 6873 | global $globalTimezone, $globalDBdriver; |
6874 | - $filter_query = $this->getFilter($filters,true,true); |
|
6875 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
6874 | + $filter_query = $this->getFilter($filters, true, true); |
|
6875 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
6876 | 6876 | if ($globalTimezone != '') { |
6877 | 6877 | date_default_timezone_set($globalTimezone); |
6878 | 6878 | $datetime = new DateTime($date); |
@@ -6880,12 +6880,12 @@ discard block |
||
6880 | 6880 | } else $offset = '+00:00'; |
6881 | 6881 | |
6882 | 6882 | if ($globalDBdriver == 'mysql') { |
6883 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6883 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6884 | 6884 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
6885 | 6885 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6886 | 6886 | ORDER BY airport_arrival_icao_count DESC"; |
6887 | 6887 | } else { |
6888 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6888 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6889 | 6889 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
6890 | 6890 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6891 | 6891 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6897,7 +6897,7 @@ discard block |
||
6897 | 6897 | $airport_array = array(); |
6898 | 6898 | $temp_array = array(); |
6899 | 6899 | |
6900 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6900 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6901 | 6901 | { |
6902 | 6902 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6903 | 6903 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6921,8 +6921,8 @@ discard block |
||
6921 | 6921 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
6922 | 6922 | { |
6923 | 6923 | global $globalTimezone, $globalDBdriver; |
6924 | - $filter_query = $this->getFilter($filters,true,true); |
|
6925 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
6924 | + $filter_query = $this->getFilter($filters, true, true); |
|
6925 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
6926 | 6926 | if ($globalTimezone != '') { |
6927 | 6927 | date_default_timezone_set($globalTimezone); |
6928 | 6928 | $datetime = new DateTime($date); |
@@ -6930,12 +6930,12 @@ discard block |
||
6930 | 6930 | } else $offset = '+00:00'; |
6931 | 6931 | |
6932 | 6932 | if ($globalDBdriver == 'mysql') { |
6933 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6933 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6934 | 6934 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
6935 | 6935 | GROUP BY spotter_output.arrival_airport_country |
6936 | 6936 | ORDER BY airport_arrival_country_count DESC"; |
6937 | 6937 | } else { |
6938 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6938 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
6939 | 6939 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
6940 | 6940 | GROUP BY spotter_output.arrival_airport_country |
6941 | 6941 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6947,7 +6947,7 @@ discard block |
||
6947 | 6947 | $airport_array = array(); |
6948 | 6948 | $temp_array = array(); |
6949 | 6949 | |
6950 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6950 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6951 | 6951 | { |
6952 | 6952 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
6953 | 6953 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6965,11 +6965,11 @@ discard block |
||
6965 | 6965 | * @return Array the airport list |
6966 | 6966 | * |
6967 | 6967 | */ |
6968 | - public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
|
6968 | + public function countAllArrivalAirportsByIdent($ident, $filters = array()) |
|
6969 | 6969 | { |
6970 | - $filter_query = $this->getFilter($filters,true,true); |
|
6971 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
6972 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6970 | + $filter_query = $this->getFilter($filters, true, true); |
|
6971 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
6972 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6973 | 6973 | FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident |
6974 | 6974 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6975 | 6975 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6981,7 +6981,7 @@ discard block |
||
6981 | 6981 | $airport_array = array(); |
6982 | 6982 | $temp_array = array(); |
6983 | 6983 | |
6984 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6984 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
6985 | 6985 | { |
6986 | 6986 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
6987 | 6987 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7004,9 +7004,9 @@ discard block |
||
7004 | 7004 | */ |
7005 | 7005 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
7006 | 7006 | { |
7007 | - $filter_query = $this->getFilter($filters,true,true); |
|
7008 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
7009 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7007 | + $filter_query = $this->getFilter($filters, true, true); |
|
7008 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
7009 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7010 | 7010 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident |
7011 | 7011 | GROUP BY spotter_output.arrival_airport_country |
7012 | 7012 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7018,7 +7018,7 @@ discard block |
||
7018 | 7018 | $airport_array = array(); |
7019 | 7019 | $temp_array = array(); |
7020 | 7020 | |
7021 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7021 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7022 | 7022 | { |
7023 | 7023 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
7024 | 7024 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7037,11 +7037,11 @@ discard block |
||
7037 | 7037 | * @return Array the airport list |
7038 | 7038 | * |
7039 | 7039 | */ |
7040 | - public function countAllArrivalAirportsByCountry($country,$filters = array()) |
|
7040 | + public function countAllArrivalAirportsByCountry($country, $filters = array()) |
|
7041 | 7041 | { |
7042 | - $filter_query = $this->getFilter($filters,true,true); |
|
7043 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
7044 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
7042 | + $filter_query = $this->getFilter($filters, true, true); |
|
7043 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
7044 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
7045 | 7045 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
7046 | 7046 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7047 | 7047 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7053,7 +7053,7 @@ discard block |
||
7053 | 7053 | $airport_array = array(); |
7054 | 7054 | $temp_array = array(); |
7055 | 7055 | |
7056 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7056 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7057 | 7057 | { |
7058 | 7058 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
7059 | 7059 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7074,11 +7074,11 @@ discard block |
||
7074 | 7074 | * @return Array the airport list |
7075 | 7075 | * |
7076 | 7076 | */ |
7077 | - public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
|
7077 | + public function countAllArrivalAirportCountriesByCountry($country, $filters = array()) |
|
7078 | 7078 | { |
7079 | - $filter_query = $this->getFilter($filters,true,true); |
|
7080 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
7081 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7079 | + $filter_query = $this->getFilter($filters, true, true); |
|
7080 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
7081 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
7082 | 7082 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
7083 | 7083 | GROUP BY spotter_output.arrival_airport_country |
7084 | 7084 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7090,7 +7090,7 @@ discard block |
||
7090 | 7090 | $airport_array = array(); |
7091 | 7091 | $temp_array = array(); |
7092 | 7092 | |
7093 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7093 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7094 | 7094 | { |
7095 | 7095 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
7096 | 7096 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7111,7 +7111,7 @@ discard block |
||
7111 | 7111 | */ |
7112 | 7112 | public function countAllDepartureCountries($filters = array()) |
7113 | 7113 | { |
7114 | - $filter_query = $this->getFilter($filters,true,true); |
|
7114 | + $filter_query = $this->getFilter($filters, true, true); |
|
7115 | 7115 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
7116 | 7116 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
7117 | 7117 | $query .= " GROUP BY spotter_output.departure_airport_country |
@@ -7125,7 +7125,7 @@ discard block |
||
7125 | 7125 | $airport_array = array(); |
7126 | 7126 | $temp_array = array(); |
7127 | 7127 | |
7128 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7128 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7129 | 7129 | { |
7130 | 7130 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
7131 | 7131 | $temp_array['airport_departure_country'] = $row['departure_airport_country']; |
@@ -7143,9 +7143,9 @@ discard block |
||
7143 | 7143 | * @return Array the airport arrival list |
7144 | 7144 | * |
7145 | 7145 | */ |
7146 | - public function countAllArrivalCountries($limit = true,$filters = array()) |
|
7146 | + public function countAllArrivalCountries($limit = true, $filters = array()) |
|
7147 | 7147 | { |
7148 | - $filter_query = $this->getFilter($filters,true,true); |
|
7148 | + $filter_query = $this->getFilter($filters, true, true); |
|
7149 | 7149 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
7150 | 7150 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
7151 | 7151 | $query .= " GROUP BY spotter_output.arrival_airport_country |
@@ -7159,7 +7159,7 @@ discard block |
||
7159 | 7159 | $airport_array = array(); |
7160 | 7160 | $temp_array = array(); |
7161 | 7161 | |
7162 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7162 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7163 | 7163 | { |
7164 | 7164 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
7165 | 7165 | $temp_array['airport_arrival_country'] = $row['arrival_airport_country']; |
@@ -7182,8 +7182,8 @@ discard block |
||
7182 | 7182 | */ |
7183 | 7183 | public function countAllRoutes($filters = array()) |
7184 | 7184 | { |
7185 | - $filter_query = $this->getFilter($filters,true,true); |
|
7186 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7185 | + $filter_query = $this->getFilter($filters, true, true); |
|
7186 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7187 | 7187 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA' |
7188 | 7188 | GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
7189 | 7189 | ORDER BY route_count DESC |
@@ -7196,7 +7196,7 @@ discard block |
||
7196 | 7196 | $routes_array = array(); |
7197 | 7197 | $temp_array = array(); |
7198 | 7198 | |
7199 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7199 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7200 | 7200 | { |
7201 | 7201 | $temp_array['route_count'] = $row['route_count']; |
7202 | 7202 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7223,11 +7223,11 @@ discard block |
||
7223 | 7223 | * @return Array the route list |
7224 | 7224 | * |
7225 | 7225 | */ |
7226 | - public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
|
7226 | + public function countAllRoutesByAircraft($aircraft_icao, $filters = array()) |
|
7227 | 7227 | { |
7228 | - $filter_query = $this->getFilter($filters,true,true); |
|
7229 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
7230 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7228 | + $filter_query = $this->getFilter($filters, true, true); |
|
7229 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
7230 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7231 | 7231 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
7232 | 7232 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7233 | 7233 | ORDER BY route_count DESC"; |
@@ -7238,7 +7238,7 @@ discard block |
||
7238 | 7238 | $routes_array = array(); |
7239 | 7239 | $temp_array = array(); |
7240 | 7240 | |
7241 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7241 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7242 | 7242 | { |
7243 | 7243 | $temp_array['route_count'] = $row['route_count']; |
7244 | 7244 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7265,9 +7265,9 @@ discard block |
||
7265 | 7265 | */ |
7266 | 7266 | public function countAllRoutesByRegistration($registration, $filters = array()) |
7267 | 7267 | { |
7268 | - $filter_query = $this->getFilter($filters,true,true); |
|
7268 | + $filter_query = $this->getFilter($filters, true, true); |
|
7269 | 7269 | $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
7270 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7270 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7271 | 7271 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration |
7272 | 7272 | GROUP BY route |
7273 | 7273 | ORDER BY route_count DESC"; |
@@ -7279,7 +7279,7 @@ discard block |
||
7279 | 7279 | $routes_array = array(); |
7280 | 7280 | $temp_array = array(); |
7281 | 7281 | |
7282 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7282 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7283 | 7283 | { |
7284 | 7284 | $temp_array['route_count'] = $row['route_count']; |
7285 | 7285 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7307,9 +7307,9 @@ discard block |
||
7307 | 7307 | */ |
7308 | 7308 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
7309 | 7309 | { |
7310 | - $filter_query = $this->getFilter($filters,true,true); |
|
7311 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
7312 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7310 | + $filter_query = $this->getFilter($filters, true, true); |
|
7311 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
7312 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7313 | 7313 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao |
7314 | 7314 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7315 | 7315 | ORDER BY route_count DESC"; |
@@ -7321,7 +7321,7 @@ discard block |
||
7321 | 7321 | $routes_array = array(); |
7322 | 7322 | $temp_array = array(); |
7323 | 7323 | |
7324 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7324 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7325 | 7325 | { |
7326 | 7326 | $temp_array['route_count'] = $row['route_count']; |
7327 | 7327 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7349,9 +7349,9 @@ discard block |
||
7349 | 7349 | */ |
7350 | 7350 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
7351 | 7351 | { |
7352 | - $filter_query = $this->getFilter($filters,true,true); |
|
7353 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
7354 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7352 | + $filter_query = $this->getFilter($filters, true, true); |
|
7353 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
7354 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7355 | 7355 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
7356 | 7356 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7357 | 7357 | ORDER BY route_count DESC"; |
@@ -7362,7 +7362,7 @@ discard block |
||
7362 | 7362 | $routes_array = array(); |
7363 | 7363 | $temp_array = array(); |
7364 | 7364 | |
7365 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7365 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7366 | 7366 | { |
7367 | 7367 | $temp_array['route_count'] = $row['route_count']; |
7368 | 7368 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7390,9 +7390,9 @@ discard block |
||
7390 | 7390 | */ |
7391 | 7391 | public function countAllRoutesByCountry($country, $filters = array()) |
7392 | 7392 | { |
7393 | - $filter_query = $this->getFilter($filters,true,true); |
|
7394 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
7395 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7393 | + $filter_query = $this->getFilter($filters, true, true); |
|
7394 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
7395 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7396 | 7396 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
7397 | 7397 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7398 | 7398 | ORDER BY route_count DESC"; |
@@ -7403,7 +7403,7 @@ discard block |
||
7403 | 7403 | $routes_array = array(); |
7404 | 7404 | $temp_array = array(); |
7405 | 7405 | |
7406 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7406 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7407 | 7407 | { |
7408 | 7408 | $temp_array['route_count'] = $row['route_count']; |
7409 | 7409 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7431,8 +7431,8 @@ discard block |
||
7431 | 7431 | public function countAllRoutesByDate($date, $filters = array()) |
7432 | 7432 | { |
7433 | 7433 | global $globalTimezone, $globalDBdriver; |
7434 | - $filter_query = $this->getFilter($filters,true,true); |
|
7435 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
7434 | + $filter_query = $this->getFilter($filters, true, true); |
|
7435 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
7436 | 7436 | if ($globalTimezone != '') { |
7437 | 7437 | date_default_timezone_set($globalTimezone); |
7438 | 7438 | $datetime = new DateTime($date); |
@@ -7440,12 +7440,12 @@ discard block |
||
7440 | 7440 | } else $offset = '+00:00'; |
7441 | 7441 | |
7442 | 7442 | if ($globalDBdriver == 'mysql') { |
7443 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7443 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7444 | 7444 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
7445 | 7445 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7446 | 7446 | ORDER BY route_count DESC"; |
7447 | 7447 | } else { |
7448 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7448 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7449 | 7449 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
7450 | 7450 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7451 | 7451 | ORDER BY route_count DESC"; |
@@ -7457,7 +7457,7 @@ discard block |
||
7457 | 7457 | $routes_array = array(); |
7458 | 7458 | $temp_array = array(); |
7459 | 7459 | |
7460 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7460 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7461 | 7461 | { |
7462 | 7462 | $temp_array['route_count'] = $row['route_count']; |
7463 | 7463 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7484,9 +7484,9 @@ discard block |
||
7484 | 7484 | */ |
7485 | 7485 | public function countAllRoutesByIdent($ident, $filters = array()) |
7486 | 7486 | { |
7487 | - $filter_query = $this->getFilter($filters,true,true); |
|
7488 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
7489 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7487 | + $filter_query = $this->getFilter($filters, true, true); |
|
7488 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
7489 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7490 | 7490 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident |
7491 | 7491 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7492 | 7492 | ORDER BY route_count DESC"; |
@@ -7498,7 +7498,7 @@ discard block |
||
7498 | 7498 | $routes_array = array(); |
7499 | 7499 | $temp_array = array(); |
7500 | 7500 | |
7501 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7501 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7502 | 7502 | { |
7503 | 7503 | $temp_array['route_count'] = $row['route_count']; |
7504 | 7504 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7525,9 +7525,9 @@ discard block |
||
7525 | 7525 | */ |
7526 | 7526 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
7527 | 7527 | { |
7528 | - $filter_query = $this->getFilter($filters,true,true); |
|
7529 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
7530 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7528 | + $filter_query = $this->getFilter($filters, true, true); |
|
7529 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
7530 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7531 | 7531 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
7532 | 7532 | GROUP BY route |
7533 | 7533 | ORDER BY route_count DESC"; |
@@ -7539,7 +7539,7 @@ discard block |
||
7539 | 7539 | $routes_array = array(); |
7540 | 7540 | $temp_array = array(); |
7541 | 7541 | |
7542 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7542 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7543 | 7543 | { |
7544 | 7544 | $temp_array['route_count'] = $row['route_count']; |
7545 | 7545 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7567,8 +7567,8 @@ discard block |
||
7567 | 7567 | */ |
7568 | 7568 | public function countAllRoutesWithWaypoints($filters = array()) |
7569 | 7569 | { |
7570 | - $filter_query = $this->getFilter($filters,true,true); |
|
7571 | - $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7570 | + $filter_query = $this->getFilter($filters, true, true); |
|
7571 | + $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
7572 | 7572 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' |
7573 | 7573 | GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7574 | 7574 | ORDER BY route_count DESC |
@@ -7581,7 +7581,7 @@ discard block |
||
7581 | 7581 | $routes_array = array(); |
7582 | 7582 | $temp_array = array(); |
7583 | 7583 | |
7584 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7584 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7585 | 7585 | { |
7586 | 7586 | $temp_array['spotter_id'] = $row['spotter_id']; |
7587 | 7587 | $temp_array['route_count'] = $row['route_count']; |
@@ -7606,11 +7606,11 @@ discard block |
||
7606 | 7606 | * @return Array the callsign list |
7607 | 7607 | * |
7608 | 7608 | */ |
7609 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
7609 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
7610 | 7610 | { |
7611 | 7611 | global $globalDBdriver; |
7612 | - $filter_query = $this->getFilter($filters,true,true); |
|
7613 | - $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
7612 | + $filter_query = $this->getFilter($filters, true, true); |
|
7613 | + $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
7614 | 7614 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
7615 | 7615 | if ($olderthanmonths > 0) { |
7616 | 7616 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -7629,7 +7629,7 @@ discard block |
||
7629 | 7629 | $callsign_array = array(); |
7630 | 7630 | $temp_array = array(); |
7631 | 7631 | |
7632 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7632 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7633 | 7633 | { |
7634 | 7634 | $temp_array['callsign_icao'] = $row['ident']; |
7635 | 7635 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7651,8 +7651,8 @@ discard block |
||
7651 | 7651 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
7652 | 7652 | { |
7653 | 7653 | global $globalDBdriver; |
7654 | - $filter_query = $this->getFilter($filters,true,true); |
|
7655 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
7654 | + $filter_query = $this->getFilter($filters, true, true); |
|
7655 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
7656 | 7656 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
7657 | 7657 | if ($olderthanmonths > 0) { |
7658 | 7658 | if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
@@ -7671,7 +7671,7 @@ discard block |
||
7671 | 7671 | $callsign_array = array(); |
7672 | 7672 | $temp_array = array(); |
7673 | 7673 | |
7674 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7674 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7675 | 7675 | { |
7676 | 7676 | $temp_array['callsign_icao'] = $row['ident']; |
7677 | 7677 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7725,7 +7725,7 @@ discard block |
||
7725 | 7725 | $date_array = array(); |
7726 | 7726 | $temp_array = array(); |
7727 | 7727 | |
7728 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7728 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7729 | 7729 | { |
7730 | 7730 | $temp_array['date_name'] = $row['date_name']; |
7731 | 7731 | $temp_array['date_count'] = $row['date_count']; |
@@ -7750,15 +7750,15 @@ discard block |
||
7750 | 7750 | $datetime = new DateTime(); |
7751 | 7751 | $offset = $datetime->format('P'); |
7752 | 7752 | } else $offset = '+00:00'; |
7753 | - $filter_query = $this->getFilter($filters,true,true); |
|
7753 | + $filter_query = $this->getFilter($filters, true, true); |
|
7754 | 7754 | if ($globalDBdriver == 'mysql') { |
7755 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
7755 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
7756 | 7756 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
7757 | 7757 | GROUP BY spotter_output.airline_icao, date_name |
7758 | 7758 | ORDER BY date_count DESC |
7759 | 7759 | LIMIT 10 OFFSET 0"; |
7760 | 7760 | } else { |
7761 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
7761 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
7762 | 7762 | FROM spotter_output |
7763 | 7763 | WHERE spotter_output.airline_icao <> '' |
7764 | 7764 | GROUP BY spotter_output.airline_icao, date_name |
@@ -7773,7 +7773,7 @@ discard block |
||
7773 | 7773 | $date_array = array(); |
7774 | 7774 | $temp_array = array(); |
7775 | 7775 | |
7776 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7776 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7777 | 7777 | { |
7778 | 7778 | $temp_array['date_name'] = $row['date_name']; |
7779 | 7779 | $temp_array['date_count'] = $row['date_count']; |
@@ -7799,7 +7799,7 @@ discard block |
||
7799 | 7799 | $datetime = new DateTime(); |
7800 | 7800 | $offset = $datetime->format('P'); |
7801 | 7801 | } else $offset = '+00:00'; |
7802 | - $filter_query = $this->getFilter($filters,true,true); |
|
7802 | + $filter_query = $this->getFilter($filters, true, true); |
|
7803 | 7803 | if ($globalDBdriver == 'mysql') { |
7804 | 7804 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
7805 | 7805 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -7820,7 +7820,7 @@ discard block |
||
7820 | 7820 | $date_array = array(); |
7821 | 7821 | $temp_array = array(); |
7822 | 7822 | |
7823 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7823 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7824 | 7824 | { |
7825 | 7825 | $temp_array['date_name'] = $row['date_name']; |
7826 | 7826 | $temp_array['date_count'] = $row['date_count']; |
@@ -7845,7 +7845,7 @@ discard block |
||
7845 | 7845 | $datetime = new DateTime(); |
7846 | 7846 | $offset = $datetime->format('P'); |
7847 | 7847 | } else $offset = '+00:00'; |
7848 | - $filter_query = $this->getFilter($filters,true,true); |
|
7848 | + $filter_query = $this->getFilter($filters, true, true); |
|
7849 | 7849 | if ($globalDBdriver == 'mysql') { |
7850 | 7850 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
7851 | 7851 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -7866,7 +7866,7 @@ discard block |
||
7866 | 7866 | $date_array = array(); |
7867 | 7867 | $temp_array = array(); |
7868 | 7868 | |
7869 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7869 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7870 | 7870 | { |
7871 | 7871 | $temp_array['date_name'] = $row['date_name']; |
7872 | 7872 | $temp_array['date_count'] = $row['date_count']; |
@@ -7887,7 +7887,7 @@ discard block |
||
7887 | 7887 | public function countAllDatesLastMonthByAirlines($filters = array()) |
7888 | 7888 | { |
7889 | 7889 | global $globalTimezone, $globalDBdriver; |
7890 | - $filter_query = $this->getFilter($filters,true,true); |
|
7890 | + $filter_query = $this->getFilter($filters, true, true); |
|
7891 | 7891 | if ($globalTimezone != '') { |
7892 | 7892 | date_default_timezone_set($globalTimezone); |
7893 | 7893 | $datetime = new DateTime(); |
@@ -7895,13 +7895,13 @@ discard block |
||
7895 | 7895 | } else $offset = '+00:00'; |
7896 | 7896 | |
7897 | 7897 | if ($globalDBdriver == 'mysql') { |
7898 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
7898 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
7899 | 7899 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH) |
7900 | 7900 | GROUP BY spotter_output.airline_icao, date_name |
7901 | 7901 | ORDER BY spotter_output.date ASC"; |
7902 | 7902 | $query_data = array(':offset' => $offset); |
7903 | 7903 | } else { |
7904 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
7904 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
7905 | 7905 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS' |
7906 | 7906 | GROUP BY spotter_output.airline_icao, date_name |
7907 | 7907 | ORDER BY date_name ASC"; |
@@ -7914,7 +7914,7 @@ discard block |
||
7914 | 7914 | $date_array = array(); |
7915 | 7915 | $temp_array = array(); |
7916 | 7916 | |
7917 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7917 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7918 | 7918 | { |
7919 | 7919 | $temp_array['date_name'] = $row['date_name']; |
7920 | 7920 | $temp_array['date_count'] = $row['date_count']; |
@@ -7961,7 +7961,7 @@ discard block |
||
7961 | 7961 | $date_array = array(); |
7962 | 7962 | $temp_array = array(); |
7963 | 7963 | |
7964 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7964 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
7965 | 7965 | { |
7966 | 7966 | $temp_array['month_name'] = $row['month_name']; |
7967 | 7967 | $temp_array['year_name'] = $row['year_name']; |
@@ -7982,7 +7982,7 @@ discard block |
||
7982 | 7982 | public function countAllMonthsByAirlines($filters = array()) |
7983 | 7983 | { |
7984 | 7984 | global $globalTimezone, $globalDBdriver; |
7985 | - $filter_query = $this->getFilter($filters,true,true); |
|
7985 | + $filter_query = $this->getFilter($filters, true, true); |
|
7986 | 7986 | if ($globalTimezone != '') { |
7987 | 7987 | date_default_timezone_set($globalTimezone); |
7988 | 7988 | $datetime = new DateTime(); |
@@ -7990,12 +7990,12 @@ discard block |
||
7990 | 7990 | } else $offset = '+00:00'; |
7991 | 7991 | |
7992 | 7992 | if ($globalDBdriver == 'mysql') { |
7993 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
7993 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
7994 | 7994 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
7995 | 7995 | GROUP BY spotter_output.airline_icao, year_name, month_name |
7996 | 7996 | ORDER BY date_count DESC"; |
7997 | 7997 | } else { |
7998 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
7998 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
7999 | 7999 | FROM spotter_output |
8000 | 8000 | WHERE spotter_output.airline_icao <> '' |
8001 | 8001 | GROUP BY spotter_output.airline_icao, year_name, month_name |
@@ -8009,7 +8009,7 @@ discard block |
||
8009 | 8009 | $date_array = array(); |
8010 | 8010 | $temp_array = array(); |
8011 | 8011 | |
8012 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8012 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8013 | 8013 | { |
8014 | 8014 | $temp_array['month_name'] = $row['month_name']; |
8015 | 8015 | $temp_array['year_name'] = $row['year_name']; |
@@ -8036,14 +8036,14 @@ discard block |
||
8036 | 8036 | $datetime = new DateTime(); |
8037 | 8037 | $offset = $datetime->format('P'); |
8038 | 8038 | } else $offset = '+00:00'; |
8039 | - $filter_query = $this->getFilter($filters,true,true); |
|
8039 | + $filter_query = $this->getFilter($filters, true, true); |
|
8040 | 8040 | if ($globalDBdriver == 'mysql') { |
8041 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
8041 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
8042 | 8042 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
8043 | 8043 | GROUP BY year_name, month_name |
8044 | 8044 | ORDER BY date_count DESC"; |
8045 | 8045 | } else { |
8046 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
8046 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
8047 | 8047 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
8048 | 8048 | GROUP BY year_name, month_name |
8049 | 8049 | ORDER BY date_count DESC"; |
@@ -8055,7 +8055,7 @@ discard block |
||
8055 | 8055 | $date_array = array(); |
8056 | 8056 | $temp_array = array(); |
8057 | 8057 | |
8058 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8058 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8059 | 8059 | { |
8060 | 8060 | $temp_array['month_name'] = $row['month_name']; |
8061 | 8061 | $temp_array['year_name'] = $row['year_name']; |
@@ -8081,15 +8081,15 @@ discard block |
||
8081 | 8081 | $datetime = new DateTime(); |
8082 | 8082 | $offset = $datetime->format('P'); |
8083 | 8083 | } else $offset = '+00:00'; |
8084 | - $filter_query = $this->getFilter($filters,true,true); |
|
8084 | + $filter_query = $this->getFilter($filters, true, true); |
|
8085 | 8085 | |
8086 | 8086 | if ($globalDBdriver == 'mysql') { |
8087 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
8087 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
8088 | 8088 | FROM spotter_output".$filter_query." owner_name <> '' |
8089 | 8089 | GROUP BY year_name, month_name |
8090 | 8090 | ORDER BY date_count DESC"; |
8091 | 8091 | } else { |
8092 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
8092 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
8093 | 8093 | FROM spotter_output".$filter_query." owner_name <> '' |
8094 | 8094 | GROUP BY year_name, month_name |
8095 | 8095 | ORDER BY date_count DESC"; |
@@ -8101,7 +8101,7 @@ discard block |
||
8101 | 8101 | $date_array = array(); |
8102 | 8102 | $temp_array = array(); |
8103 | 8103 | |
8104 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8104 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8105 | 8105 | { |
8106 | 8106 | $temp_array['month_name'] = $row['month_name']; |
8107 | 8107 | $temp_array['year_name'] = $row['year_name']; |
@@ -8122,7 +8122,7 @@ discard block |
||
8122 | 8122 | public function countAllMonthsOwnersByAirlines($filters = array()) |
8123 | 8123 | { |
8124 | 8124 | global $globalTimezone, $globalDBdriver; |
8125 | - $filter_query = $this->getFilter($filters,true,true); |
|
8125 | + $filter_query = $this->getFilter($filters, true, true); |
|
8126 | 8126 | if ($globalTimezone != '') { |
8127 | 8127 | date_default_timezone_set($globalTimezone); |
8128 | 8128 | $datetime = new DateTime(); |
@@ -8130,12 +8130,12 @@ discard block |
||
8130 | 8130 | } else $offset = '+00:00'; |
8131 | 8131 | |
8132 | 8132 | if ($globalDBdriver == 'mysql') { |
8133 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
8133 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
8134 | 8134 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
8135 | 8135 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8136 | 8136 | ORDER BY date_count DESC"; |
8137 | 8137 | } else { |
8138 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
8138 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
8139 | 8139 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
8140 | 8140 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8141 | 8141 | ORDER BY date_count DESC"; |
@@ -8147,7 +8147,7 @@ discard block |
||
8147 | 8147 | $date_array = array(); |
8148 | 8148 | $temp_array = array(); |
8149 | 8149 | |
8150 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8150 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8151 | 8151 | { |
8152 | 8152 | $temp_array['month_name'] = $row['month_name']; |
8153 | 8153 | $temp_array['year_name'] = $row['year_name']; |
@@ -8174,15 +8174,15 @@ discard block |
||
8174 | 8174 | $datetime = new DateTime(); |
8175 | 8175 | $offset = $datetime->format('P'); |
8176 | 8176 | } else $offset = '+00:00'; |
8177 | - $filter_query = $this->getFilter($filters,true,true); |
|
8177 | + $filter_query = $this->getFilter($filters, true, true); |
|
8178 | 8178 | |
8179 | 8179 | if ($globalDBdriver == 'mysql') { |
8180 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
8180 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
8181 | 8181 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
8182 | 8182 | GROUP BY year_name, month_name |
8183 | 8183 | ORDER BY date_count DESC"; |
8184 | 8184 | } else { |
8185 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
8185 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
8186 | 8186 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
8187 | 8187 | GROUP BY year_name, month_name |
8188 | 8188 | ORDER BY date_count DESC"; |
@@ -8194,7 +8194,7 @@ discard block |
||
8194 | 8194 | $date_array = array(); |
8195 | 8195 | $temp_array = array(); |
8196 | 8196 | |
8197 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8197 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8198 | 8198 | { |
8199 | 8199 | $temp_array['month_name'] = $row['month_name']; |
8200 | 8200 | $temp_array['year_name'] = $row['year_name']; |
@@ -8215,7 +8215,7 @@ discard block |
||
8215 | 8215 | public function countAllMonthsPilotsByAirlines($filters = array()) |
8216 | 8216 | { |
8217 | 8217 | global $globalTimezone, $globalDBdriver; |
8218 | - $filter_query = $this->getFilter($filters,true,true); |
|
8218 | + $filter_query = $this->getFilter($filters, true, true); |
|
8219 | 8219 | if ($globalTimezone != '') { |
8220 | 8220 | date_default_timezone_set($globalTimezone); |
8221 | 8221 | $datetime = new DateTime(); |
@@ -8223,12 +8223,12 @@ discard block |
||
8223 | 8223 | } else $offset = '+00:00'; |
8224 | 8224 | |
8225 | 8225 | if ($globalDBdriver == 'mysql') { |
8226 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
8226 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
8227 | 8227 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
8228 | 8228 | GROUP BY spotter_output.airline_icao,year_name, month_name |
8229 | 8229 | ORDER BY date_count DESC"; |
8230 | 8230 | } else { |
8231 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
8231 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
8232 | 8232 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
8233 | 8233 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8234 | 8234 | ORDER BY date_count DESC"; |
@@ -8240,7 +8240,7 @@ discard block |
||
8240 | 8240 | $date_array = array(); |
8241 | 8241 | $temp_array = array(); |
8242 | 8242 | |
8243 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8243 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8244 | 8244 | { |
8245 | 8245 | $temp_array['month_name'] = $row['month_name']; |
8246 | 8246 | $temp_array['year_name'] = $row['year_name']; |
@@ -8262,7 +8262,7 @@ discard block |
||
8262 | 8262 | public function countAllMonthsAirlines($filters = array()) |
8263 | 8263 | { |
8264 | 8264 | global $globalTimezone, $globalDBdriver; |
8265 | - $filter_query = $this->getFilter($filters,true,true); |
|
8265 | + $filter_query = $this->getFilter($filters, true, true); |
|
8266 | 8266 | if ($globalTimezone != '') { |
8267 | 8267 | date_default_timezone_set($globalTimezone); |
8268 | 8268 | $datetime = new DateTime(); |
@@ -8270,12 +8270,12 @@ discard block |
||
8270 | 8270 | } else $offset = '+00:00'; |
8271 | 8271 | |
8272 | 8272 | if ($globalDBdriver == 'mysql') { |
8273 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
8273 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
8274 | 8274 | FROM spotter_output".$filter_query." airline_icao <> '' |
8275 | 8275 | GROUP BY year_name, month_name |
8276 | 8276 | ORDER BY date_count DESC"; |
8277 | 8277 | } else { |
8278 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
8278 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
8279 | 8279 | FROM spotter_output".$filter_query." airline_icao <> '' |
8280 | 8280 | GROUP BY year_name, month_name |
8281 | 8281 | ORDER BY date_count DESC"; |
@@ -8287,7 +8287,7 @@ discard block |
||
8287 | 8287 | $date_array = array(); |
8288 | 8288 | $temp_array = array(); |
8289 | 8289 | |
8290 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8290 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8291 | 8291 | { |
8292 | 8292 | $temp_array['month_name'] = $row['month_name']; |
8293 | 8293 | $temp_array['year_name'] = $row['year_name']; |
@@ -8313,15 +8313,15 @@ discard block |
||
8313 | 8313 | $datetime = new DateTime(); |
8314 | 8314 | $offset = $datetime->format('P'); |
8315 | 8315 | } else $offset = '+00:00'; |
8316 | - $filter_query = $this->getFilter($filters,true,true); |
|
8316 | + $filter_query = $this->getFilter($filters, true, true); |
|
8317 | 8317 | |
8318 | 8318 | if ($globalDBdriver == 'mysql') { |
8319 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
8319 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
8320 | 8320 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
8321 | 8321 | GROUP BY year_name, month_name |
8322 | 8322 | ORDER BY date_count DESC"; |
8323 | 8323 | } else { |
8324 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
8324 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
8325 | 8325 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
8326 | 8326 | GROUP BY year_name, month_name |
8327 | 8327 | ORDER BY date_count DESC"; |
@@ -8333,7 +8333,7 @@ discard block |
||
8333 | 8333 | $date_array = array(); |
8334 | 8334 | $temp_array = array(); |
8335 | 8335 | |
8336 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8336 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8337 | 8337 | { |
8338 | 8338 | $temp_array['month_name'] = $row['month_name']; |
8339 | 8339 | $temp_array['year_name'] = $row['year_name']; |
@@ -8355,7 +8355,7 @@ discard block |
||
8355 | 8355 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
8356 | 8356 | { |
8357 | 8357 | global $globalTimezone, $globalDBdriver; |
8358 | - $filter_query = $this->getFilter($filters,true,true); |
|
8358 | + $filter_query = $this->getFilter($filters, true, true); |
|
8359 | 8359 | if ($globalTimezone != '') { |
8360 | 8360 | date_default_timezone_set($globalTimezone); |
8361 | 8361 | $datetime = new DateTime(); |
@@ -8363,12 +8363,12 @@ discard block |
||
8363 | 8363 | } else $offset = '+00:00'; |
8364 | 8364 | |
8365 | 8365 | if ($globalDBdriver == 'mysql') { |
8366 | - $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
8366 | + $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
8367 | 8367 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
8368 | 8368 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8369 | 8369 | ORDER BY date_count DESC"; |
8370 | 8370 | } else { |
8371 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
8371 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
8372 | 8372 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
8373 | 8373 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8374 | 8374 | ORDER BY date_count DESC"; |
@@ -8380,7 +8380,7 @@ discard block |
||
8380 | 8380 | $date_array = array(); |
8381 | 8381 | $temp_array = array(); |
8382 | 8382 | |
8383 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8383 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8384 | 8384 | { |
8385 | 8385 | $temp_array['month_name'] = $row['month_name']; |
8386 | 8386 | $temp_array['year_name'] = $row['year_name']; |
@@ -8407,15 +8407,15 @@ discard block |
||
8407 | 8407 | $datetime = new DateTime(); |
8408 | 8408 | $offset = $datetime->format('P'); |
8409 | 8409 | } else $offset = '+00:00'; |
8410 | - $filter_query = $this->getFilter($filters,true,true); |
|
8410 | + $filter_query = $this->getFilter($filters, true, true); |
|
8411 | 8411 | |
8412 | 8412 | if ($globalDBdriver == 'mysql') { |
8413 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8413 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8414 | 8414 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
8415 | 8415 | GROUP BY year_name, month_name |
8416 | 8416 | ORDER BY date_count DESC"; |
8417 | 8417 | } else { |
8418 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8418 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8419 | 8419 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
8420 | 8420 | GROUP BY year_name, month_name |
8421 | 8421 | ORDER BY date_count DESC"; |
@@ -8427,7 +8427,7 @@ discard block |
||
8427 | 8427 | $date_array = array(); |
8428 | 8428 | $temp_array = array(); |
8429 | 8429 | |
8430 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8430 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8431 | 8431 | { |
8432 | 8432 | $temp_array['month_name'] = $row['month_name']; |
8433 | 8433 | $temp_array['year_name'] = $row['year_name']; |
@@ -8449,7 +8449,7 @@ discard block |
||
8449 | 8449 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
8450 | 8450 | { |
8451 | 8451 | global $globalTimezone, $globalDBdriver; |
8452 | - $filter_query = $this->getFilter($filters,true,true); |
|
8452 | + $filter_query = $this->getFilter($filters, true, true); |
|
8453 | 8453 | if ($globalTimezone != '') { |
8454 | 8454 | date_default_timezone_set($globalTimezone); |
8455 | 8455 | $datetime = new DateTime(); |
@@ -8457,12 +8457,12 @@ discard block |
||
8457 | 8457 | } else $offset = '+00:00'; |
8458 | 8458 | |
8459 | 8459 | if ($globalDBdriver == 'mysql') { |
8460 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8460 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8461 | 8461 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
8462 | 8462 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8463 | 8463 | ORDER BY date_count DESC"; |
8464 | 8464 | } else { |
8465 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8465 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
8466 | 8466 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
8467 | 8467 | GROUP BY spotter_output.airline_icao, year_name, month_name |
8468 | 8468 | ORDER BY date_count DESC"; |
@@ -8474,7 +8474,7 @@ discard block |
||
8474 | 8474 | $date_array = array(); |
8475 | 8475 | $temp_array = array(); |
8476 | 8476 | |
8477 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8477 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8478 | 8478 | { |
8479 | 8479 | $temp_array['month_name'] = $row['month_name']; |
8480 | 8480 | $temp_array['year_name'] = $row['year_name']; |
@@ -8502,7 +8502,7 @@ discard block |
||
8502 | 8502 | $datetime = new DateTime(); |
8503 | 8503 | $offset = $datetime->format('P'); |
8504 | 8504 | } else $offset = '+00:00'; |
8505 | - $filter_query = $this->getFilter($filters,true,true); |
|
8505 | + $filter_query = $this->getFilter($filters, true, true); |
|
8506 | 8506 | if ($globalDBdriver == 'mysql') { |
8507 | 8507 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
8508 | 8508 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -8523,7 +8523,7 @@ discard block |
||
8523 | 8523 | $date_array = array(); |
8524 | 8524 | $temp_array = array(); |
8525 | 8525 | |
8526 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8526 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8527 | 8527 | { |
8528 | 8528 | $temp_array['year_name'] = $row['year_name']; |
8529 | 8529 | $temp_array['month_name'] = $row['month_name']; |
@@ -8543,7 +8543,7 @@ discard block |
||
8543 | 8543 | * @return Array the hour list |
8544 | 8544 | * |
8545 | 8545 | */ |
8546 | - public function countAllHours($orderby,$filters = array()) |
|
8546 | + public function countAllHours($orderby, $filters = array()) |
|
8547 | 8547 | { |
8548 | 8548 | global $globalTimezone, $globalDBdriver; |
8549 | 8549 | if ($globalTimezone != '') { |
@@ -8591,7 +8591,7 @@ discard block |
||
8591 | 8591 | $hour_array = array(); |
8592 | 8592 | $temp_array = array(); |
8593 | 8593 | |
8594 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8594 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8595 | 8595 | { |
8596 | 8596 | $temp_array['hour_name'] = $row['hour_name']; |
8597 | 8597 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8611,7 +8611,7 @@ discard block |
||
8611 | 8611 | public function countAllHoursByAirlines($orderby, $filters = array()) |
8612 | 8612 | { |
8613 | 8613 | global $globalTimezone, $globalDBdriver; |
8614 | - $filter_query = $this->getFilter($filters,true,true); |
|
8614 | + $filter_query = $this->getFilter($filters, true, true); |
|
8615 | 8615 | if ($globalTimezone != '') { |
8616 | 8616 | date_default_timezone_set($globalTimezone); |
8617 | 8617 | $datetime = new DateTime(); |
@@ -8629,7 +8629,7 @@ discard block |
||
8629 | 8629 | } |
8630 | 8630 | |
8631 | 8631 | if ($globalDBdriver == 'mysql') { |
8632 | - $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8632 | + $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8633 | 8633 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
8634 | 8634 | GROUP BY spotter_output.airline_icao, hour_name |
8635 | 8635 | ".$orderby_sql; |
@@ -8642,7 +8642,7 @@ discard block |
||
8642 | 8642 | */ |
8643 | 8643 | $query_data = array(':offset' => $offset); |
8644 | 8644 | } else { |
8645 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8645 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8646 | 8646 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
8647 | 8647 | GROUP BY spotter_output.airline_icao, hour_name |
8648 | 8648 | ".$orderby_sql; |
@@ -8655,7 +8655,7 @@ discard block |
||
8655 | 8655 | $hour_array = array(); |
8656 | 8656 | $temp_array = array(); |
8657 | 8657 | |
8658 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8658 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8659 | 8659 | { |
8660 | 8660 | $temp_array['hour_name'] = $row['hour_name']; |
8661 | 8661 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8678,34 +8678,34 @@ discard block |
||
8678 | 8678 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
8679 | 8679 | { |
8680 | 8680 | global $globalTimezone, $globalDBdriver; |
8681 | - $filter_query = $this->getFilter($filters,true,true); |
|
8681 | + $filter_query = $this->getFilter($filters, true, true); |
|
8682 | 8682 | if ($globalTimezone != '') { |
8683 | 8683 | date_default_timezone_set($globalTimezone); |
8684 | 8684 | $datetime = new DateTime(); |
8685 | 8685 | $offset = $datetime->format('P'); |
8686 | 8686 | } else $offset = '+00:00'; |
8687 | 8687 | |
8688 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
8688 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
8689 | 8689 | |
8690 | 8690 | if ($globalDBdriver == 'mysql') { |
8691 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8691 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8692 | 8692 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
8693 | 8693 | GROUP BY hour_name |
8694 | 8694 | ORDER BY hour_name ASC"; |
8695 | 8695 | } else { |
8696 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8696 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8697 | 8697 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
8698 | 8698 | GROUP BY hour_name |
8699 | 8699 | ORDER BY hour_name ASC"; |
8700 | 8700 | } |
8701 | 8701 | |
8702 | 8702 | $sth = $this->db->prepare($query); |
8703 | - $sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset)); |
|
8703 | + $sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset)); |
|
8704 | 8704 | |
8705 | 8705 | $hour_array = array(); |
8706 | 8706 | $temp_array = array(); |
8707 | 8707 | |
8708 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8708 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8709 | 8709 | { |
8710 | 8710 | $temp_array['hour_name'] = $row['hour_name']; |
8711 | 8711 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8728,8 +8728,8 @@ discard block |
||
8728 | 8728 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
8729 | 8729 | { |
8730 | 8730 | global $globalTimezone, $globalDBdriver; |
8731 | - $filter_query = $this->getFilter($filters,true,true); |
|
8732 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
8731 | + $filter_query = $this->getFilter($filters, true, true); |
|
8732 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
8733 | 8733 | if ($globalTimezone != '') { |
8734 | 8734 | date_default_timezone_set($globalTimezone); |
8735 | 8735 | $datetime = new DateTime(); |
@@ -8737,24 +8737,24 @@ discard block |
||
8737 | 8737 | } else $offset = '+00:00'; |
8738 | 8738 | |
8739 | 8739 | if ($globalDBdriver == 'mysql') { |
8740 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8740 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8741 | 8741 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
8742 | 8742 | GROUP BY hour_name |
8743 | 8743 | ORDER BY hour_name ASC"; |
8744 | 8744 | } else { |
8745 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8745 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8746 | 8746 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
8747 | 8747 | GROUP BY hour_name |
8748 | 8748 | ORDER BY hour_name ASC"; |
8749 | 8749 | } |
8750 | 8750 | |
8751 | 8751 | $sth = $this->db->prepare($query); |
8752 | - $sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset)); |
|
8752 | + $sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset)); |
|
8753 | 8753 | |
8754 | 8754 | $hour_array = array(); |
8755 | 8755 | $temp_array = array(); |
8756 | 8756 | |
8757 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8757 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8758 | 8758 | { |
8759 | 8759 | $temp_array['hour_name'] = $row['hour_name']; |
8760 | 8760 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8775,8 +8775,8 @@ discard block |
||
8775 | 8775 | public function countAllHoursByRegistration($registration, $filters = array()) |
8776 | 8776 | { |
8777 | 8777 | global $globalTimezone, $globalDBdriver; |
8778 | - $filter_query = $this->getFilter($filters,true,true); |
|
8779 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
8778 | + $filter_query = $this->getFilter($filters, true, true); |
|
8779 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
8780 | 8780 | if ($globalTimezone != '') { |
8781 | 8781 | date_default_timezone_set($globalTimezone); |
8782 | 8782 | $datetime = new DateTime(); |
@@ -8784,24 +8784,24 @@ discard block |
||
8784 | 8784 | } else $offset = '+00:00'; |
8785 | 8785 | |
8786 | 8786 | if ($globalDBdriver == 'mysql') { |
8787 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8787 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8788 | 8788 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
8789 | 8789 | GROUP BY hour_name |
8790 | 8790 | ORDER BY hour_name ASC"; |
8791 | 8791 | } else { |
8792 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8792 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8793 | 8793 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
8794 | 8794 | GROUP BY hour_name |
8795 | 8795 | ORDER BY hour_name ASC"; |
8796 | 8796 | } |
8797 | 8797 | |
8798 | 8798 | $sth = $this->db->prepare($query); |
8799 | - $sth->execute(array(':registration' => $registration,':offset' => $offset)); |
|
8799 | + $sth->execute(array(':registration' => $registration, ':offset' => $offset)); |
|
8800 | 8800 | |
8801 | 8801 | $hour_array = array(); |
8802 | 8802 | $temp_array = array(); |
8803 | 8803 | |
8804 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8804 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8805 | 8805 | { |
8806 | 8806 | $temp_array['hour_name'] = $row['hour_name']; |
8807 | 8807 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8822,8 +8822,8 @@ discard block |
||
8822 | 8822 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
8823 | 8823 | { |
8824 | 8824 | global $globalTimezone, $globalDBdriver; |
8825 | - $filter_query = $this->getFilter($filters,true,true); |
|
8826 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
8825 | + $filter_query = $this->getFilter($filters, true, true); |
|
8826 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
8827 | 8827 | if ($globalTimezone != '') { |
8828 | 8828 | date_default_timezone_set($globalTimezone); |
8829 | 8829 | $datetime = new DateTime(); |
@@ -8831,24 +8831,24 @@ discard block |
||
8831 | 8831 | } else $offset = '+00:00'; |
8832 | 8832 | |
8833 | 8833 | if ($globalDBdriver == 'mysql') { |
8834 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8834 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8835 | 8835 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
8836 | 8836 | GROUP BY hour_name |
8837 | 8837 | ORDER BY hour_name ASC"; |
8838 | 8838 | } else { |
8839 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8839 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8840 | 8840 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
8841 | 8841 | GROUP BY hour_name |
8842 | 8842 | ORDER BY hour_name ASC"; |
8843 | 8843 | } |
8844 | 8844 | |
8845 | 8845 | $sth = $this->db->prepare($query); |
8846 | - $sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset)); |
|
8846 | + $sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset)); |
|
8847 | 8847 | |
8848 | 8848 | $hour_array = array(); |
8849 | 8849 | $temp_array = array(); |
8850 | 8850 | |
8851 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8851 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8852 | 8852 | { |
8853 | 8853 | $temp_array['hour_name'] = $row['hour_name']; |
8854 | 8854 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8867,11 +8867,11 @@ discard block |
||
8867 | 8867 | * @return Array the hour list |
8868 | 8868 | * |
8869 | 8869 | */ |
8870 | - public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
|
8870 | + public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array()) |
|
8871 | 8871 | { |
8872 | 8872 | global $globalTimezone, $globalDBdriver; |
8873 | - $filter_query = $this->getFilter($filters,true,true); |
|
8874 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
8873 | + $filter_query = $this->getFilter($filters, true, true); |
|
8874 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
8875 | 8875 | if ($globalTimezone != '') { |
8876 | 8876 | date_default_timezone_set($globalTimezone); |
8877 | 8877 | $datetime = new DateTime(); |
@@ -8879,24 +8879,24 @@ discard block |
||
8879 | 8879 | } else $offset = '+00:00'; |
8880 | 8880 | |
8881 | 8881 | if ($globalDBdriver == 'mysql') { |
8882 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8882 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8883 | 8883 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
8884 | 8884 | GROUP BY hour_name |
8885 | 8885 | ORDER BY hour_name ASC"; |
8886 | 8886 | } else { |
8887 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8887 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8888 | 8888 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
8889 | 8889 | GROUP BY hour_name |
8890 | 8890 | ORDER BY hour_name ASC"; |
8891 | 8891 | } |
8892 | 8892 | |
8893 | 8893 | $sth = $this->db->prepare($query); |
8894 | - $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset)); |
|
8894 | + $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset)); |
|
8895 | 8895 | |
8896 | 8896 | $hour_array = array(); |
8897 | 8897 | $temp_array = array(); |
8898 | 8898 | |
8899 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8899 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8900 | 8900 | { |
8901 | 8901 | $temp_array['hour_name'] = $row['hour_name']; |
8902 | 8902 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8918,8 +8918,8 @@ discard block |
||
8918 | 8918 | public function countAllHoursByDate($date, $filters = array()) |
8919 | 8919 | { |
8920 | 8920 | global $globalTimezone, $globalDBdriver; |
8921 | - $filter_query = $this->getFilter($filters,true,true); |
|
8922 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
8921 | + $filter_query = $this->getFilter($filters, true, true); |
|
8922 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
8923 | 8923 | if ($globalTimezone != '') { |
8924 | 8924 | date_default_timezone_set($globalTimezone); |
8925 | 8925 | $datetime = new DateTime($date); |
@@ -8927,12 +8927,12 @@ discard block |
||
8927 | 8927 | } else $offset = '+00:00'; |
8928 | 8928 | |
8929 | 8929 | if ($globalDBdriver == 'mysql') { |
8930 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8930 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8931 | 8931 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
8932 | 8932 | GROUP BY hour_name |
8933 | 8933 | ORDER BY hour_name ASC"; |
8934 | 8934 | } else { |
8935 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8935 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8936 | 8936 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
8937 | 8937 | GROUP BY hour_name |
8938 | 8938 | ORDER BY hour_name ASC"; |
@@ -8944,7 +8944,7 @@ discard block |
||
8944 | 8944 | $hour_array = array(); |
8945 | 8945 | $temp_array = array(); |
8946 | 8946 | |
8947 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8947 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8948 | 8948 | { |
8949 | 8949 | $temp_array['hour_name'] = $row['hour_name']; |
8950 | 8950 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8966,8 +8966,8 @@ discard block |
||
8966 | 8966 | public function countAllHoursByIdent($ident, $filters = array()) |
8967 | 8967 | { |
8968 | 8968 | global $globalTimezone, $globalDBdriver; |
8969 | - $filter_query = $this->getFilter($filters,true,true); |
|
8970 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
8969 | + $filter_query = $this->getFilter($filters, true, true); |
|
8970 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
8971 | 8971 | if ($globalTimezone != '') { |
8972 | 8972 | date_default_timezone_set($globalTimezone); |
8973 | 8973 | $datetime = new DateTime(); |
@@ -8975,12 +8975,12 @@ discard block |
||
8975 | 8975 | } else $offset = '+00:00'; |
8976 | 8976 | |
8977 | 8977 | if ($globalDBdriver == 'mysql') { |
8978 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8978 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
8979 | 8979 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
8980 | 8980 | GROUP BY hour_name |
8981 | 8981 | ORDER BY hour_name ASC"; |
8982 | 8982 | } else { |
8983 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8983 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
8984 | 8984 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
8985 | 8985 | GROUP BY hour_name |
8986 | 8986 | ORDER BY hour_name ASC"; |
@@ -8988,12 +8988,12 @@ discard block |
||
8988 | 8988 | |
8989 | 8989 | |
8990 | 8990 | $sth = $this->db->prepare($query); |
8991 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
8991 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
8992 | 8992 | |
8993 | 8993 | $hour_array = array(); |
8994 | 8994 | $temp_array = array(); |
8995 | 8995 | |
8996 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8996 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
8997 | 8997 | { |
8998 | 8998 | $temp_array['hour_name'] = $row['hour_name']; |
8999 | 8999 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9012,12 +9012,12 @@ discard block |
||
9012 | 9012 | * @return Array the hour list |
9013 | 9013 | * |
9014 | 9014 | */ |
9015 | - public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
|
9015 | + public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
9016 | 9016 | { |
9017 | 9017 | global $globalTimezone, $globalDBdriver; |
9018 | - $filter_query = $this->getFilter($filters,true,true); |
|
9019 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
9020 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
9018 | + $filter_query = $this->getFilter($filters, true, true); |
|
9019 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
9020 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
9021 | 9021 | if ($globalTimezone != '') { |
9022 | 9022 | date_default_timezone_set($globalTimezone); |
9023 | 9023 | $datetime = new DateTime(); |
@@ -9025,24 +9025,24 @@ discard block |
||
9025 | 9025 | } else $offset = '+00:00'; |
9026 | 9026 | |
9027 | 9027 | if ($globalDBdriver == 'mysql') { |
9028 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9028 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9029 | 9029 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
9030 | 9030 | GROUP BY hour_name |
9031 | 9031 | ORDER BY hour_name ASC"; |
9032 | 9032 | } else { |
9033 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9033 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9034 | 9034 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
9035 | 9035 | GROUP BY hour_name |
9036 | 9036 | ORDER BY hour_name ASC"; |
9037 | 9037 | } |
9038 | 9038 | |
9039 | 9039 | $sth = $this->db->prepare($query); |
9040 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset)); |
|
9040 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset)); |
|
9041 | 9041 | |
9042 | 9042 | $hour_array = array(); |
9043 | 9043 | $temp_array = array(); |
9044 | 9044 | |
9045 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9045 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9046 | 9046 | { |
9047 | 9047 | $temp_array['hour_name'] = $row['hour_name']; |
9048 | 9048 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9063,8 +9063,8 @@ discard block |
||
9063 | 9063 | public function countAllHoursByCountry($country, $filters = array()) |
9064 | 9064 | { |
9065 | 9065 | global $globalTimezone, $globalDBdriver; |
9066 | - $filter_query = $this->getFilter($filters,true,true); |
|
9067 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
9066 | + $filter_query = $this->getFilter($filters, true, true); |
|
9067 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
9068 | 9068 | if ($globalTimezone != '') { |
9069 | 9069 | date_default_timezone_set($globalTimezone); |
9070 | 9070 | $datetime = new DateTime(); |
@@ -9072,24 +9072,24 @@ discard block |
||
9072 | 9072 | } else $offset = '+00:00'; |
9073 | 9073 | |
9074 | 9074 | if ($globalDBdriver == 'mysql') { |
9075 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9075 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9076 | 9076 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
9077 | 9077 | GROUP BY hour_name |
9078 | 9078 | ORDER BY hour_name ASC"; |
9079 | 9079 | } else { |
9080 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9080 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9081 | 9081 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
9082 | 9082 | GROUP BY hour_name |
9083 | 9083 | ORDER BY hour_name ASC"; |
9084 | 9084 | } |
9085 | 9085 | |
9086 | 9086 | $sth = $this->db->prepare($query); |
9087 | - $sth->execute(array(':country' => $country,':offset' => $offset)); |
|
9087 | + $sth->execute(array(':country' => $country, ':offset' => $offset)); |
|
9088 | 9088 | |
9089 | 9089 | $hour_array = array(); |
9090 | 9090 | $temp_array = array(); |
9091 | 9091 | |
9092 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9092 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9093 | 9093 | { |
9094 | 9094 | $temp_array['hour_name'] = $row['hour_name']; |
9095 | 9095 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9111,8 +9111,8 @@ discard block |
||
9111 | 9111 | */ |
9112 | 9112 | public function countOverallAircrafts($filters = array()) |
9113 | 9113 | { |
9114 | - $filter_query = $this->getFilter($filters,true,true); |
|
9115 | - $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
9114 | + $filter_query = $this->getFilter($filters, true, true); |
|
9115 | + $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
9116 | 9116 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
9117 | 9117 | $sth = $this->db->prepare($query); |
9118 | 9118 | $sth->execute(); |
@@ -9127,8 +9127,8 @@ discard block |
||
9127 | 9127 | */ |
9128 | 9128 | public function countOverallArrival($filters = array()) |
9129 | 9129 | { |
9130 | - $filter_query = $this->getFilter($filters,true,true); |
|
9131 | - $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
9130 | + $filter_query = $this->getFilter($filters, true, true); |
|
9131 | + $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
9132 | 9132 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''"; |
9133 | 9133 | |
9134 | 9134 | $sth = $this->db->prepare($query); |
@@ -9144,8 +9144,8 @@ discard block |
||
9144 | 9144 | */ |
9145 | 9145 | public function countOverallPilots($filters = array()) |
9146 | 9146 | { |
9147 | - $filter_query = $this->getFilter($filters,true,true); |
|
9148 | - $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
9147 | + $filter_query = $this->getFilter($filters, true, true); |
|
9148 | + $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
9149 | 9149 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''"; |
9150 | 9150 | $sth = $this->db->prepare($query); |
9151 | 9151 | $sth->execute(); |
@@ -9160,8 +9160,8 @@ discard block |
||
9160 | 9160 | */ |
9161 | 9161 | public function countOverallOwners($filters = array()) |
9162 | 9162 | { |
9163 | - $filter_query = $this->getFilter($filters,true,true); |
|
9164 | - $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
9163 | + $filter_query = $this->getFilter($filters, true, true); |
|
9164 | + $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
9165 | 9165 | FROM spotter_output".$filter_query." spotter_output.owner_name <> ''"; |
9166 | 9166 | $sth = $this->db->prepare($query); |
9167 | 9167 | $sth->execute(); |
@@ -9194,8 +9194,8 @@ discard block |
||
9194 | 9194 | */ |
9195 | 9195 | public function countOverallMilitaryFlights($filters = array()) |
9196 | 9196 | { |
9197 | - $filter_query = $this->getFilter($filters,true,true); |
|
9198 | - $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
9197 | + $filter_query = $this->getFilter($filters, true, true); |
|
9198 | + $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
9199 | 9199 | FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'"; |
9200 | 9200 | |
9201 | 9201 | $sth = $this->db->prepare($query); |
@@ -9232,7 +9232,7 @@ discard block |
||
9232 | 9232 | public function countAllHoursFromToday($filters = array()) |
9233 | 9233 | { |
9234 | 9234 | global $globalTimezone, $globalDBdriver; |
9235 | - $filter_query = $this->getFilter($filters,true,true); |
|
9235 | + $filter_query = $this->getFilter($filters, true, true); |
|
9236 | 9236 | if ($globalTimezone != '') { |
9237 | 9237 | date_default_timezone_set($globalTimezone); |
9238 | 9238 | $datetime = new DateTime(); |
@@ -9240,12 +9240,12 @@ discard block |
||
9240 | 9240 | } else $offset = '+00:00'; |
9241 | 9241 | |
9242 | 9242 | if ($globalDBdriver == 'mysql') { |
9243 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9243 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
9244 | 9244 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE() |
9245 | 9245 | GROUP BY hour_name |
9246 | 9246 | ORDER BY hour_name ASC"; |
9247 | 9247 | } else { |
9248 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9248 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
9249 | 9249 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
9250 | 9250 | GROUP BY hour_name |
9251 | 9251 | ORDER BY hour_name ASC"; |
@@ -9257,7 +9257,7 @@ discard block |
||
9257 | 9257 | $hour_array = array(); |
9258 | 9258 | $temp_array = array(); |
9259 | 9259 | |
9260 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9260 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9261 | 9261 | { |
9262 | 9262 | $temp_array['hour_name'] = $row['hour_name']; |
9263 | 9263 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9276,14 +9276,14 @@ discard block |
||
9276 | 9276 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
9277 | 9277 | { |
9278 | 9278 | global $global_query, $globalDBdriver, $globalTimezone; |
9279 | - $filter_query = $this->getFilter($filters,true,true); |
|
9279 | + $filter_query = $this->getFilter($filters, true, true); |
|
9280 | 9280 | date_default_timezone_set('UTC'); |
9281 | 9281 | $limit_query = ''; |
9282 | 9282 | if ($limit != "") |
9283 | 9283 | { |
9284 | 9284 | $limit_array = explode(",", $limit); |
9285 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
9286 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
9285 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
9286 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
9287 | 9287 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
9288 | 9288 | { |
9289 | 9289 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -9336,7 +9336,7 @@ discard block |
||
9336 | 9336 | GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH') |
9337 | 9337 | HAVING count(spotter_output.ident) > 5$orderby_query"; |
9338 | 9338 | //echo $query; |
9339 | - $spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone)); |
|
9339 | + $spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone)); |
|
9340 | 9340 | /* |
9341 | 9341 | $sth = $this->db->prepare($query); |
9342 | 9342 | $sth->execute(array(':timezone' => $globalTimezone)); |
@@ -9355,9 +9355,9 @@ discard block |
||
9355 | 9355 | */ |
9356 | 9356 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
9357 | 9357 | { |
9358 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
9358 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
9359 | 9359 | |
9360 | - $query = "SELECT spotter_output.spotter_id |
|
9360 | + $query = "SELECT spotter_output.spotter_id |
|
9361 | 9361 | FROM spotter_output |
9362 | 9362 | WHERE spotter_output.flightaware_id = '".$flightaware_id."'"; |
9363 | 9363 | |
@@ -9365,7 +9365,7 @@ discard block |
||
9365 | 9365 | $sth = $this->db->prepare($query); |
9366 | 9366 | $sth->execute(); |
9367 | 9367 | |
9368 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9368 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9369 | 9369 | { |
9370 | 9370 | return $row['spotter_id']; |
9371 | 9371 | } |
@@ -9390,23 +9390,23 @@ discard block |
||
9390 | 9390 | } |
9391 | 9391 | |
9392 | 9392 | $current_date = date("Y-m-d H:i:s"); |
9393 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
9393 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
9394 | 9394 | |
9395 | 9395 | $diff = abs(strtotime($current_date) - strtotime($date)); |
9396 | 9396 | |
9397 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
9397 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
9398 | 9398 | $years = $time_array['years']; |
9399 | 9399 | |
9400 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
9400 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
9401 | 9401 | $months = $time_array['months']; |
9402 | 9402 | |
9403 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
9403 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
9404 | 9404 | $days = $time_array['days']; |
9405 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
9405 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
9406 | 9406 | $hours = $time_array['hours']; |
9407 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
9407 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
9408 | 9408 | $minutes = $time_array['minutes']; |
9409 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
9409 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
9410 | 9410 | |
9411 | 9411 | return $time_array; |
9412 | 9412 | } |
@@ -9432,63 +9432,63 @@ discard block |
||
9432 | 9432 | $temp_array['direction_degree'] = $direction; |
9433 | 9433 | $temp_array['direction_shortname'] = "N"; |
9434 | 9434 | $temp_array['direction_fullname'] = "North"; |
9435 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
9435 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
9436 | 9436 | $temp_array['direction_degree'] = $direction; |
9437 | 9437 | $temp_array['direction_shortname'] = "NNE"; |
9438 | 9438 | $temp_array['direction_fullname'] = "North-Northeast"; |
9439 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
9439 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
9440 | 9440 | $temp_array['direction_degree'] = $direction; |
9441 | 9441 | $temp_array['direction_shortname'] = "NE"; |
9442 | 9442 | $temp_array['direction_fullname'] = "Northeast"; |
9443 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
9443 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
9444 | 9444 | $temp_array['direction_degree'] = $direction; |
9445 | 9445 | $temp_array['direction_shortname'] = "ENE"; |
9446 | 9446 | $temp_array['direction_fullname'] = "East-Northeast"; |
9447 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
9447 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
9448 | 9448 | $temp_array['direction_degree'] = $direction; |
9449 | 9449 | $temp_array['direction_shortname'] = "E"; |
9450 | 9450 | $temp_array['direction_fullname'] = "East"; |
9451 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
9451 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
9452 | 9452 | $temp_array['direction_degree'] = $direction; |
9453 | 9453 | $temp_array['direction_shortname'] = "ESE"; |
9454 | 9454 | $temp_array['direction_fullname'] = "East-Southeast"; |
9455 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
9455 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
9456 | 9456 | $temp_array['direction_degree'] = $direction; |
9457 | 9457 | $temp_array['direction_shortname'] = "SE"; |
9458 | 9458 | $temp_array['direction_fullname'] = "Southeast"; |
9459 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
9459 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
9460 | 9460 | $temp_array['direction_degree'] = $direction; |
9461 | 9461 | $temp_array['direction_shortname'] = "SSE"; |
9462 | 9462 | $temp_array['direction_fullname'] = "South-Southeast"; |
9463 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
9463 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
9464 | 9464 | $temp_array['direction_degree'] = $direction; |
9465 | 9465 | $temp_array['direction_shortname'] = "S"; |
9466 | 9466 | $temp_array['direction_fullname'] = "South"; |
9467 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
9467 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
9468 | 9468 | $temp_array['direction_degree'] = $direction; |
9469 | 9469 | $temp_array['direction_shortname'] = "SSW"; |
9470 | 9470 | $temp_array['direction_fullname'] = "South-Southwest"; |
9471 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
9471 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
9472 | 9472 | $temp_array['direction_degree'] = $direction; |
9473 | 9473 | $temp_array['direction_shortname'] = "SW"; |
9474 | 9474 | $temp_array['direction_fullname'] = "Southwest"; |
9475 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
9475 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
9476 | 9476 | $temp_array['direction_degree'] = $direction; |
9477 | 9477 | $temp_array['direction_shortname'] = "WSW"; |
9478 | 9478 | $temp_array['direction_fullname'] = "West-Southwest"; |
9479 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
9479 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
9480 | 9480 | $temp_array['direction_degree'] = $direction; |
9481 | 9481 | $temp_array['direction_shortname'] = "W"; |
9482 | 9482 | $temp_array['direction_fullname'] = "West"; |
9483 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
9483 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
9484 | 9484 | $temp_array['direction_degree'] = $direction; |
9485 | 9485 | $temp_array['direction_shortname'] = "WNW"; |
9486 | 9486 | $temp_array['direction_fullname'] = "West-Northwest"; |
9487 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
9487 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
9488 | 9488 | $temp_array['direction_degree'] = $direction; |
9489 | 9489 | $temp_array['direction_shortname'] = "NW"; |
9490 | 9490 | $temp_array['direction_fullname'] = "Northwest"; |
9491 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
9491 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
9492 | 9492 | $temp_array['direction_degree'] = $direction; |
9493 | 9493 | $temp_array['direction_shortname'] = "NNW"; |
9494 | 9494 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -9541,9 +9541,9 @@ discard block |
||
9541 | 9541 | */ |
9542 | 9542 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
9543 | 9543 | { |
9544 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
9544 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
9545 | 9545 | |
9546 | - $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
9546 | + $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
9547 | 9547 | |
9548 | 9548 | $sth = $this->db->prepare($query); |
9549 | 9549 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9566,9 +9566,9 @@ discard block |
||
9566 | 9566 | */ |
9567 | 9567 | public function getAircraftTypeBymodeS($aircraft_modes) |
9568 | 9568 | { |
9569 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
9569 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
9570 | 9570 | |
9571 | - $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
9571 | + $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1"; |
|
9572 | 9572 | |
9573 | 9573 | $sth = $this->db->prepare($query); |
9574 | 9574 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9589,11 +9589,11 @@ discard block |
||
9589 | 9589 | * @param Float $longitude longitute of the flight |
9590 | 9590 | * @return String the countrie |
9591 | 9591 | */ |
9592 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
9592 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
9593 | 9593 | { |
9594 | 9594 | global $globalDBdriver, $globalDebug; |
9595 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
9596 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
9595 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
9596 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
9597 | 9597 | |
9598 | 9598 | $Connection = new Connection($this->db); |
9599 | 9599 | if (!$Connection->tableExists('countries')) return ''; |
@@ -9633,19 +9633,19 @@ discard block |
||
9633 | 9633 | */ |
9634 | 9634 | public function convertAircraftRegistration($registration) |
9635 | 9635 | { |
9636 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
9636 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
9637 | 9637 | $registration_prefix = ''; |
9638 | 9638 | $registration_1 = substr($registration, 0, 1); |
9639 | 9639 | $registration_2 = substr($registration, 0, 2); |
9640 | 9640 | |
9641 | 9641 | //first get the prefix based on two characters |
9642 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
9642 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
9643 | 9643 | |
9644 | 9644 | |
9645 | 9645 | $sth = $this->db->prepare($query); |
9646 | 9646 | $sth->execute(array(':registration_2' => $registration_2)); |
9647 | 9647 | |
9648 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9648 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9649 | 9649 | { |
9650 | 9650 | $registration_prefix = $row['registration_prefix']; |
9651 | 9651 | } |
@@ -9653,11 +9653,11 @@ discard block |
||
9653 | 9653 | //if we didn't find a two chracter prefix lets just search the one with one character |
9654 | 9654 | if ($registration_prefix == '') |
9655 | 9655 | { |
9656 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
9656 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
9657 | 9657 | $sth = $this->db->prepare($query); |
9658 | 9658 | $sth->execute(array(':registration_1' => $registration_1)); |
9659 | 9659 | |
9660 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9660 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9661 | 9661 | { |
9662 | 9662 | $registration_prefix = $row['registration_prefix']; |
9663 | 9663 | } |
@@ -9671,7 +9671,7 @@ discard block |
||
9671 | 9671 | } else { |
9672 | 9672 | $registration = preg_replace("/^(.{1})/", "$1-", $registration); |
9673 | 9673 | } |
9674 | - } else if(strlen($registration_prefix) == 2){ |
|
9674 | + } else if (strlen($registration_prefix) == 2) { |
|
9675 | 9675 | if (0 === strpos($registration, 'N')) { |
9676 | 9676 | $registration = preg_replace("/^(.{2})/", "$1", $registration); |
9677 | 9677 | } else { |
@@ -9690,17 +9690,17 @@ discard block |
||
9690 | 9690 | */ |
9691 | 9691 | public function countryFromAircraftRegistration($registration) |
9692 | 9692 | { |
9693 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
9693 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
9694 | 9694 | |
9695 | 9695 | $registration_prefix = ''; |
9696 | - $registration_test = explode('-',$registration); |
|
9696 | + $registration_test = explode('-', $registration); |
|
9697 | 9697 | $country = ''; |
9698 | 9698 | if ($registration_test[0] != $registration) { |
9699 | 9699 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
9700 | 9700 | |
9701 | 9701 | $sth = $this->db->prepare($query); |
9702 | 9702 | $sth->execute(array(':registration_1' => $registration_test[0])); |
9703 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9703 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9704 | 9704 | { |
9705 | 9705 | //$registration_prefix = $row['registration_prefix']; |
9706 | 9706 | $country = $row['country']; |
@@ -9711,13 +9711,13 @@ discard block |
||
9711 | 9711 | |
9712 | 9712 | $country = ''; |
9713 | 9713 | //first get the prefix based on two characters |
9714 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
9714 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
9715 | 9715 | |
9716 | 9716 | |
9717 | 9717 | $sth = $this->db->prepare($query); |
9718 | 9718 | $sth->execute(array(':registration_2' => $registration_2)); |
9719 | 9719 | |
9720 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9720 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9721 | 9721 | { |
9722 | 9722 | $registration_prefix = $row['registration_prefix']; |
9723 | 9723 | $country = $row['country']; |
@@ -9726,12 +9726,12 @@ discard block |
||
9726 | 9726 | //if we didn't find a two chracter prefix lets just search the one with one character |
9727 | 9727 | if ($registration_prefix == "") |
9728 | 9728 | { |
9729 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
9729 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
9730 | 9730 | |
9731 | 9731 | $sth = $this->db->prepare($query); |
9732 | 9732 | $sth->execute(array(':registration_1' => $registration_1)); |
9733 | 9733 | |
9734 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9734 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9735 | 9735 | { |
9736 | 9736 | //$registration_prefix = $row['registration_prefix']; |
9737 | 9737 | $country = $row['country']; |
@@ -9748,9 +9748,9 @@ discard block |
||
9748 | 9748 | * @param String $flightaware_id flightaware_id from spotter_output table |
9749 | 9749 | * @param String $highlight New highlight value |
9750 | 9750 | */ |
9751 | - public function setHighlightFlight($flightaware_id,$highlight) { |
|
9751 | + public function setHighlightFlight($flightaware_id, $highlight) { |
|
9752 | 9752 | |
9753 | - $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
9753 | + $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
9754 | 9754 | $sth = $this->db->prepare($query); |
9755 | 9755 | $sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight)); |
9756 | 9756 | } |
@@ -9779,7 +9779,7 @@ discard block |
||
9779 | 9779 | |
9780 | 9780 | $bitly_data = json_decode($bitly_data); |
9781 | 9781 | $bitly_url = ''; |
9782 | - if ($bitly_data->status_txt = "OK"){ |
|
9782 | + if ($bitly_data->status_txt = "OK") { |
|
9783 | 9783 | $bitly_url = $bitly_data->data->url; |
9784 | 9784 | } |
9785 | 9785 | |
@@ -9789,7 +9789,7 @@ discard block |
||
9789 | 9789 | |
9790 | 9790 | public function getOrderBy() |
9791 | 9791 | { |
9792 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
9792 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
9793 | 9793 | |
9794 | 9794 | return $orderby; |
9795 | 9795 | |
@@ -9923,14 +9923,14 @@ discard block |
||
9923 | 9923 | } |
9924 | 9924 | $sth = $this->db->prepare($query); |
9925 | 9925 | $sth->execute(); |
9926 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9926 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9927 | 9927 | { |
9928 | 9928 | $departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']); |
9929 | 9929 | $arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']); |
9930 | 9930 | if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) { |
9931 | - $update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
9931 | + $update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
9932 | 9932 | $sthu = $this->db->prepare($update_query); |
9933 | - $sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
9933 | + $sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
9934 | 9934 | } |
9935 | 9935 | } |
9936 | 9936 | |
@@ -9943,7 +9943,7 @@ discard block |
||
9943 | 9943 | } |
9944 | 9944 | $sth = $this->db->prepare($query); |
9945 | 9945 | $sth->execute(); |
9946 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9946 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9947 | 9947 | { |
9948 | 9948 | if (is_numeric(substr($row['ident'], -1, 1))) |
9949 | 9949 | { |
@@ -9952,11 +9952,11 @@ discard block |
||
9952 | 9952 | elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
9953 | 9953 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
9954 | 9954 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
9955 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
9955 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
9956 | 9956 | if (isset($airline_array[0]['name'])) { |
9957 | - $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
9957 | + $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
9958 | 9958 | $sthu = $this->db->prepare($update_query); |
9959 | - $sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
9959 | + $sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
9960 | 9960 | } |
9961 | 9961 | } |
9962 | 9962 | } |
@@ -9976,18 +9976,18 @@ discard block |
||
9976 | 9976 | } |
9977 | 9977 | $sth = $this->db->prepare($query); |
9978 | 9978 | $sth->execute(); |
9979 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9979 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
9980 | 9980 | { |
9981 | 9981 | if ($row['aircraft_icao'] != '') { |
9982 | 9982 | $aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']); |
9983 | - if ($row['registration'] != ""){ |
|
9983 | + if ($row['registration'] != "") { |
|
9984 | 9984 | $image_array = $Image->getSpotterImage($row['registration']); |
9985 | 9985 | if (!isset($image_array[0]['registration'])) { |
9986 | 9986 | $Image->addSpotterImage($row['registration']); |
9987 | 9987 | } |
9988 | 9988 | } |
9989 | 9989 | if (count($aircraft_name) > 0) { |
9990 | - $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
9990 | + $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
9991 | 9991 | $sthu = $this->db->prepare($update_query); |
9992 | 9992 | $sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id'])); |
9993 | 9993 | } |
@@ -10002,10 +10002,10 @@ discard block |
||
10002 | 10002 | $query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output"; |
10003 | 10003 | $sth = $this->db->prepare($query); |
10004 | 10004 | $sth->execute(); |
10005 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10005 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
10006 | 10006 | { |
10007 | 10007 | if ($row['last_latitude'] != '' && $row['last_longitude'] != '') { |
10008 | - $closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist); |
|
10008 | + $closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist); |
|
10009 | 10009 | $airport_icao = ''; |
10010 | 10010 | if (isset($closestAirports[0])) { |
10011 | 10011 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
@@ -10019,7 +10019,7 @@ discard block |
||
10019 | 10019 | break; |
10020 | 10020 | } |
10021 | 10021 | } |
10022 | - } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
|
10022 | + } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) { |
|
10023 | 10023 | $airport_icao = $closestAirports[0]['icao']; |
10024 | 10024 | if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
10025 | 10025 | } else { |
@@ -10030,28 +10030,28 @@ discard block |
||
10030 | 10030 | } |
10031 | 10031 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
10032 | 10032 | if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
10033 | - $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
10033 | + $update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
10034 | 10034 | $sthu = $this->db->prepare($update_query); |
10035 | - $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
|
10035 | + $sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id'])); |
|
10036 | 10036 | } |
10037 | 10037 | } |
10038 | 10038 | } |
10039 | 10039 | } |
10040 | 10040 | |
10041 | - public function closestAirports($origLat,$origLon,$dist = 10) { |
|
10041 | + public function closestAirports($origLat, $origLon, $dist = 10) { |
|
10042 | 10042 | global $globalDBdriver; |
10043 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
10043 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
10044 | 10044 | /* |
10045 | 10045 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
10046 | 10046 | FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
10047 | 10047 | having distance < $dist ORDER BY distance limit 100;"; |
10048 | 10048 | */ |
10049 | 10049 | if ($globalDBdriver == 'mysql') { |
10050 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
10050 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
10051 | 10051 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
10052 | 10052 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
10053 | 10053 | } else { |
10054 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
10054 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
10055 | 10055 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
10056 | 10056 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
10057 | 10057 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | require_once(dirname(__FILE__).'/class.create_db.php'); |
10 | 10 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
11 | 11 | require_once(dirname(__FILE__).'/class.settings.php'); |
12 | -$title="Install"; |
|
12 | +$title = "Install"; |
|
13 | 13 | require(dirname(__FILE__).'/../require/settings.php'); |
14 | 14 | require(dirname(__FILE__).'/header.php'); |
15 | 15 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | if (!extension_loaded('curl')) { |
64 | 64 | $error[] = "Curl is not loaded."; |
65 | 65 | } |
66 | -if(function_exists('apache_get_modules') ){ |
|
67 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
66 | +if (function_exists('apache_get_modules')) { |
|
67 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
68 | 68 | $error[] = "mod_rewrite is not available."; |
69 | 69 | } |
70 | 70 | /* |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | } |
80 | 80 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
81 | 81 | if (function_exists('get_headers')) { |
82 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
83 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
82 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
83 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
84 | 84 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
85 | 85 | } |
86 | 86 | } |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | ?> |
421 | 421 | <tr> |
422 | 422 | <?php |
423 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
423 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
424 | 424 | ?> |
425 | 425 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
426 | 426 | <td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td> |
427 | 427 | <?php |
428 | 428 | } else { |
429 | - $hostport = explode(':',$source['host']); |
|
429 | + $hostport = explode(':', $source['host']); |
|
430 | 430 | if (isset($hostport[1])) { |
431 | 431 | $host = $hostport[0]; |
432 | 432 | $port = $hostport[1]; |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | <br /> |
750 | 750 | <p> |
751 | 751 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
752 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
752 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
753 | 753 | </p> |
754 | 754 | <br /> |
755 | 755 | <p> |
@@ -795,14 +795,14 @@ discard block |
||
795 | 795 | $error = ''; |
796 | 796 | |
797 | 797 | if (isset($_POST['dbtype'])) { |
798 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
799 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
800 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
801 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
802 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
803 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
804 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
805 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
798 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
799 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
800 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
801 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
802 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
803 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
804 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
805 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
806 | 806 | |
807 | 807 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
808 | 808 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -822,48 +822,48 @@ discard block |
||
822 | 822 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
823 | 823 | */ |
824 | 824 | |
825 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
825 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
826 | 826 | |
827 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
828 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
829 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
830 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
831 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
827 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
828 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
829 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
830 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
831 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
832 | 832 | |
833 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
834 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
835 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
836 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
837 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
838 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
839 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
840 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
841 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey)); |
|
833 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
834 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
835 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
836 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
837 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
838 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
839 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
840 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
841 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey)); |
|
842 | 842 | |
843 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
844 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
845 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
846 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
847 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
848 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
843 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
844 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
845 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
846 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
847 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
848 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
849 | 849 | |
850 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
851 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
850 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
851 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
852 | 852 | |
853 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
854 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
855 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
853 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
854 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
855 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
856 | 856 | |
857 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
857 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
858 | 858 | if ($acars == 'acars') { |
859 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
859 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
860 | 860 | } else { |
861 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
861 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
862 | 862 | } |
863 | 863 | |
864 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
865 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
866 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
864 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
865 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
866 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
867 | 867 | |
868 | 868 | $source_name = $_POST['source_name']; |
869 | 869 | $source_latitude = $_POST['source_latitude']; |
@@ -877,8 +877,8 @@ discard block |
||
877 | 877 | |
878 | 878 | $sources = array(); |
879 | 879 | foreach ($source_name as $keys => $name) { |
880 | - 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]); |
|
881 | - 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]); |
|
880 | + 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]); |
|
881 | + 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]); |
|
882 | 882 | } |
883 | 883 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
884 | 884 | |
@@ -891,13 +891,13 @@ discard block |
||
891 | 891 | $sbsurl = $_POST['sbsurl']; |
892 | 892 | */ |
893 | 893 | |
894 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
895 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
896 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
897 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
898 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
899 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
900 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
894 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
895 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
896 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
897 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
898 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
899 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
900 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
901 | 901 | |
902 | 902 | /* |
903 | 903 | $globalSBS1Hosts = array(); |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | } |
914 | 914 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
915 | 915 | */ |
916 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
916 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
917 | 917 | $host = $_POST['host']; |
918 | 918 | $port = $_POST['port']; |
919 | 919 | $name = $_POST['name']; |
@@ -924,89 +924,89 @@ discard block |
||
924 | 924 | foreach ($host as $key => $h) { |
925 | 925 | if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
926 | 926 | else $cov = 'FALSE'; |
927 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov); |
|
927 | + if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov); |
|
928 | 928 | } |
929 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
929 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
930 | 930 | |
931 | 931 | /* |
932 | 932 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
933 | 933 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
934 | 934 | */ |
935 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
936 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
937 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
935 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
936 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
937 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
938 | 938 | |
939 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
940 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
939 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
940 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
941 | 941 | |
942 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
943 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
944 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
945 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
942 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
943 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
944 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
945 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
946 | 946 | |
947 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
948 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
949 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
947 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
948 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
949 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
950 | 950 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
951 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
952 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
951 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
952 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
953 | 953 | |
954 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
955 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
956 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
957 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
958 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
959 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
960 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
961 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
954 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
955 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
956 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
957 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
958 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
959 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
960 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
961 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
962 | 962 | |
963 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
964 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
963 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
964 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
965 | 965 | |
966 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
967 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
966 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
967 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
968 | 968 | |
969 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
969 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
970 | 970 | if ($archiveyear == "archiveyear") { |
971 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
971 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
972 | 972 | } else { |
973 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
973 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
974 | 974 | } |
975 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
976 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
977 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
978 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
975 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
976 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
977 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
978 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
979 | 979 | |
980 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
981 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
982 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
983 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
980 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
981 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
982 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
983 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
984 | 984 | |
985 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
986 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
987 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
985 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
986 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
987 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
988 | 988 | |
989 | 989 | // Create in settings.php keys not yet configurable if not already here |
990 | 990 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
991 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
991 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
992 | 992 | |
993 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
993 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
994 | 994 | if ($archive == 'archive') { |
995 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
995 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
996 | 996 | } else { |
997 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
997 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
998 | 998 | } |
999 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
999 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1000 | 1000 | if ($daemon == 'daemon') { |
1001 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1001 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1002 | 1002 | } else { |
1003 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1003 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1004 | 1004 | } |
1005 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1005 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1006 | 1006 | if ($schedules == 'schedules') { |
1007 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1007 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1008 | 1008 | } else { |
1009 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1009 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | /* |
@@ -1017,171 +1017,171 @@ discard block |
||
1017 | 1017 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1018 | 1018 | } |
1019 | 1019 | */ |
1020 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1021 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1022 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1023 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1024 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1020 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1021 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1022 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1023 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1024 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1025 | 1025 | if ($globalivao == 'ivao') { |
1026 | 1026 | //$settings = array_merge($settings,array('globalIVAO' => 'TRUE','globalVATSIM' => 'FALSE')); |
1027 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1028 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1027 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1028 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1029 | 1029 | if ($globalvatsim == 'vatsim') { |
1030 | 1030 | //$settings = array_merge($settings,array('globalVATSIM' => 'TRUE','globalIVAO' => 'FALSE')); |
1031 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1032 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1031 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1032 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1033 | 1033 | if ($globalphpvms == 'phpvms') { |
1034 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1035 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1034 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1035 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1036 | 1036 | if ($globalvam == 'vam') { |
1037 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1038 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1037 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1038 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1039 | 1039 | if ($globalvatsim == 'vatsim' || $globalivao == 'ivao' || $globalphpvms == 'phpvms') { |
1040 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1041 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1040 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1041 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1042 | 1042 | |
1043 | 1043 | |
1044 | 1044 | |
1045 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1045 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1046 | 1046 | if ($notam == 'notam') { |
1047 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1047 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1048 | 1048 | } else { |
1049 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1049 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1050 | 1050 | } |
1051 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1051 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1052 | 1052 | if ($owner == 'owner') { |
1053 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1053 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1054 | 1054 | } else { |
1055 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1055 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1056 | 1056 | } |
1057 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1057 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1058 | 1058 | if ($map3d == 'map3d') { |
1059 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1059 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1060 | 1060 | } else { |
1061 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1061 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1062 | 1062 | } |
1063 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1063 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1064 | 1064 | if ($mapsatellites == 'mapsatellites') { |
1065 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1065 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1066 | 1066 | } else { |
1067 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1067 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1068 | 1068 | } |
1069 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1069 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1070 | 1070 | if ($map3ddefault == 'map3ddefault') { |
1071 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1071 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1072 | 1072 | } else { |
1073 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1073 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1074 | 1074 | } |
1075 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1075 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1076 | 1076 | if ($translate == 'translate') { |
1077 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1077 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1078 | 1078 | } else { |
1079 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1079 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1080 | 1080 | } |
1081 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1081 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1082 | 1082 | if ($realairlines == 'realairlines') { |
1083 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1083 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1084 | 1084 | } else { |
1085 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1085 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1086 | 1086 | } |
1087 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1087 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1088 | 1088 | if ($estimation == 'estimation') { |
1089 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1089 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1090 | 1090 | } else { |
1091 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1091 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1092 | 1092 | } |
1093 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1093 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1094 | 1094 | if ($metar == 'metar') { |
1095 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1095 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1096 | 1096 | } else { |
1097 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1097 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1098 | 1098 | } |
1099 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1099 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1100 | 1100 | if ($metarcycle == 'metarcycle') { |
1101 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1101 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1102 | 1102 | } else { |
1103 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1103 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1104 | 1104 | } |
1105 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1105 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1106 | 1106 | if ($fork == 'fork') { |
1107 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1107 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1108 | 1108 | } else { |
1109 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1109 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1110 | 1110 | } |
1111 | 1111 | |
1112 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1112 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1113 | 1113 | if ($colormap == 'colormap') { |
1114 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1114 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1115 | 1115 | } else { |
1116 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1116 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | if (isset($_POST['aircrafticoncolor'])) { |
1120 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1121 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1120 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1121 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1122 | 1122 | } |
1123 | 1123 | |
1124 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1125 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1124 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1125 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1126 | 1126 | |
1127 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1128 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1129 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1130 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1131 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1132 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1127 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1128 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1129 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1130 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1131 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1132 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1133 | 1133 | |
1134 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1134 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1135 | 1135 | if ($mappopup == 'mappopup') { |
1136 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1136 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1137 | 1137 | } else { |
1138 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1138 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1139 | 1139 | } |
1140 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1140 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1141 | 1141 | if ($airportpopup == 'airportpopup') { |
1142 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1142 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1143 | 1143 | } else { |
1144 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1144 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1145 | 1145 | } |
1146 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1146 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1147 | 1147 | if ($maphistory == 'maphistory') { |
1148 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1148 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1149 | 1149 | } else { |
1150 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1150 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1151 | 1151 | } |
1152 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1152 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1153 | 1153 | if ($flightroute == 'flightroute') { |
1154 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1154 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1155 | 1155 | } else { |
1156 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1156 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1157 | 1157 | } |
1158 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1158 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1159 | 1159 | if ($allflights == 'allflights') { |
1160 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1160 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1161 | 1161 | } else { |
1162 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1162 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1163 | 1163 | } |
1164 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1164 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1165 | 1165 | if ($waypoints == 'waypoints') { |
1166 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1166 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1167 | 1167 | } else { |
1168 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1168 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1171 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1172 | 1172 | |
1173 | 1173 | // Set some defaults values... |
1174 | 1174 | if (!isset($globalAircraftImageSources)) { |
1175 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1176 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1175 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1176 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | if (!isset($globalSchedulesSources)) { |
1180 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1181 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1180 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1181 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1182 | 1182 | } |
1183 | 1183 | |
1184 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1184 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1185 | 1185 | |
1186 | 1186 | if ($error == '') settings::modify_settings($settings); |
1187 | 1187 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | header('Content-disposition: attachment; filename="atc.geojson"'); |
8 | 8 | } |
9 | 9 | header('Content-Type: text/javascript'); |
10 | -$ATC=new ATC(); |
|
10 | +$ATC = new ATC(); |
|
11 | 11 | if (isset($_GET['coord'])) |
12 | 12 | { |
13 | 13 | //$coords = explode(',',$_GET['coord']); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $output = '{"type": "FeatureCollection","features": ['; |
20 | 20 | if (!empty($spotter_array)) |
21 | 21 | { |
22 | - foreach($spotter_array as $spotter_item) |
|
22 | + foreach ($spotter_array as $spotter_item) |
|
23 | 23 | { |
24 | 24 | date_default_timezone_set('UTC'); |
25 | 25 | //waypoint plotting |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | |
17 | 17 | if (isset($_GET['start_date'])) { |
18 | 18 | //for the date manipulation into the query |
19 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
19 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
20 | 20 | $start_date = $_GET['start_date']." 00:00:00"; |
21 | 21 | $end_date = $_GET['end_date']." 00:00:00"; |
22 | 22 | $sql_date = $start_date.",".$end_date; |
23 | - } else if($_GET['start_date'] != ""){ |
|
23 | + } else if ($_GET['start_date'] != "") { |
|
24 | 24 | $start_date = $_GET['start_date']." 00:00:00"; |
25 | 25 | $sql_date = $start_date; |
26 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
26 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
27 | 27 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00"; |
28 | 28 | $sql_date = $end_date; |
29 | 29 | } else $sql_date = ''; |
@@ -31,21 +31,21 @@ discard block |
||
31 | 31 | |
32 | 32 | if (isset($_GET['highest_altitude'])) { |
33 | 33 | //for altitude manipulation |
34 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
34 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
35 | 35 | $end_altitude = $_GET['highest_altitude']; |
36 | 36 | $start_altitude = $_GET['lowest_altitude']; |
37 | 37 | $sql_altitude = $start_altitude.",".$end_altitude; |
38 | - } else if($_GET['highest_altitude'] != ""){ |
|
38 | + } else if ($_GET['highest_altitude'] != "") { |
|
39 | 39 | $end_altitude = $_GET['highest_altitude']; |
40 | 40 | $sql_altitude = $end_altitude; |
41 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
41 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
42 | 42 | $start_altitude = $_GET['lowest_altitude'].",60000"; |
43 | 43 | $sql_altitude = $start_altitude; |
44 | 44 | } else $sql_altitude = ''; |
45 | 45 | } else $sql_altitude = ''; |
46 | 46 | |
47 | 47 | //calculuation for the pagination |
48 | -if(!isset($_GET['limit'])) |
|
48 | +if (!isset($_GET['limit'])) |
|
49 | 49 | { |
50 | 50 | if (!isset($_GET['number_results'])) |
51 | 51 | { |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | $limit_end = 25; |
54 | 54 | $absolute_difference = 25; |
55 | 55 | } else { |
56 | - if ($_GET['number_results'] > 1000){ |
|
56 | + if ($_GET['number_results'] > 1000) { |
|
57 | 57 | $_GET['number_results'] = 1000; |
58 | 58 | } |
59 | 59 | $limit_start = 0; |
60 | 60 | $limit_end = $_GET['number_results']; |
61 | 61 | $absolute_difference = $_GET['number_results']; |
62 | 62 | } |
63 | -} else { |
|
63 | +} else { |
|
64 | 64 | $limit_explode = explode(",", $_GET['limit']); |
65 | 65 | $limit_start = $limit_explode[0]; |
66 | 66 | $limit_end = $limit_explode[1]; |
@@ -70,28 +70,28 @@ discard block |
||
70 | 70 | $limit_previous_1 = $limit_start - $absolute_difference; |
71 | 71 | $limit_previous_2 = $limit_end - $absolute_difference; |
72 | 72 | |
73 | -if (!empty($_GET)){ |
|
74 | - $q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING); |
|
75 | - $registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING); |
|
76 | - $aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING); |
|
77 | - $manufacturer = filter_input(INPUT_GET, 'manufacturer',FILTER_SANITIZE_STRING); |
|
78 | - $highlights = filter_input(INPUT_GET, 'highlights',FILTER_SANITIZE_STRING); |
|
79 | - $airline = filter_input(INPUT_GET, 'airline',FILTER_SANITIZE_STRING); |
|
80 | - $airline_country = filter_input(INPUT_GET, 'airline_country',FILTER_SANITIZE_STRING); |
|
81 | - $airline_type = filter_input(INPUT_GET, 'airline_type',FILTER_SANITIZE_STRING); |
|
82 | - $airport = filter_input(INPUT_GET, 'airport',FILTER_SANITIZE_STRING); |
|
83 | - $airport_country = filter_input(INPUT_GET, 'airport_country',FILTER_SANITIZE_STRING); |
|
84 | - $callsign = filter_input(INPUT_GET, 'callsign',FILTER_SANITIZE_STRING); |
|
85 | - $owner = filter_input(INPUT_GET, 'owner',FILTER_SANITIZE_STRING); |
|
86 | - $pilot_name = filter_input(INPUT_GET, 'pilot_name',FILTER_SANITIZE_STRING); |
|
87 | - $pilot_id = filter_input(INPUT_GET, 'pilot_id',FILTER_SANITIZE_STRING); |
|
88 | - $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route',FILTER_SANITIZE_STRING); |
|
89 | - $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
90 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
91 | - $archive = filter_input(INPUT_GET,'archive',FILTER_SANITIZE_NUMBER_INT); |
|
92 | - $origlat = filter_input(INPUT_GET,'origlat',FILTER_SANITIZE_STRING); |
|
93 | - $origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_STRING); |
|
94 | - $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
|
73 | +if (!empty($_GET)) { |
|
74 | + $q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
75 | + $registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
76 | + $aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
77 | + $manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
78 | + $highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
79 | + $airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
80 | + $airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
81 | + $airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
82 | + $airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
83 | + $airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
84 | + $callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
85 | + $owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
86 | + $pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
87 | + $pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
88 | + $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
89 | + $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
90 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
91 | + $archive = filter_input(INPUT_GET, 'archive', FILTER_SANITIZE_NUMBER_INT); |
|
92 | + $origlat = filter_input(INPUT_GET, 'origlat', FILTER_SANITIZE_STRING); |
|
93 | + $origlon = filter_input(INPUT_GET, 'origlon', FILTER_SANITIZE_STRING); |
|
94 | + $dist = filter_input(INPUT_GET, 'dist', FILTER_SANITIZE_NUMBER_INT); |
|
95 | 95 | if ($dist != '') { |
96 | 96 | if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
97 | 97 | elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | if (!isset($sql_date)) $sql_date = ''; |
100 | 100 | if ($archive == 1) { |
101 | 101 | $SpotterArchive = new SpotterArchive(); |
102 | - $spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
102 | + $spotter_array = $SpotterArchive->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
103 | 103 | } else { |
104 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
104 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | print '<span class="sub-menu-statistic column mobile">'; |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | //remove 3D=true parameter |
135 | 135 | $no3D = str_replace("&3D=true", "", $_SERVER['QUERY_STRING']); |
136 | 136 | $kmlURL = str_replace("http://", "kml://", $globalURL); |
137 | - if (!isset($_GET['3D'])){ |
|
137 | + if (!isset($_GET['3D'])) { |
|
138 | 138 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'" class="active"><i class="fa fa-table"></i> '._("Table").'</a></li>'; |
139 | 139 | } else { |
140 | 140 | print '<li><span class="notablet"><a href="'.$globalURL.'/search?'.$no3D.'"><i class="fa fa-table"></i> '._("Table").'</a></span></li>'; |
141 | 141 | } |
142 | - if (isset($_GET['3D'])){ |
|
142 | + if (isset($_GET['3D'])) { |
|
143 | 143 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="active"><i class="fa fa-globe"></i> '._("3D Map").'</a></li>'; |
144 | 144 | } else { |
145 | 145 | print '<li ><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="notablet nomobile"><i class="fa fa-globe"></i> '._("3D Map").'</a><a href="'.$kmlURL.'/search/kml?'.htmlentities($_SERVER['QUERY_STRING']).'" class="tablet mobile"><i class="fa fa-globe"></i> 3D Map</a></li>'; |
@@ -160,30 +160,30 @@ discard block |
||
160 | 160 | print '<div class="column">'; |
161 | 161 | print '<div class="info">'; |
162 | 162 | print '<h1>'._("Search Results for").' '; |
163 | - if (isset($_GET['q']) && $_GET['q'] != ""){ print _("Keyword:").' <span>'.$_GET['q'].'</span> '; } |
|
164 | - if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$_GET['aircraft'].'</span> '; } |
|
165 | - if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$_GET['manufacturer'].'</span> '; } |
|
166 | - if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$_GET['registration'].'</span> '; } |
|
167 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$_GET['highlights'].'</span> '; } |
|
168 | - if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$_GET['airline'].'</span> '; } |
|
169 | - if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$_GET['airline_country'].'</span> '; } |
|
170 | - if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$_GET['airline_type'].'</span> '; } |
|
171 | - if (isset($_GET['airport']) && $_GET['airport'] != ""){ print _("Airport:").' <span>'.$_GET['airport'].'</span> '; } |
|
172 | - if (isset($_GET['airport_country']) && $_GET['airport_country'] != ""){ print _("Airport country:").' <span>'.$_GET['airport_country'].'</span> '; } |
|
173 | - if (isset($_GET['callsign']) && $_GET['callsign'] != ""){ print _("Callsign:").' <span>'.$_GET['callsign'].'</span> '; } |
|
174 | - if (isset($_GET['owner']) && $_GET['owner'] != ""){ print _("Owner:").' <span>'.$_GET['owner'].'</span> '; } |
|
175 | - if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != ""){ print _("Pilot id:").' <span>'.$_GET['pilot_id'].'</span> '; } |
|
176 | - if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != ""){ print _("Pilot name:").' <span>'.$_GET['pilot_name'].'</span> '; } |
|
177 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")){ print _("Route out of:").' <span>'.$_GET['departure_airport_route'].'</span> '; } |
|
178 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route into:").' <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
179 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route between:").' <span>'.$_GET['departure_airport_route'].'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
180 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == ""){ print _("Date starting at:").' <span>'.$_GET['start_date'].'</span> '; } |
|
181 | - if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date ending at:").' <span>'.$_GET['end_date'].'</span> '; } |
|
182 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date between:").' <span>'.$_GET['start_date'].'</span> and <span>'.$_GET['end_date'].'</span> '; } |
|
183 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == ""){ print _("Altitude starting at:").' <span>'.number_format($_GET['lowest_altitude']).' feet</span> '; } |
|
184 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude ending at:").' <span>'.number_format($_GET['highest_altitude']).' feet</span> '; } |
|
185 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude between:").' <span>'.number_format($_GET['lowest_altitude']).' feet</span> '._("and").' <span>'.number_format($_GET['highest_altitude']).' feet</span> '; } |
|
186 | - if (isset($_GET['number_results']) && $_GET['number_results'] != ""){ print _("limit per page:").' <span>'.$_GET['number_results'].'</span> '; } |
|
163 | + if (isset($_GET['q']) && $_GET['q'] != "") { print _("Keyword:").' <span>'.$_GET['q'].'</span> '; } |
|
164 | + if (isset($_GET['aircraft']) && $_GET['aircraft'] != "") { print _("Aircraft:").' <span>'.$_GET['aircraft'].'</span> '; } |
|
165 | + if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != "") { print _("Manufacturer:").' <span>'.$_GET['manufacturer'].'</span> '; } |
|
166 | + if (isset($_GET['registration']) && $_GET['registration'] != "") { print _("Registration:").' <span>'.$_GET['registration'].'</span> '; } |
|
167 | + if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print _("Highlights:").' <span>'.$_GET['highlights'].'</span> '; } |
|
168 | + if (isset($_GET['airline']) && $_GET['airline'] != "") { print _("Airline:").' <span>'.$_GET['airline'].'</span> '; } |
|
169 | + if (isset($_GET['airline_country']) && $_GET['airline_country'] != "") { print _("Airline country:").' <span>'.$_GET['airline_country'].'</span> '; } |
|
170 | + if (isset($_GET['airline_type']) && $_GET['airline_type'] != "") { print _("Airline type:").' <span>'.$_GET['airline_type'].'</span> '; } |
|
171 | + if (isset($_GET['airport']) && $_GET['airport'] != "") { print _("Airport:").' <span>'.$_GET['airport'].'</span> '; } |
|
172 | + if (isset($_GET['airport_country']) && $_GET['airport_country'] != "") { print _("Airport country:").' <span>'.$_GET['airport_country'].'</span> '; } |
|
173 | + if (isset($_GET['callsign']) && $_GET['callsign'] != "") { print _("Callsign:").' <span>'.$_GET['callsign'].'</span> '; } |
|
174 | + if (isset($_GET['owner']) && $_GET['owner'] != "") { print _("Owner:").' <span>'.$_GET['owner'].'</span> '; } |
|
175 | + if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != "") { print _("Pilot id:").' <span>'.$_GET['pilot_id'].'</span> '; } |
|
176 | + if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != "") { print _("Pilot name:").' <span>'.$_GET['pilot_name'].'</span> '; } |
|
177 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")) { print _("Route out of:").' <span>'.$_GET['departure_airport_route'].'</span> '; } |
|
178 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route into:").' <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
179 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route between:").' <span>'.$_GET['departure_airport_route'].'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
180 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == "") { print _("Date starting at:").' <span>'.$_GET['start_date'].'</span> '; } |
|
181 | + if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date ending at:").' <span>'.$_GET['end_date'].'</span> '; } |
|
182 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date between:").' <span>'.$_GET['start_date'].'</span> and <span>'.$_GET['end_date'].'</span> '; } |
|
183 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == "") { print _("Altitude starting at:").' <span>'.number_format($_GET['lowest_altitude']).' feet</span> '; } |
|
184 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude ending at:").' <span>'.number_format($_GET['highest_altitude']).' feet</span> '; } |
|
185 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude between:").' <span>'.number_format($_GET['lowest_altitude']).' feet</span> '._("and").' <span>'.number_format($_GET['highest_altitude']).' feet</span> '; } |
|
186 | + if (isset($_GET['number_results']) && $_GET['number_results'] != "") { print _("limit per page:").' <span>'.$_GET['number_results'].'</span> '; } |
|
187 | 187 | print '</h1>'; |
188 | 188 | print '</div>'; |
189 | 189 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | </select> |
291 | 291 | </div> |
292 | 292 | </div> |
293 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $_GET['manufacturer']; ?>')</script> |
|
293 | + <script type="text/javascript">getSelect('manufacturer','<?php if (isset($_GET['manufacturer'])) print $_GET['manufacturer']; ?>')</script> |
|
294 | 294 | <div class="form-group"> |
295 | 295 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
296 | 296 | <div class="col-sm-10"> |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | </select> |
300 | 300 | </div> |
301 | 301 | </div> |
302 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $_GET['aircraft_icao']; ?>');</script> |
|
302 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if (isset($_GET['aircraft_icao'])) print $_GET['aircraft_icao']; ?>');</script> |
|
303 | 303 | <div class="form-group"> |
304 | 304 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
305 | 305 | <div class="col-sm-10"> |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | </div> |
323 | 323 | </div> |
324 | 324 | <?php |
325 | -}else { |
|
325 | +} else { |
|
326 | 326 | ?> |
327 | 327 | <div class="form-group"> |
328 | 328 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | ?> |
336 | 336 | <div class="form-group"> |
337 | 337 | <div class="col-sm-offset-2 col-sm-10"> |
338 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
339 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
338 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
339 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
340 | 340 | </div> |
341 | 341 | </div> |
342 | 342 | </fieldset> |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | </select> |
351 | 351 | </div> |
352 | 352 | </div> |
353 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $_GET['airline']; ?>');</script> |
|
353 | + <script type="text/javascript">getSelect('airlinenames','<?php if (isset($_GET['airline'])) print $_GET['airline']; ?>');</script> |
|
354 | 354 | <div class="form-group"> |
355 | 355 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
356 | 356 | <div class="col-sm-10"> |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | </select> |
360 | 360 | </div> |
361 | 361 | </div> |
362 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $_GET['airline_country']; ?>');</script> |
|
362 | + <script type="text/javascript">getSelect('airlinecountries','<?php if (isset($_GET['airline_country'])) print $_GET['airline_country']; ?>');</script> |
|
363 | 363 | <div class="form-group"> |
364 | 364 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
365 | 365 | <div class="col-sm-10"> |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | </div> |
369 | 369 | <div class="form-group"> |
370 | 370 | <div class="col-sm-offset-2 col-sm-10"> |
371 | - <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
372 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
373 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
374 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
371 | + <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all") { print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
372 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger") { print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
373 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "cargo") { print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
374 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "military") { print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
375 | 375 | </div> |
376 | 376 | </div> |
377 | 377 | </fieldset> |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | </select> |
386 | 386 | </div> |
387 | 387 | </div> |
388 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $_GET['airport_icao']; ?>');</script> |
|
388 | + <script type="text/javascript">getSelect('airportnames','<?php if (isset($_GET['airport_icao'])) print $_GET['airport_icao']; ?>');</script> |
|
389 | 389 | <div class="form-group"> |
390 | 390 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
391 | 391 | <div class="col-sm-10"> |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | </select> |
395 | 395 | </div> |
396 | 396 | </div> |
397 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $_GET['airport_country']; ?>');</script> |
|
397 | + <script type="text/javascript">getSelect('airportcountries','<?php if (isset($_GET['airport_country'])) print $_GET['airport_country']; ?>');</script> |
|
398 | 398 | </fieldset> |
399 | 399 | <fieldset> |
400 | 400 | <legend><?php echo _("Route"); ?></legend> |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | </select> |
407 | 407 | </div> |
408 | 408 | </div> |
409 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $_GET['departure_airport_route']; ?>');</script> |
|
409 | + <script type="text/javascript">getSelect('departureairportnames','<?php if (isset($_GET['departure_airport_route'])) print $_GET['departure_airport_route']; ?>');</script> |
|
410 | 410 | <div class="form-group"> |
411 | 411 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
412 | 412 | <div class="col-sm-10"> |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | </select> |
416 | 416 | </div> |
417 | 417 | </div> |
418 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $_GET['arrival_airport_route']; ?>');</script> |
|
418 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if (isset($_GET['arrival_airport_route'])) print $_GET['arrival_airport_route']; ?>');</script> |
|
419 | 419 | </fieldset> |
420 | 420 | <fieldset> |
421 | 421 | <legend><?php echo _("Date"); ?></legend> |
@@ -469,9 +469,9 @@ discard block |
||
469 | 469 | <option></option> |
470 | 470 | <?php |
471 | 471 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
472 | -foreach($altitude_array as $altitude) |
|
472 | +foreach ($altitude_array as $altitude) |
|
473 | 473 | { |
474 | - if(isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
474 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
475 | 475 | { |
476 | 476 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
477 | 477 | } else { |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | <option></option> |
490 | 490 | <?php |
491 | 491 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
492 | -foreach($altitude_array as $altitude) |
|
492 | +foreach ($altitude_array as $altitude) |
|
493 | 493 | { |
494 | - if(isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
494 | + if (isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
495 | 495 | { |
496 | 496 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
497 | 497 | } else { |
@@ -530,10 +530,10 @@ discard block |
||
530 | 530 | <div class="col-sm-10"> |
531 | 531 | <select class="form-control" name="number_results"> |
532 | 532 | <?php |
533 | -$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
534 | -foreach($number_results_array as $number) |
|
533 | +$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
534 | +foreach ($number_results_array as $number) |
|
535 | 535 | { |
536 | - if(isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
536 | + if (isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
537 | 537 | { |
538 | 538 | print '<option value="'.$number.'" selected="selected">'.$number.'</option>'; |
539 | 539 | } else { |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | <fieldset> |
552 | 552 | <div class="form-group"> |
553 | 553 | <div class="col-sm-offset-2 col-sm-10"> |
554 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
554 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
555 | 555 | </div> |
556 | 556 | </div> |
557 | 557 | </fieldset> |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | die; |
41 | 41 | } |
42 | 42 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
43 | - $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
|
43 | + $globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | -$options = getopt('s::',array('source::','server','idsource::')); |
|
47 | +$options = getopt('s::', array('source::', 'server', 'idsource::')); |
|
48 | 48 | //if (isset($options['s'])) $hosts = array($options['s']); |
49 | 49 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
50 | 50 | if (isset($options['s'])) { |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | else $id_source = 1; |
60 | 60 | if (isset($globalServer) && $globalServer) { |
61 | 61 | if ($globalDebug) echo "Using Server Mode\n"; |
62 | - $SI=new SpotterServer(); |
|
63 | -} else $SI=new SpotterImport($Connection->db); |
|
62 | + $SI = new SpotterServer(); |
|
63 | +} else $SI = new SpotterImport($Connection->db); |
|
64 | 64 | //$APRS=new APRS($Connection->db); |
65 | -$SBS=new SBS(); |
|
66 | -$ACARS=new ACARS($Connection->db); |
|
67 | -$Common=new Common(); |
|
65 | +$SBS = new SBS(); |
|
66 | +$ACARS = new ACARS($Connection->db); |
|
67 | +$Common = new Common(); |
|
68 | 68 | date_default_timezone_set('UTC'); |
69 | 69 | //$servertz = system('date +%Z'); |
70 | 70 | // signal handler - playing nice with sockets and dump1090 |
71 | 71 | if (function_exists('pcntl_fork')) { |
72 | - pcntl_signal(SIGINT, function() { |
|
72 | + pcntl_signal(SIGINT, function() { |
|
73 | 73 | global $sockets; |
74 | 74 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
75 | 75 | die("Bye!\n"); |
@@ -112,34 +112,34 @@ discard block |
||
112 | 112 | |
113 | 113 | function connect_all($hosts) { |
114 | 114 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
115 | - global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
115 | + global $sockets, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs; |
|
116 | 116 | if ($globalDebug) echo 'Connect to all...'."\n"; |
117 | 117 | foreach ($hosts as $id => $value) { |
118 | 118 | $host = $value['host']; |
119 | 119 | $globalSources[$id]['last_exec'] = 0; |
120 | 120 | // Here we check type of source(s) |
121 | - if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
122 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
121 | + if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
122 | + if (preg_match('/deltadb.txt$/i', $host)) { |
|
123 | 123 | //$formats[$id] = 'deltadbtxt'; |
124 | 124 | $globalSources[$id]['format'] = 'deltadbtxt'; |
125 | 125 | //$last_exec['deltadbtxt'] = 0; |
126 | 126 | if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
127 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
127 | + } else if (preg_match('/vatsim-data.txt$/i', $host)) { |
|
128 | 128 | //$formats[$id] = 'vatsimtxt'; |
129 | 129 | $globalSources[$id]['format'] = 'vatsimtxt'; |
130 | 130 | //$last_exec['vatsimtxt'] = 0; |
131 | 131 | if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
132 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
132 | + } else if (preg_match('/aircraftlist.json$/i', $host)) { |
|
133 | 133 | //$formats[$id] = 'aircraftlistjson'; |
134 | 134 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
135 | 135 | //$last_exec['aircraftlistjson'] = 0; |
136 | 136 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
137 | - } else if (preg_match('/opensky/i',$host)) { |
|
137 | + } else if (preg_match('/opensky/i', $host)) { |
|
138 | 138 | //$formats[$id] = 'aircraftlistjson'; |
139 | 139 | $globalSources[$id]['format'] = 'opensky'; |
140 | 140 | //$last_exec['aircraftlistjson'] = 0; |
141 | 141 | if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
142 | - } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
142 | + } else if (preg_match('/radarvirtuel.com\/file.json$/i', $host)) { |
|
143 | 143 | //$formats[$id] = 'radarvirtueljson'; |
144 | 144 | $globalSources[$id]['format'] = 'radarvirtueljson'; |
145 | 145 | //$last_exec['radarvirtueljson'] = 0; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
149 | 149 | exit(0); |
150 | 150 | } |
151 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
151 | + } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { |
|
152 | 152 | //$formats[$id] = 'planeupdatefaa'; |
153 | 153 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
154 | 154 | //$last_exec['planeupdatefaa'] = 0; |
@@ -157,26 +157,26 @@ discard block |
||
157 | 157 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
158 | 158 | exit(0); |
159 | 159 | } |
160 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
160 | + } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { |
|
161 | 161 | //$formats[$id] = 'phpvmacars'; |
162 | 162 | $globalSources[$id]['format'] = 'phpvmacars'; |
163 | 163 | //$last_exec['phpvmacars'] = 0; |
164 | 164 | if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
165 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
165 | + } else if (preg_match('/VAM-json.php$/i', $host)) { |
|
166 | 166 | //$formats[$id] = 'phpvmacars'; |
167 | 167 | $globalSources[$id]['format'] = 'vam'; |
168 | 168 | if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
169 | - } else if (preg_match('/whazzup/i',$host)) { |
|
169 | + } else if (preg_match('/whazzup/i', $host)) { |
|
170 | 170 | //$formats[$id] = 'whazzup'; |
171 | 171 | $globalSources[$id]['format'] = 'whazzup'; |
172 | 172 | //$last_exec['whazzup'] = 0; |
173 | 173 | if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
174 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
174 | + } else if (preg_match('/recentpireps/i', $host)) { |
|
175 | 175 | //$formats[$id] = 'pirepsjson'; |
176 | 176 | $globalSources[$id]['format'] = 'pirepsjson'; |
177 | 177 | //$last_exec['pirepsjson'] = 0; |
178 | 178 | if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
179 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
179 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { |
|
180 | 180 | //$formats[$id] = 'fr24json'; |
181 | 181 | $globalSources[$id]['format'] = 'fr24json'; |
182 | 182 | //$last_exec['fr24json'] = 0; |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | exit(0); |
187 | 187 | } |
188 | 188 | //} else if (preg_match('/10001/',$host)) { |
189 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
189 | + } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
190 | 190 | //$formats[$id] = 'tsv'; |
191 | 191 | $globalSources[$id]['format'] = 'tsv'; |
192 | 192 | if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
193 | 193 | } |
194 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
194 | + } elseif (filter_var($host, FILTER_VALIDATE_URL)) { |
|
195 | 195 | if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
196 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
197 | - $hostport = explode(':',$host); |
|
196 | + } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { |
|
197 | + $hostport = explode(':', $host); |
|
198 | 198 | if (isset($hostport[1])) { |
199 | 199 | $port = $hostport[1]; |
200 | 200 | $hostn = $hostport[0]; |
@@ -203,14 +203,14 @@ discard block |
||
203 | 203 | $hostn = $globalSources[$id]['host']; |
204 | 204 | } |
205 | 205 | if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
206 | - $s = create_socket($hostn,$port, $errno, $errstr); |
|
206 | + $s = create_socket($hostn, $port, $errno, $errstr); |
|
207 | 207 | } else { |
208 | - $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
208 | + $s = create_socket_udp($hostn, $port, $errno, $errstr); |
|
209 | 209 | } |
210 | 210 | if ($s) { |
211 | 211 | $sockets[$id] = $s; |
212 | 212 | if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
213 | - if (preg_match('/aprs/',$hostn)) { |
|
213 | + if (preg_match('/aprs/', $hostn)) { |
|
214 | 214 | //$formats[$id] = 'aprs'; |
215 | 215 | $globalSources[$id]['format'] = 'aprs'; |
216 | 216 | //$aprs_connect = 0; |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
252 | 252 | else $timeout = 20; |
253 | 253 | $errno = ''; |
254 | -$errstr=''; |
|
254 | +$errstr = ''; |
|
255 | 255 | |
256 | 256 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
257 | 257 | /* Initiate connections to all the hosts simultaneously */ |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | if ($use_aprs) { |
282 | 282 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
283 | - $APRS=new APRS(); |
|
283 | + $APRS = new APRS(); |
|
284 | 284 | $aprs_connect = 0; |
285 | 285 | $aprs_keep = 120; |
286 | 286 | $aprs_last_tx = time(); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | else $aprs_ssid = 'FAM'; |
292 | 292 | //else $aprs_ssid = 'PerlEx'; |
293 | 293 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
294 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
294 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
295 | 295 | if ($aprs_full) $aprs_filter = ''; |
296 | 296 | if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} appid {$aprs_version} filter {$aprs_filter}\n"; |
297 | 297 | else $aprs_login = "user {$aprs_ssid} appid {$aprs_version}\n"; |
@@ -302,12 +302,12 @@ discard block |
||
302 | 302 | sleep(1); |
303 | 303 | if ($globalDebug) echo "SCAN MODE \n\n"; |
304 | 304 | if (!isset($globalCronEnd)) $globalCronEnd = 60; |
305 | -$endtime = time()+$globalCronEnd; |
|
305 | +$endtime = time() + $globalCronEnd; |
|
306 | 306 | $i = 1; |
307 | 307 | $tt = array(); |
308 | 308 | // Delete all ATC |
309 | 309 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
310 | - $ATC=new ATC($Connection->db); |
|
310 | + $ATC = new ATC($Connection->db); |
|
311 | 311 | } |
312 | 312 | if (!$globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
313 | 313 | $ATC->deleteAll(); |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
317 | 317 | while ($i > 0) { |
318 | - if (!$globalDaemon) $i = $endtime-time(); |
|
318 | + if (!$globalDaemon) $i = $endtime - time(); |
|
319 | 319 | // Delete old ATC |
320 | 320 | if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
321 | 321 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | } |
330 | 330 | if ($max != $globalMinFetch) { |
331 | 331 | if ($globalDebug) echo 'Sleeping...'."\n"; |
332 | - sleep($globalMinFetch-$max+2); |
|
332 | + sleep($globalMinFetch - $max + 2); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
341 | 341 | //$buffer = $Common->getData($hosts[$id]); |
342 | 342 | $buffer = $Common->getData($value['host']); |
343 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
344 | - $buffer = explode('\n',$buffer); |
|
343 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
344 | + $buffer = explode('\n', $buffer); |
|
345 | 345 | foreach ($buffer as $line) { |
346 | 346 | if ($line != '' && count($line) > 7) { |
347 | 347 | $line = explode(',', $line); |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | } elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $value[' last_exec'] > $globalMinFetch))) { |
371 | 371 | //$buffer = $Common->getData($hosts[$id]); |
372 | 372 | $buffer = $Common->getData($value['host']); |
373 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
374 | - $buffer = explode('\n',$buffer); |
|
373 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
374 | + $buffer = explode('\n', $buffer); |
|
375 | 375 | foreach ($buffer as $line) { |
376 | 376 | if ($line != '') { |
377 | 377 | $line = explode(':', $line); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | $data['id'] = $line[1].'-'.$line[0]; |
381 | 381 | $data['pilot_id'] = $line[1]; |
382 | 382 | $data['pilot_name'] = $line[2]; |
383 | - $data['hex'] = str_pad(dechex($line[1]),6,'000000',STR_PAD_LEFT); |
|
383 | + $data['hex'] = str_pad(dechex($line[1]), 6, '000000', STR_PAD_LEFT); |
|
384 | 384 | $data['ident'] = $line[0]; // ident |
385 | 385 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
386 | 386 | $data['speed'] = $line[8]; // speed |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
397 | 397 | if (isset($line[37])) $data['last_update'] = $line[37]; |
398 | 398 | $data['departure_airport_icao'] = $line[11]; |
399 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
399 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); |
|
400 | 400 | $data['arrival_airport_icao'] = $line[13]; |
401 | 401 | $data['frequency'] = $line[4]; |
402 | 402 | $data['type'] = $line[18]; |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $data['id_source'] = $id_source; |
406 | 406 | //$data['arrival_airport_time'] = ; |
407 | 407 | if ($line[9] != '') { |
408 | - $aircraft_data = explode('/',$line[9]); |
|
408 | + $aircraft_data = explode('/', $line[9]); |
|
409 | 409 | if (isset($aircraft_data[1])) { |
410 | 410 | $data['aircraft_icao'] = $aircraft_data[1]; |
411 | 411 | } |
@@ -419,9 +419,9 @@ discard block |
||
419 | 419 | if ($line[3] == 'PILOT') $SI->add($data); |
420 | 420 | elseif ($line[3] == 'ATC') { |
421 | 421 | //print_r($data); |
422 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
423 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
424 | - $typec = substr($data['ident'],-3); |
|
422 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
423 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
424 | + $typec = substr($data['ident'], -3); |
|
425 | 425 | if ($typec == 'APP') $data['type'] = 'Approach'; |
426 | 426 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
427 | 427 | elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
433 | 433 | elseif ($data['type'] == '') $data['type'] = 'Observer'; |
434 | 434 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
435 | - echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
435 | + echo $ATC->add($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
436 | 436 | } |
437 | 437 | unset($data); |
438 | 438 | } |
@@ -443,9 +443,9 @@ discard block |
||
443 | 443 | $last_exec[$id]['last'] = time(); |
444 | 444 | //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
445 | 445 | } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
446 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
446 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
447 | 447 | if ($buffer != '') { |
448 | - $all_data = json_decode($buffer,true); |
|
448 | + $all_data = json_decode($buffer, true); |
|
449 | 449 | if (isset($all_data['acList'])) { |
450 | 450 | foreach ($all_data['acList'] as $line) { |
451 | 451 | $data = array(); |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
500 | 500 | } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
501 | 501 | $buffer = $Common->getData($value['host']); |
502 | - $all_data = json_decode($buffer,true); |
|
502 | + $all_data = json_decode($buffer, true); |
|
503 | 503 | if (isset($all_data['planes'])) { |
504 | 504 | foreach ($all_data['planes'] as $key => $line) { |
505 | 505 | $data = array(); |
@@ -515,12 +515,12 @@ discard block |
||
515 | 515 | $data['emergency'] = ''; // emergency |
516 | 516 | $data['registration'] = $line[2]; |
517 | 517 | $data['aircraft_icao'] = $line[0]; |
518 | - $deparr = explode('-',$line[1]); |
|
518 | + $deparr = explode('-', $line[1]); |
|
519 | 519 | if (count($deparr) == 2) { |
520 | 520 | $data['departure_airport_icao'] = $deparr[0]; |
521 | 521 | $data['arrival_airport_icao'] = $deparr[1]; |
522 | 522 | } |
523 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
523 | + $data['datetime'] = date('Y-m-d H:i:s', $line[9]); |
|
524 | 524 | $data['format_source'] = 'planeupdatefaa'; |
525 | 525 | $data['id_source'] = $id_source; |
526 | 526 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | $last_exec[$id]['last'] = time(); |
533 | 533 | } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
534 | 534 | $buffer = $Common->getData($value['host']); |
535 | - $all_data = json_decode($buffer,true); |
|
535 | + $all_data = json_decode($buffer, true); |
|
536 | 536 | if (isset($all_data['states'])) { |
537 | 537 | foreach ($all_data['states'] as $key => $line) { |
538 | 538 | $data = array(); |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | //$data['emergency'] = ''; // emergency |
549 | 549 | //$data['registration'] = $line[2]; |
550 | 550 | //$data['aircraft_icao'] = $line[0]; |
551 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
551 | + $data['datetime'] = date('Y-m-d H:i:s', $line[3]); |
|
552 | 552 | $data['format_source'] = 'opensky'; |
553 | 553 | $data['id_source'] = $id_source; |
554 | 554 | $SI->add($data); |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
562 | 562 | //$buffer = $Common->getData($hosts[$id]); |
563 | 563 | $buffer = $Common->getData($value['host']); |
564 | - $all_data = json_decode($buffer,true); |
|
564 | + $all_data = json_decode($buffer, true); |
|
565 | 565 | foreach ($all_data as $key => $line) { |
566 | 566 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
567 | 567 | $data = array(); |
@@ -592,11 +592,11 @@ discard block |
||
592 | 592 | //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
593 | 593 | } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
594 | 594 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
595 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
595 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); |
|
596 | 596 | //echo $buffer; |
597 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
598 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
599 | - $all_data = json_decode($buffer,true); |
|
597 | + $buffer = str_replace(array("\n", "\r"), "", $buffer); |
|
598 | + $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); |
|
599 | + $all_data = json_decode($buffer, true); |
|
600 | 600 | if (json_last_error() != JSON_ERROR_NONE) { |
601 | 601 | die(json_last_error_msg()); |
602 | 602 | } |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | //$data['departure_airport_iata'] = $line[11]; |
619 | 619 | //$data['arrival_airport_iata'] = $line[12]; |
620 | 620 | //$data['emergency'] = ''; // emergency |
621 | - $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
|
621 | + $data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] |
|
622 | 622 | $data['format_source'] = 'radarvirtueljson'; |
623 | 623 | $data['id_source'] = $id_source; |
624 | 624 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
@@ -633,13 +633,13 @@ discard block |
||
633 | 633 | } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
634 | 634 | //$buffer = $Common->getData($hosts[$id]); |
635 | 635 | $buffer = $Common->getData($value['host'].'?'.time()); |
636 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
636 | + $all_data = json_decode(utf8_encode($buffer), true); |
|
637 | 637 | |
638 | 638 | if (isset($all_data['pireps'])) { |
639 | 639 | foreach ($all_data['pireps'] as $line) { |
640 | 640 | $data = array(); |
641 | 641 | $data['id'] = $line['id']; |
642 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
642 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
643 | 643 | $data['ident'] = $line['callsign']; // ident |
644 | 644 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
645 | 645 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
@@ -668,9 +668,9 @@ discard block |
||
668 | 668 | $SI->add($data); |
669 | 669 | // print_r($data); |
670 | 670 | } elseif ($line['icon'] == 'ct') { |
671 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
672 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
673 | - $typec = substr($data['ident'],-3); |
|
671 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
672 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
673 | + $typec = substr($data['ident'], -3); |
|
674 | 674 | $data['type'] = ''; |
675 | 675 | if ($typec == 'APP') $data['type'] = 'Approach'; |
676 | 676 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
682 | 682 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
683 | 683 | else $data['type'] = 'Observer'; |
684 | - echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
684 | + echo $ATC->add($data['ident'], '', $data['latitude'], $data['longitude'], '0', $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source']); |
|
685 | 685 | } |
686 | 686 | unset($data); |
687 | 687 | } |
@@ -693,13 +693,13 @@ discard block |
||
693 | 693 | //$buffer = $Common->getData($hosts[$id]); |
694 | 694 | if ($globalDebug) echo 'Get Data...'."\n"; |
695 | 695 | $buffer = $Common->getData($value['host']); |
696 | - $all_data = json_decode($buffer,true); |
|
696 | + $all_data = json_decode($buffer, true); |
|
697 | 697 | if ($buffer != '' && is_array($all_data)) { |
698 | 698 | foreach ($all_data as $line) { |
699 | 699 | $data = array(); |
700 | 700 | //$data['id'] = $line['id']; // id not usable |
701 | 701 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
702 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
702 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
703 | 703 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
704 | 704 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
705 | 705 | $data['ident'] = $line['flightnum']; // ident |
@@ -722,12 +722,12 @@ discard block |
||
722 | 722 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
723 | 723 | if (isset($line['aircraftname'])) { |
724 | 724 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
725 | - $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
|
726 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
725 | + $line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); |
|
726 | + $aircraft_data = explode('-', $line['aircraftname']); |
|
727 | 727 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
728 | 728 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
729 | 729 | else { |
730 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
730 | + $aircraft_data = explode(' ', $line['aircraftname']); |
|
731 | 731 | if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
732 | 732 | else $data['aircraft_icao'] = $line['aircraftname']; |
733 | 733 | } |
@@ -749,13 +749,13 @@ discard block |
||
749 | 749 | //$buffer = $Common->getData($hosts[$id]); |
750 | 750 | if ($globalDebug) echo 'Get Data...'."\n"; |
751 | 751 | $buffer = $Common->getData($value['host']); |
752 | - $all_data = json_decode($buffer,true); |
|
752 | + $all_data = json_decode($buffer, true); |
|
753 | 753 | if ($buffer != '' && is_array($all_data)) { |
754 | 754 | foreach ($all_data as $line) { |
755 | 755 | $data = array(); |
756 | 756 | //$data['id'] = $line['id']; // id not usable |
757 | 757 | $data['id'] = trim($line['flight_id']); |
758 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
758 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
759 | 759 | $data['pilot_name'] = $line['pilot_name']; |
760 | 760 | $data['pilot_id'] = $line['pilot_id']; |
761 | 761 | $data['ident'] = trim($line['callsign']); // ident |
@@ -805,9 +805,9 @@ discard block |
||
805 | 805 | //$value = $formats[$nb]; |
806 | 806 | $format = $globalSources[$nb]['format']; |
807 | 807 | if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
808 | - $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
808 | + $buffer = socket_read($r, 6000, PHP_NORMAL_READ); |
|
809 | 809 | } else { |
810 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
810 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); |
|
811 | 811 | } |
812 | 812 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
813 | 813 | //echo $buffer."\n"; |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
816 | 816 | $error = false; |
817 | 817 | //$SI::del(); |
818 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
818 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); |
|
819 | 819 | // SBS format is CSV format |
820 | 820 | if ($buffer != '') { |
821 | 821 | $tt[$format] = 0; |
@@ -836,10 +836,10 @@ discard block |
||
836 | 836 | } elseif ($format == 'flightgearsp') { |
837 | 837 | //echo $buffer."\n"; |
838 | 838 | if (strlen($buffer) > 5) { |
839 | - $line = explode(',',$buffer); |
|
839 | + $line = explode(',', $buffer); |
|
840 | 840 | $data = array(); |
841 | 841 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
842 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); |
|
842 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
843 | 843 | $data['ident'] = $line[6]; |
844 | 844 | $data['aircraft_name'] = $line[7]; |
845 | 845 | $data['longitude'] = $line[1]; |
@@ -850,21 +850,21 @@ discard block |
||
850 | 850 | $data['datetime'] = date('Y-m-d H:i:s'); |
851 | 851 | $data['format_source'] = 'flightgearsp'; |
852 | 852 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
853 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
853 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
854 | 854 | } |
855 | 855 | } elseif ($format == 'acars') { |
856 | 856 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
857 | 857 | $ACARS->add(trim($buffer)); |
858 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
858 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
859 | 859 | $ACARS->deleteLiveAcarsData(); |
860 | 860 | } elseif ($format == 'flightgearmp') { |
861 | - if (substr($buffer,0,1) != '#') { |
|
861 | + if (substr($buffer, 0, 1) != '#') { |
|
862 | 862 | $data = array(); |
863 | 863 | //echo $buffer."\n"; |
864 | - $line = explode(' ',$buffer); |
|
864 | + $line = explode(' ', $buffer); |
|
865 | 865 | if (count($line) == 11) { |
866 | - $userserver = explode('@',$line[0]); |
|
867 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
866 | + $userserver = explode('@', $line[0]); |
|
867 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex |
|
868 | 868 | $data['ident'] = $userserver[0]; |
869 | 869 | $data['registration'] = $userserver[0]; |
870 | 870 | $data['latitude'] = $line[4]; |
@@ -872,24 +872,24 @@ discard block |
||
872 | 872 | $data['altitude'] = $line[6]; |
873 | 873 | $data['datetime'] = date('Y-m-d H:i:s'); |
874 | 874 | $aircraft_type = $line[10]; |
875 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
876 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
875 | + $aircraft_type = preg_split(':/:', $aircraft_type); |
|
876 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); |
|
877 | 877 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
878 | 878 | } |
879 | 879 | } |
880 | 880 | } elseif ($format == 'beast') { |
881 | 881 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
882 | 882 | die; |
883 | - } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
|
883 | + } elseif ($format == 'tsv' || substr($buffer, 0, 4) == 'clock') { |
|
884 | 884 | $line = explode("\t", $buffer); |
885 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
885 | + for ($k = 0; $k < count($line); $k = $k + 2) { |
|
886 | 886 | $key = $line[$k]; |
887 | - $lined[$key] = $line[$k+1]; |
|
887 | + $lined[$key] = $line[$k + 1]; |
|
888 | 888 | } |
889 | 889 | if (count($lined) > 3) { |
890 | 890 | $data['hex'] = $lined['hexid']; |
891 | 891 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
892 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
892 | + $data['datetime'] = date('Y-m-d H:i:s'); ; |
|
893 | 893 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
894 | 894 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
895 | 895 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
@@ -907,24 +907,24 @@ discard block |
||
907 | 907 | } else $error = true; |
908 | 908 | } elseif ($format == 'aprs' && $use_aprs) { |
909 | 909 | if ($aprs_connect == 0) { |
910 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
|
910 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); |
|
911 | 911 | $aprs_connect = 1; |
912 | 912 | } |
913 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
913 | + if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { |
|
914 | 914 | $aprs_last_tx = time(); |
915 | 915 | $data_aprs = "# Keep alive"; |
916 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
916 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
917 | 917 | } |
918 | 918 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
919 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
920 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
921 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
919 | + $buffer = str_replace('APRS <- ', '', $buffer); |
|
920 | + $buffer = str_replace('APRS -> ', '', $buffer); |
|
921 | + if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { |
|
922 | 922 | $line = $APRS->parse($buffer); |
923 | 923 | if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
924 | 924 | $data = array(); |
925 | 925 | //print_r($line); |
926 | 926 | $data['hex'] = $line['address']; |
927 | - $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
927 | + $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); |
|
928 | 928 | //$data['datetime'] = date('Y-m-d H:i:s'); |
929 | 929 | $data['ident'] = $line['ident']; |
930 | 930 | $data['latitude'] = $line['latitude']; |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | $currentdate = date('Y-m-d H:i:s'); |
945 | 945 | $aprsdate = strtotime($data['datetime']); |
946 | 946 | // Accept data if time <= system time + 20s |
947 | - if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data); |
|
947 | + if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate) + 20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data); |
|
948 | 948 | else { |
949 | 949 | if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
950 | 950 | else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | connect_all($sourceee); |
1030 | 1030 | $sourceee = array(); |
1031 | 1031 | //connect_all($globalSources); |
1032 | - $tt[$format]=0; |
|
1032 | + $tt[$format] = 0; |
|
1033 | 1033 | break; |
1034 | 1034 | } |
1035 | 1035 | } |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | } |
1038 | 1038 | } else { |
1039 | 1039 | $error = socket_strerror(socket_last_error()); |
1040 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
1040 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; |
|
1041 | 1041 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || time() - $time >= $timeout) { |
1042 | 1042 | if (isset($globalDebug)) echo "Restarting...\n"; |
1043 | 1043 | // Restart the script if possible |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | if ($globalDebug) echo "Shutdown all sockets..."; |
1046 | 1046 | |
1047 | 1047 | foreach ($sockets as $sock) { |
1048 | - @socket_shutdown($sock,2); |
|
1048 | + @socket_shutdown($sock, 2); |
|
1049 | 1049 | @socket_close($sock); |
1050 | 1050 | } |
1051 | 1051 |
@@ -15,25 +15,25 @@ discard block |
||
15 | 15 | try { |
16 | 16 | $sth = $this->db->prepare($query); |
17 | 17 | $sth->execute($query_values); |
18 | - } catch(PDOException $e) { |
|
18 | + } catch (PDOException $e) { |
|
19 | 19 | return "error : ".$e->getMessage(); |
20 | 20 | } |
21 | 21 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
22 | 22 | return $all; |
23 | 23 | } |
24 | 24 | |
25 | - public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') { |
|
26 | - $info = preg_replace('/[^(\x20-\x7F)]*/','',$info); |
|
27 | - $info = str_replace('^','<br />',$info); |
|
28 | - $info = str_replace('&sect;','',$info); |
|
29 | - $info = str_replace('"','',$info); |
|
25 | + public function add($ident, $frequency, $latitude, $longitude, $range, $info, $date, $type = '', $ivao_id = '', $ivao_name = '', $format_source = '', $source_name = '') { |
|
26 | + $info = preg_replace('/[^(\x20-\x7F)]*/', '', $info); |
|
27 | + $info = str_replace('^', '<br />', $info); |
|
28 | + $info = str_replace('&sect;', '', $info); |
|
29 | + $info = str_replace('"', '', $info); |
|
30 | 30 | if ($type == '') $type = NULL; |
31 | 31 | $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)"; |
32 | - $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name); |
|
32 | + $query_values = array(':ident' => $ident, ':frequency' => $frequency, ':latitude' => $latitude, ':longitude' => $longitude, ':range' => $range, ':info' => $info, ':date' => $date, ':ivao_id' => $ivao_id, ':ivao_name' => $ivao_name, ':type' => $type, ':format_source' => $format_source, ':source_name' => $source_name); |
|
33 | 33 | try { |
34 | 34 | $sth = $this->db->prepare($query); |
35 | 35 | $sth->execute($query_values); |
36 | - } catch(PDOException $e) { |
|
36 | + } catch (PDOException $e) { |
|
37 | 37 | return "error : ".$e->getMessage(); |
38 | 38 | } |
39 | 39 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | try { |
45 | 45 | $sth = $this->db->prepare($query); |
46 | 46 | $sth->execute($query_values); |
47 | - } catch(PDOException $e) { |
|
47 | + } catch (PDOException $e) { |
|
48 | 48 | return "error : ".$e->getMessage(); |
49 | 49 | } |
50 | 50 | } |
@@ -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 | } |
@@ -70,7 +70,7 @@ 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"; |
75 | 75 | } |
76 | 76 | return "success"; |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | try { |
15 | 15 | $sth = $Connection->db->prepare($query); |
16 | 16 | $sth->execute(); |
17 | - } catch(PDOException $e) { |
|
17 | + } catch (PDOException $e) { |
|
18 | 18 | return "error : ".$e->getMessage()."\n"; |
19 | 19 | } |
20 | 20 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
21 | - $Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']); |
|
21 | + $Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | try { |
51 | 51 | $sth = $Connection->db->prepare($query); |
52 | 52 | $sth->execute(); |
53 | - } catch(PDOException $e) { |
|
53 | + } catch (PDOException $e) { |
|
54 | 54 | return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
55 | 55 | } |
56 | 56 | // Copy schedules data to routes table |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | try { |
61 | 61 | $sth = $Connection->db->prepare($query); |
62 | 62 | $sth->execute(); |
63 | - } catch(PDOException $e) { |
|
63 | + } catch (PDOException $e) { |
|
64 | 64 | return "error (delete schedule table) : ".$e->getMessage()."\n"; |
65 | 65 | } |
66 | 66 | // Add source column |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | try { |
69 | 69 | $sth = $Connection->db->prepare($query); |
70 | 70 | $sth->execute(); |
71 | - } catch(PDOException $e) { |
|
71 | + } catch (PDOException $e) { |
|
72 | 72 | return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n"; |
73 | 73 | } |
74 | 74 | // Delete unused column |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | try { |
77 | 77 | $sth = $Connection->db->prepare($query); |
78 | 78 | $sth->execute(); |
79 | - } catch(PDOException $e) { |
|
79 | + } catch (PDOException $e) { |
|
80 | 80 | return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n"; |
81 | 81 | } |
82 | 82 | // Add ModeS column |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | try { |
85 | 85 | $sth = $Connection->db->prepare($query); |
86 | 86 | $sth->execute(); |
87 | - } catch(PDOException $e) { |
|
87 | + } catch (PDOException $e) { |
|
88 | 88 | return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n"; |
89 | 89 | } |
90 | 90 | $query = "ALTER TABLE `spotter_live` ADD `ModeS` VARCHAR(255)"; |
91 | 91 | try { |
92 | 92 | $sth = $Connection->db->prepare($query); |
93 | 93 | $sth->execute(); |
94 | - } catch(PDOException $e) { |
|
94 | + } catch (PDOException $e) { |
|
95 | 95 | return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n"; |
96 | 96 | } |
97 | 97 | // Add auto_increment for aircraft_modes |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | try { |
100 | 100 | $sth = $Connection->db->prepare($query); |
101 | 101 | $sth->execute(); |
102 | - } catch(PDOException $e) { |
|
102 | + } catch (PDOException $e) { |
|
103 | 103 | return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n"; |
104 | 104 | } |
105 | 105 | $error = ''; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | try { |
111 | 111 | $sth = $Connection->db->prepare($query); |
112 | 112 | $sth->execute(); |
113 | - } catch(PDOException $e) { |
|
113 | + } catch (PDOException $e) { |
|
114 | 114 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
115 | 115 | } |
116 | 116 | return $error; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | try { |
124 | 124 | $sth = $Connection->db->prepare($query); |
125 | 125 | $sth->execute(); |
126 | - } catch(PDOException $e) { |
|
126 | + } catch (PDOException $e) { |
|
127 | 127 | return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
128 | 128 | } |
129 | 129 | $error = ''; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | try { |
135 | 135 | $sth = $Connection->db->prepare($query); |
136 | 136 | $sth->execute(); |
137 | - } catch(PDOException $e) { |
|
137 | + } catch (PDOException $e) { |
|
138 | 138 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
139 | 139 | } |
140 | 140 | return $error; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | try { |
148 | 148 | $sth = $Connection->db->prepare($query); |
149 | 149 | $sth->execute(); |
150 | - } catch(PDOException $e) { |
|
150 | + } catch (PDOException $e) { |
|
151 | 151 | return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n"; |
152 | 152 | } |
153 | 153 | // Add image_source_website column to spotter_image |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | try { |
156 | 156 | $sth = $Connection->db->prepare($query); |
157 | 157 | $sth->execute(); |
158 | - } catch(PDOException $e) { |
|
158 | + } catch (PDOException $e) { |
|
159 | 159 | return "error (add new columns to spotter_image) : ".$e->getMessage()."\n"; |
160 | 160 | } |
161 | 161 | $error = ''; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | try { |
165 | 165 | $sth = $Connection->db->prepare($query); |
166 | 166 | $sth->execute(); |
167 | - } catch(PDOException $e) { |
|
167 | + } catch (PDOException $e) { |
|
168 | 168 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
169 | 169 | } |
170 | 170 | return $error; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | try { |
183 | 183 | $sth = $Connection->db->prepare($query); |
184 | 184 | $sth->execute(); |
185 | - } catch(PDOException $e) { |
|
185 | + } catch (PDOException $e) { |
|
186 | 186 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
187 | 187 | } |
188 | 188 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | try { |
197 | 197 | $sth = $Connection->db->prepare($query); |
198 | 198 | $sth->execute(); |
199 | - } catch(PDOException $e) { |
|
199 | + } catch (PDOException $e) { |
|
200 | 200 | return "error (add new columns to translation) : ".$e->getMessage()."\n"; |
201 | 201 | } |
202 | 202 | // Add aircraft_shadow column to aircraft |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | try { |
205 | 205 | $sth = $Connection->db->prepare($query); |
206 | 206 | $sth->execute(); |
207 | - } catch(PDOException $e) { |
|
207 | + } catch (PDOException $e) { |
|
208 | 208 | return "error (add new column to aircraft) : ".$e->getMessage()."\n"; |
209 | 209 | } |
210 | 210 | // Add aircraft_shadow column to spotter_live |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | try { |
213 | 213 | $sth = $Connection->db->prepare($query); |
214 | 214 | $sth->execute(); |
215 | - } catch(PDOException $e) { |
|
215 | + } catch (PDOException $e) { |
|
216 | 216 | return "error (add new column to spotter_live) : ".$e->getMessage()."\n"; |
217 | 217 | } |
218 | 218 | $error = ''; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | try { |
226 | 226 | $sth = $Connection->db->prepare($query); |
227 | 227 | $sth->execute(); |
228 | - } catch(PDOException $e) { |
|
228 | + } catch (PDOException $e) { |
|
229 | 229 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
230 | 230 | } |
231 | 231 | return $error; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | private static function update_from_6() { |
235 | 235 | $Connection = new Connection(); |
236 | - if (!$Connection->indexExists('spotter_output','flightaware_id')) { |
|
236 | + if (!$Connection->indexExists('spotter_output', 'flightaware_id')) { |
|
237 | 237 | $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id); |
238 | 238 | ALTER TABLE spotter_output ADD INDEX(date); |
239 | 239 | ALTER TABLE spotter_output ADD INDEX(ident); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | try { |
251 | 251 | $sth = $Connection->db->prepare($query); |
252 | 252 | $sth->execute(); |
253 | - } catch(PDOException $e) { |
|
253 | + } catch (PDOException $e) { |
|
254 | 254 | return "error (add some indexes) : ".$e->getMessage()."\n"; |
255 | 255 | } |
256 | 256 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | try { |
266 | 266 | $sth = $Connection->db->prepare($query); |
267 | 267 | $sth->execute(); |
268 | - } catch(PDOException $e) { |
|
268 | + } catch (PDOException $e) { |
|
269 | 269 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
270 | 270 | } |
271 | 271 | return $error; |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | private static function update_from_7() { |
275 | 275 | global $globalDBname, $globalDBdriver; |
276 | 276 | $Connection = new Connection(); |
277 | - $query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
277 | + $query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
278 | 278 | ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;"; |
279 | 279 | try { |
280 | 280 | $sth = $Connection->db->prepare($query); |
281 | 281 | $sth->execute(); |
282 | - } catch(PDOException $e) { |
|
282 | + } catch (PDOException $e) { |
|
283 | 283 | return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
284 | 284 | } |
285 | 285 | if ($globalDBdriver == 'mysql') { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | try { |
288 | 288 | $sth = $Connection->db->prepare($query); |
289 | 289 | $sth->execute(); |
290 | - } catch(PDOException $e) { |
|
290 | + } catch (PDOException $e) { |
|
291 | 291 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
292 | 292 | } |
293 | 293 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -299,15 +299,15 @@ discard block |
||
299 | 299 | DROP TABLE spotter_archive; |
300 | 300 | RENAME TABLE copy TO spotter_archive;"; |
301 | 301 | } else { |
302 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
302 | + $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
303 | 303 | } |
304 | 304 | } else { |
305 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
305 | + $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
306 | 306 | } |
307 | 307 | try { |
308 | 308 | $sth = $Connection->db->prepare($query); |
309 | 309 | $sth->execute(); |
310 | - } catch(PDOException $e) { |
|
310 | + } catch (PDOException $e) { |
|
311 | 311 | return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n"; |
312 | 312 | } |
313 | 313 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | try { |
321 | 321 | $sth = $Connection->db->prepare($query); |
322 | 322 | $sth->execute(); |
323 | - } catch(PDOException $e) { |
|
323 | + } catch (PDOException $e) { |
|
324 | 324 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
325 | 325 | } |
326 | 326 | return $error; |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | try { |
340 | 340 | $sth = $Connection->db->prepare($query); |
341 | 341 | $sth->execute(); |
342 | - } catch(PDOException $e) { |
|
342 | + } catch (PDOException $e) { |
|
343 | 343 | return "error (insert last_update values) : ".$e->getMessage()."\n"; |
344 | 344 | } |
345 | 345 | $query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'"; |
346 | 346 | try { |
347 | 347 | $sth = $Connection->db->prepare($query); |
348 | 348 | $sth->execute(); |
349 | - } catch(PDOException $e) { |
|
349 | + } catch (PDOException $e) { |
|
350 | 350 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
351 | 351 | } |
352 | 352 | return $error; |
@@ -354,12 +354,12 @@ discard block |
||
354 | 354 | |
355 | 355 | private static function update_from_9() { |
356 | 356 | $Connection = new Connection(); |
357 | - $query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
357 | + $query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
358 | 358 | ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;"; |
359 | 359 | try { |
360 | 360 | $sth = $Connection->db->prepare($query); |
361 | 361 | $sth->execute(); |
362 | - } catch(PDOException $e) { |
|
362 | + } catch (PDOException $e) { |
|
363 | 363 | return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
364 | 364 | } |
365 | 365 | $error = ''; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | try { |
372 | 372 | $sth = $Connection->db->prepare($query); |
373 | 373 | $sth->execute(); |
374 | - } catch(PDOException $e) { |
|
374 | + } catch (PDOException $e) { |
|
375 | 375 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
376 | 376 | } |
377 | 377 | return $error; |
@@ -379,11 +379,11 @@ discard block |
||
379 | 379 | |
380 | 380 | private static function update_from_10() { |
381 | 381 | $Connection = new Connection(); |
382 | - $query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
382 | + $query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
383 | 383 | try { |
384 | 384 | $sth = $Connection->db->prepare($query); |
385 | 385 | $sth->execute(); |
386 | - } catch(PDOException $e) { |
|
386 | + } catch (PDOException $e) { |
|
387 | 387 | return "error (add new enum to ATC table) : ".$e->getMessage()."\n"; |
388 | 388 | } |
389 | 389 | $error = ''; |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | try { |
402 | 402 | $sth = $Connection->db->prepare($query); |
403 | 403 | $sth->execute(); |
404 | - } catch(PDOException $e) { |
|
404 | + } catch (PDOException $e) { |
|
405 | 405 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
406 | 406 | } |
407 | 407 | return $error; |
@@ -410,18 +410,18 @@ discard block |
||
410 | 410 | private static function update_from_11() { |
411 | 411 | global $globalDBdriver, $globalDBname; |
412 | 412 | $Connection = new Connection(); |
413 | - $query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
413 | + $query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
414 | 414 | try { |
415 | 415 | $sth = $Connection->db->prepare($query); |
416 | 416 | $sth->execute(); |
417 | - } catch(PDOException $e) { |
|
417 | + } catch (PDOException $e) { |
|
418 | 418 | return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n"; |
419 | 419 | } |
420 | - $query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
420 | + $query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
421 | 421 | try { |
422 | 422 | $sth = $Connection->db->prepare($query); |
423 | 423 | $sth->execute(); |
424 | - } catch(PDOException $e) { |
|
424 | + } catch (PDOException $e) { |
|
425 | 425 | return "error (format_source column to spotter_live) : ".$e->getMessage()."\n"; |
426 | 426 | } |
427 | 427 | if ($globalDBdriver == 'mysql') { |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | try { |
430 | 430 | $sth = $Connection->db->prepare($query); |
431 | 431 | $sth->execute(); |
432 | - } catch(PDOException $e) { |
|
432 | + } catch (PDOException $e) { |
|
433 | 433 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
434 | 434 | } |
435 | 435 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -441,15 +441,15 @@ discard block |
||
441 | 441 | DROP TABLE spotter_archive; |
442 | 442 | RENAME TABLE copy TO spotter_archive;"; |
443 | 443 | } else { |
444 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
444 | + $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
445 | 445 | } |
446 | 446 | } else { |
447 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
447 | + $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
448 | 448 | } |
449 | 449 | try { |
450 | 450 | $sth = $Connection->db->prepare($query); |
451 | 451 | $sth->execute(); |
452 | - } catch(PDOException $e) { |
|
452 | + } catch (PDOException $e) { |
|
453 | 453 | return "error (add columns to spotter_archive) : ".$e->getMessage()."\n"; |
454 | 454 | } |
455 | 455 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | try { |
460 | 460 | $sth = $Connection->db->prepare($query); |
461 | 461 | $sth->execute(); |
462 | - } catch(PDOException $e) { |
|
462 | + } catch (PDOException $e) { |
|
463 | 463 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
464 | 464 | } |
465 | 465 | return $error; |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | try { |
488 | 488 | $sth = $Connection->db->prepare($query); |
489 | 489 | $sth->execute(); |
490 | - } catch(PDOException $e) { |
|
490 | + } catch (PDOException $e) { |
|
491 | 491 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
492 | 492 | } |
493 | 493 | return $error; |
@@ -495,12 +495,12 @@ discard block |
||
495 | 495 | |
496 | 496 | private static function update_from_13() { |
497 | 497 | $Connection = new Connection(); |
498 | - if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) { |
|
499 | - $query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
498 | + if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) { |
|
499 | + $query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
500 | 500 | try { |
501 | 501 | $sth = $Connection->db->prepare($query); |
502 | 502 | $sth->execute(); |
503 | - } catch(PDOException $e) { |
|
503 | + } catch (PDOException $e) { |
|
504 | 504 | return "error (update spotter_archive_output) : ".$e->getMessage()."\n"; |
505 | 505 | } |
506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | try { |
510 | 510 | $sth = $Connection->db->prepare($query); |
511 | 511 | $sth->execute(); |
512 | - } catch(PDOException $e) { |
|
512 | + } catch (PDOException $e) { |
|
513 | 513 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
514 | 514 | } |
515 | 515 | return $error; |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | try { |
528 | 528 | $sth = $Connection->db->prepare($query); |
529 | 529 | $sth->execute(); |
530 | - } catch(PDOException $e) { |
|
530 | + } catch (PDOException $e) { |
|
531 | 531 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
532 | 532 | } |
533 | 533 | return $error; |
@@ -538,11 +538,11 @@ discard block |
||
538 | 538 | $Connection = new Connection(); |
539 | 539 | $error = ''; |
540 | 540 | // Add tables |
541 | - $query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
541 | + $query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
542 | 542 | try { |
543 | 543 | $sth = $Connection->db->prepare($query); |
544 | 544 | $sth->execute(); |
545 | - } catch(PDOException $e) { |
|
545 | + } catch (PDOException $e) { |
|
546 | 546 | return "error (update stats) : ".$e->getMessage()."\n"; |
547 | 547 | } |
548 | 548 | if ($error != '') return $error; |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | try { |
551 | 551 | $sth = $Connection->db->prepare($query); |
552 | 552 | $sth->execute(); |
553 | - } catch(PDOException $e) { |
|
553 | + } catch (PDOException $e) { |
|
554 | 554 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
555 | 555 | } |
556 | 556 | return $error; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | try { |
572 | 572 | $sth = $Connection->db->prepare($query); |
573 | 573 | $sth->execute(); |
574 | - } catch(PDOException $e) { |
|
574 | + } catch (PDOException $e) { |
|
575 | 575 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
576 | 576 | } |
577 | 577 | return $error; |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | try { |
590 | 590 | $sth = $Connection->db->prepare($query); |
591 | 591 | $sth->execute(); |
592 | - } catch(PDOException $e) { |
|
592 | + } catch (PDOException $e) { |
|
593 | 593 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
594 | 594 | } |
595 | 595 | return $error; |
@@ -598,12 +598,12 @@ discard block |
||
598 | 598 | $Connection = new Connection(); |
599 | 599 | $error = ''; |
600 | 600 | // Modify stats_airport table |
601 | - if (!$Connection->checkColumnName('stats_airport','airport_name')) { |
|
601 | + if (!$Connection->checkColumnName('stats_airport', 'airport_name')) { |
|
602 | 602 | $query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)"; |
603 | 603 | try { |
604 | 604 | $sth = $Connection->db->prepare($query); |
605 | 605 | $sth->execute(); |
606 | - } catch(PDOException $e) { |
|
606 | + } catch (PDOException $e) { |
|
607 | 607 | return "error (update stats) : ".$e->getMessage()."\n"; |
608 | 608 | } |
609 | 609 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | try { |
613 | 613 | $sth = $Connection->db->prepare($query); |
614 | 614 | $sth->execute(); |
615 | - } catch(PDOException $e) { |
|
615 | + } catch (PDOException $e) { |
|
616 | 616 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
617 | 617 | } |
618 | 618 | return $error; |
@@ -629,73 +629,73 @@ discard block |
||
629 | 629 | try { |
630 | 630 | $sth = $Connection->db->prepare($query); |
631 | 631 | $sth->execute(); |
632 | - } catch(PDOException $e) { |
|
632 | + } catch (PDOException $e) { |
|
633 | 633 | return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n"; |
634 | 634 | } |
635 | 635 | $query = "alter table spotter_archive add spotter_archive_id INT(11)"; |
636 | 636 | try { |
637 | 637 | $sth = $Connection->db->prepare($query); |
638 | 638 | $sth->execute(); |
639 | - } catch(PDOException $e) { |
|
639 | + } catch (PDOException $e) { |
|
640 | 640 | return "error (add id again on spotter_archive) : ".$e->getMessage()."\n"; |
641 | 641 | } |
642 | - if (!$Connection->checkColumnName('spotter_archive','over_country')) { |
|
642 | + if (!$Connection->checkColumnName('spotter_archive', 'over_country')) { |
|
643 | 643 | // Add column over_country |
644 | 644 | $query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
645 | 645 | try { |
646 | 646 | $sth = $Connection->db->prepare($query); |
647 | 647 | $sth->execute(); |
648 | - } catch(PDOException $e) { |
|
648 | + } catch (PDOException $e) { |
|
649 | 649 | return "error (add over_country) : ".$e->getMessage()."\n"; |
650 | 650 | } |
651 | 651 | } |
652 | - if (!$Connection->checkColumnName('spotter_live','over_country')) { |
|
652 | + if (!$Connection->checkColumnName('spotter_live', 'over_country')) { |
|
653 | 653 | // Add column over_country |
654 | 654 | $query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
655 | 655 | try { |
656 | 656 | $sth = $Connection->db->prepare($query); |
657 | 657 | $sth->execute(); |
658 | - } catch(PDOException $e) { |
|
658 | + } catch (PDOException $e) { |
|
659 | 659 | return "error (add over_country) : ".$e->getMessage()."\n"; |
660 | 660 | } |
661 | 661 | } |
662 | - if (!$Connection->checkColumnName('spotter_output','source_name')) { |
|
662 | + if (!$Connection->checkColumnName('spotter_output', 'source_name')) { |
|
663 | 663 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
664 | 664 | $query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
665 | 665 | try { |
666 | 666 | $sth = $Connection->db->prepare($query); |
667 | 667 | $sth->execute(); |
668 | - } catch(PDOException $e) { |
|
668 | + } catch (PDOException $e) { |
|
669 | 669 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
670 | 670 | } |
671 | 671 | } |
672 | - if (!$Connection->checkColumnName('spotter_live','source_name')) { |
|
672 | + if (!$Connection->checkColumnName('spotter_live', 'source_name')) { |
|
673 | 673 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
674 | 674 | $query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
675 | 675 | try { |
676 | 676 | $sth = $Connection->db->prepare($query); |
677 | 677 | $sth->execute(); |
678 | - } catch(PDOException $e) { |
|
678 | + } catch (PDOException $e) { |
|
679 | 679 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
680 | 680 | } |
681 | 681 | } |
682 | - if (!$Connection->checkColumnName('spotter_archive_output','source_name')) { |
|
682 | + if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) { |
|
683 | 683 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
684 | 684 | $query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
685 | 685 | try { |
686 | 686 | $sth = $Connection->db->prepare($query); |
687 | 687 | $sth->execute(); |
688 | - } catch(PDOException $e) { |
|
688 | + } catch (PDOException $e) { |
|
689 | 689 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
690 | 690 | } |
691 | 691 | } |
692 | - if (!$Connection->checkColumnName('spotter_archive','source_name')) { |
|
692 | + if (!$Connection->checkColumnName('spotter_archive', 'source_name')) { |
|
693 | 693 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
694 | 694 | $query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;"; |
695 | 695 | try { |
696 | 696 | $sth = $Connection->db->prepare($query); |
697 | 697 | $sth->execute(); |
698 | - } catch(PDOException $e) { |
|
698 | + } catch (PDOException $e) { |
|
699 | 699 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
700 | 700 | } |
701 | 701 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | try { |
705 | 705 | $sth = $Connection->db->prepare($query); |
706 | 706 | $sth->execute(); |
707 | - } catch(PDOException $e) { |
|
707 | + } catch (PDOException $e) { |
|
708 | 708 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
709 | 709 | } |
710 | 710 | return $error; |
@@ -719,13 +719,13 @@ discard block |
||
719 | 719 | $error .= create_db::import_file('../db/airlines.sql'); |
720 | 720 | if ($error != '') return 'Import airlines.sql : '.$error; |
721 | 721 | } |
722 | - if (!$Connection->checkColumnName('aircraft_modes','type_flight')) { |
|
722 | + if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) { |
|
723 | 723 | // Add column over_country |
724 | 724 | $query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;"; |
725 | 725 | try { |
726 | 726 | $sth = $Connection->db->prepare($query); |
727 | 727 | $sth->execute(); |
728 | - } catch(PDOException $e) { |
|
728 | + } catch (PDOException $e) { |
|
729 | 729 | return "error (add over_country) : ".$e->getMessage()."\n"; |
730 | 730 | } |
731 | 731 | } |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | try { |
742 | 742 | $sth = $Connection->db->prepare($query); |
743 | 743 | $sth->execute(); |
744 | - } catch(PDOException $e) { |
|
744 | + } catch (PDOException $e) { |
|
745 | 745 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
746 | 746 | } |
747 | 747 | return $error; |
@@ -750,13 +750,13 @@ discard block |
||
750 | 750 | private static function update_from_21() { |
751 | 751 | $Connection = new Connection(); |
752 | 752 | $error = ''; |
753 | - if (!$Connection->checkColumnName('stats_airport','stats_type')) { |
|
753 | + if (!$Connection->checkColumnName('stats_airport', 'stats_type')) { |
|
754 | 754 | // Rename type to stats_type |
755 | 755 | $query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);"; |
756 | 756 | try { |
757 | 757 | $sth = $Connection->db->prepare($query); |
758 | 758 | $sth->execute(); |
759 | - } catch(PDOException $e) { |
|
759 | + } catch (PDOException $e) { |
|
760 | 760 | return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n"; |
761 | 761 | } |
762 | 762 | if ($error != '') return $error; |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | try { |
766 | 766 | $sth = $Connection->db->prepare($query); |
767 | 767 | $sth->execute(); |
768 | - } catch(PDOException $e) { |
|
768 | + } catch (PDOException $e) { |
|
769 | 769 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
770 | 770 | } |
771 | 771 | return $error; |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | try { |
789 | 789 | $sth = $Connection->db->prepare($query); |
790 | 790 | $sth->execute(); |
791 | - } catch(PDOException $e) { |
|
791 | + } catch (PDOException $e) { |
|
792 | 792 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
793 | 793 | } |
794 | 794 | return $error; |
@@ -815,17 +815,17 @@ discard block |
||
815 | 815 | try { |
816 | 816 | $sth = $Connection->db->prepare($query); |
817 | 817 | $sth->execute(); |
818 | - } catch(PDOException $e) { |
|
818 | + } catch (PDOException $e) { |
|
819 | 819 | return "error (create index on spotter_archive) : ".$e->getMessage()."\n"; |
820 | 820 | } |
821 | 821 | } |
822 | - if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) { |
|
822 | + if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) { |
|
823 | 823 | // Add aircraft_manufacturer to stats_aircraft |
824 | 824 | $query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL"; |
825 | 825 | try { |
826 | 826 | $sth = $Connection->db->prepare($query); |
827 | 827 | $sth->execute(); |
828 | - } catch(PDOException $e) { |
|
828 | + } catch (PDOException $e) { |
|
829 | 829 | return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n"; |
830 | 830 | } |
831 | 831 | } |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | try { |
835 | 835 | $sth = $Connection->db->prepare($query); |
836 | 836 | $sth->execute(); |
837 | - } catch(PDOException $e) { |
|
837 | + } catch (PDOException $e) { |
|
838 | 838 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
839 | 839 | } |
840 | 840 | return $error; |
@@ -850,23 +850,23 @@ discard block |
||
850 | 850 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
851 | 851 | } |
852 | 852 | if ($error != '') return 'Import airlines.sql : '.$error; |
853 | - if (!$Connection->checkColumnName('airlines','forsource')) { |
|
853 | + if (!$Connection->checkColumnName('airlines', 'forsource')) { |
|
854 | 854 | // Add forsource to airlines |
855 | 855 | $query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL"; |
856 | 856 | try { |
857 | 857 | $sth = $Connection->db->prepare($query); |
858 | 858 | $sth->execute(); |
859 | - } catch(PDOException $e) { |
|
859 | + } catch (PDOException $e) { |
|
860 | 860 | return "error (add forsource column) : ".$e->getMessage()."\n"; |
861 | 861 | } |
862 | 862 | } |
863 | - if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) { |
|
863 | + if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) { |
|
864 | 864 | // Add forsource to airlines |
865 | 865 | $query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
866 | 866 | try { |
867 | 867 | $sth = $Connection->db->prepare($query); |
868 | 868 | $sth->execute(); |
869 | - } catch(PDOException $e) { |
|
869 | + } catch (PDOException $e) { |
|
870 | 870 | return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n"; |
871 | 871 | } |
872 | 872 | // Add unique key |
@@ -878,17 +878,17 @@ discard block |
||
878 | 878 | try { |
879 | 879 | $sth = $Connection->db->prepare($query); |
880 | 880 | $sth->execute(); |
881 | - } catch(PDOException $e) { |
|
881 | + } catch (PDOException $e) { |
|
882 | 882 | return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n"; |
883 | 883 | } |
884 | 884 | } |
885 | - if (!$Connection->checkColumnName('stats_airport','stats_airline')) { |
|
885 | + if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) { |
|
886 | 886 | // Add forsource to airlines |
887 | 887 | $query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
888 | 888 | try { |
889 | 889 | $sth = $Connection->db->prepare($query); |
890 | 890 | $sth->execute(); |
891 | - } catch(PDOException $e) { |
|
891 | + } catch (PDOException $e) { |
|
892 | 892 | return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n"; |
893 | 893 | } |
894 | 894 | // Add unique key |
@@ -900,17 +900,17 @@ discard block |
||
900 | 900 | try { |
901 | 901 | $sth = $Connection->db->prepare($query); |
902 | 902 | $sth->execute(); |
903 | - } catch(PDOException $e) { |
|
903 | + } catch (PDOException $e) { |
|
904 | 904 | return "error (add unique key in stats_airport) : ".$e->getMessage()."\n"; |
905 | 905 | } |
906 | 906 | } |
907 | - if (!$Connection->checkColumnName('stats_country','stats_airline')) { |
|
907 | + if (!$Connection->checkColumnName('stats_country', 'stats_airline')) { |
|
908 | 908 | // Add forsource to airlines |
909 | 909 | $query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
910 | 910 | try { |
911 | 911 | $sth = $Connection->db->prepare($query); |
912 | 912 | $sth->execute(); |
913 | - } catch(PDOException $e) { |
|
913 | + } catch (PDOException $e) { |
|
914 | 914 | return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n"; |
915 | 915 | } |
916 | 916 | // Add unique key |
@@ -922,36 +922,36 @@ discard block |
||
922 | 922 | try { |
923 | 923 | $sth = $Connection->db->prepare($query); |
924 | 924 | $sth->execute(); |
925 | - } catch(PDOException $e) { |
|
925 | + } catch (PDOException $e) { |
|
926 | 926 | return "error (add unique key in stats_airline) : ".$e->getMessage()."\n"; |
927 | 927 | } |
928 | 928 | } |
929 | - if (!$Connection->checkColumnName('stats_flight','stats_airline')) { |
|
929 | + if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) { |
|
930 | 930 | // Add forsource to airlines |
931 | 931 | $query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
932 | 932 | try { |
933 | 933 | $sth = $Connection->db->prepare($query); |
934 | 934 | $sth->execute(); |
935 | - } catch(PDOException $e) { |
|
935 | + } catch (PDOException $e) { |
|
936 | 936 | return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n"; |
937 | 937 | } |
938 | 938 | } |
939 | - if (!$Connection->checkColumnName('stats','stats_airline')) { |
|
939 | + if (!$Connection->checkColumnName('stats', 'stats_airline')) { |
|
940 | 940 | // Add forsource to airlines |
941 | 941 | $query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
942 | 942 | try { |
943 | 943 | $sth = $Connection->db->prepare($query); |
944 | 944 | $sth->execute(); |
945 | - } catch(PDOException $e) { |
|
945 | + } catch (PDOException $e) { |
|
946 | 946 | return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n"; |
947 | 947 | } |
948 | - if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) { |
|
948 | + if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) { |
|
949 | 949 | // Add unique key |
950 | 950 | $query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);"; |
951 | 951 | try { |
952 | 952 | $sth = $Connection->db->prepare($query); |
953 | 953 | $sth->execute(); |
954 | - } catch(PDOException $e) { |
|
954 | + } catch (PDOException $e) { |
|
955 | 955 | return "error (add unique key in stats) : ".$e->getMessage()."\n"; |
956 | 956 | } |
957 | 957 | } else { |
@@ -964,18 +964,18 @@ discard block |
||
964 | 964 | try { |
965 | 965 | $sth = $Connection->db->prepare($query); |
966 | 966 | $sth->execute(); |
967 | - } catch(PDOException $e) { |
|
967 | + } catch (PDOException $e) { |
|
968 | 968 | return "error (add unique key in stats) : ".$e->getMessage()."\n"; |
969 | 969 | } |
970 | 970 | } |
971 | 971 | } |
972 | - if (!$Connection->checkColumnName('stats_registration','stats_airline')) { |
|
972 | + if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) { |
|
973 | 973 | // Add forsource to airlines |
974 | 974 | $query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
975 | 975 | try { |
976 | 976 | $sth = $Connection->db->prepare($query); |
977 | 977 | $sth->execute(); |
978 | - } catch(PDOException $e) { |
|
978 | + } catch (PDOException $e) { |
|
979 | 979 | return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n"; |
980 | 980 | } |
981 | 981 | // Add unique key |
@@ -987,17 +987,17 @@ discard block |
||
987 | 987 | try { |
988 | 988 | $sth = $Connection->db->prepare($query); |
989 | 989 | $sth->execute(); |
990 | - } catch(PDOException $e) { |
|
990 | + } catch (PDOException $e) { |
|
991 | 991 | return "error (add unique key in stats_registration) : ".$e->getMessage()."\n"; |
992 | 992 | } |
993 | 993 | } |
994 | - if (!$Connection->checkColumnName('stats_callsign','filter_name')) { |
|
994 | + if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) { |
|
995 | 995 | // Add forsource to airlines |
996 | 996 | $query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
997 | 997 | try { |
998 | 998 | $sth = $Connection->db->prepare($query); |
999 | 999 | $sth->execute(); |
1000 | - } catch(PDOException $e) { |
|
1000 | + } catch (PDOException $e) { |
|
1001 | 1001 | return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n"; |
1002 | 1002 | } |
1003 | 1003 | // Add unique key |
@@ -1009,17 +1009,17 @@ discard block |
||
1009 | 1009 | try { |
1010 | 1010 | $sth = $Connection->db->prepare($query); |
1011 | 1011 | $sth->execute(); |
1012 | - } catch(PDOException $e) { |
|
1012 | + } catch (PDOException $e) { |
|
1013 | 1013 | return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n"; |
1014 | 1014 | } |
1015 | 1015 | } |
1016 | - if (!$Connection->checkColumnName('stats_airline','filter_name')) { |
|
1016 | + if (!$Connection->checkColumnName('stats_airline', 'filter_name')) { |
|
1017 | 1017 | // Add forsource to airlines |
1018 | 1018 | $query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
1019 | 1019 | try { |
1020 | 1020 | $sth = $Connection->db->prepare($query); |
1021 | 1021 | $sth->execute(); |
1022 | - } catch(PDOException $e) { |
|
1022 | + } catch (PDOException $e) { |
|
1023 | 1023 | return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n"; |
1024 | 1024 | } |
1025 | 1025 | // Add unique key |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | try { |
1032 | 1032 | $sth = $Connection->db->prepare($query); |
1033 | 1033 | $sth->execute(); |
1034 | - } catch(PDOException $e) { |
|
1034 | + } catch (PDOException $e) { |
|
1035 | 1035 | return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n"; |
1036 | 1036 | } |
1037 | 1037 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | try { |
1041 | 1041 | $sth = $Connection->db->prepare($query); |
1042 | 1042 | $sth->execute(); |
1043 | - } catch(PDOException $e) { |
|
1043 | + } catch (PDOException $e) { |
|
1044 | 1044 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1045 | 1045 | } |
1046 | 1046 | return $error; |
@@ -1050,13 +1050,13 @@ discard block |
||
1050 | 1050 | global $globalDBdriver; |
1051 | 1051 | $Connection = new Connection(); |
1052 | 1052 | $error = ''; |
1053 | - if (!$Connection->checkColumnName('stats_owner','stats_airline')) { |
|
1053 | + if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) { |
|
1054 | 1054 | // Add forsource to airlines |
1055 | 1055 | $query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
1056 | 1056 | try { |
1057 | 1057 | $sth = $Connection->db->prepare($query); |
1058 | 1058 | $sth->execute(); |
1059 | - } catch(PDOException $e) { |
|
1059 | + } catch (PDOException $e) { |
|
1060 | 1060 | return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n"; |
1061 | 1061 | } |
1062 | 1062 | // Add unique key |
@@ -1068,17 +1068,17 @@ discard block |
||
1068 | 1068 | try { |
1069 | 1069 | $sth = $Connection->db->prepare($query); |
1070 | 1070 | $sth->execute(); |
1071 | - } catch(PDOException $e) { |
|
1071 | + } catch (PDOException $e) { |
|
1072 | 1072 | return "error (add unique key in stats_owner) : ".$e->getMessage()."\n"; |
1073 | 1073 | } |
1074 | 1074 | } |
1075 | - if (!$Connection->checkColumnName('stats_pilot','stats_airline')) { |
|
1075 | + if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) { |
|
1076 | 1076 | // Add forsource to airlines |
1077 | 1077 | $query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
1078 | 1078 | try { |
1079 | 1079 | $sth = $Connection->db->prepare($query); |
1080 | 1080 | $sth->execute(); |
1081 | - } catch(PDOException $e) { |
|
1081 | + } catch (PDOException $e) { |
|
1082 | 1082 | return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n"; |
1083 | 1083 | } |
1084 | 1084 | // Add unique key |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | try { |
1091 | 1091 | $sth = $Connection->db->prepare($query); |
1092 | 1092 | $sth->execute(); |
1093 | - } catch(PDOException $e) { |
|
1093 | + } catch (PDOException $e) { |
|
1094 | 1094 | return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n"; |
1095 | 1095 | } |
1096 | 1096 | } |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | try { |
1099 | 1099 | $sth = $Connection->db->prepare($query); |
1100 | 1100 | $sth->execute(); |
1101 | - } catch(PDOException $e) { |
|
1101 | + } catch (PDOException $e) { |
|
1102 | 1102 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1103 | 1103 | } |
1104 | 1104 | return $error; |
@@ -1108,12 +1108,12 @@ discard block |
||
1108 | 1108 | global $globalDBdriver; |
1109 | 1109 | $Connection = new Connection(); |
1110 | 1110 | $error = ''; |
1111 | - if (!$Connection->checkColumnName('atc','format_source')) { |
|
1111 | + if (!$Connection->checkColumnName('atc', 'format_source')) { |
|
1112 | 1112 | $query = "ALTER TABLE atc ADD format_source VARCHAR(255) DEFAULT NULL, ADD source_name VARCHAR(255) DEFAULT NULL"; |
1113 | 1113 | try { |
1114 | 1114 | $sth = $Connection->db->prepare($query); |
1115 | 1115 | $sth->execute(); |
1116 | - } catch(PDOException $e) { |
|
1116 | + } catch (PDOException $e) { |
|
1117 | 1117 | return "error (add format_source & source_name column in atc) : ".$e->getMessage()."\n"; |
1118 | 1118 | } |
1119 | 1119 | } |
@@ -1121,7 +1121,7 @@ discard block |
||
1121 | 1121 | try { |
1122 | 1122 | $sth = $Connection->db->prepare($query); |
1123 | 1123 | $sth->execute(); |
1124 | - } catch(PDOException $e) { |
|
1124 | + } catch (PDOException $e) { |
|
1125 | 1125 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1126 | 1126 | } |
1127 | 1127 | return $error; |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | try { |
1145 | 1145 | $sth = $Connection->db->prepare($query); |
1146 | 1146 | $sth->execute(); |
1147 | - } catch(PDOException $e) { |
|
1147 | + } catch (PDOException $e) { |
|
1148 | 1148 | return "error : ".$e->getMessage()."\n"; |
1149 | 1149 | } |
1150 | 1150 | $result = $sth->fetch(PDO::FETCH_ASSOC); |