@@ -14,33 +14,33 @@ discard block |
||
14 | 14 | * @param Array $filter the filter |
15 | 15 | * @return Array the SQL part |
16 | 16 | */ |
17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
23 | 23 | } else { |
24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | if (isset($filter[0]['source'])) { |
28 | - $filters = array_merge($filters,$filter); |
|
28 | + $filters = array_merge($filters, $filter); |
|
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
31 | 31 | $filter_query_join = ''; |
32 | 32 | $filter_query_where = ''; |
33 | - foreach($filters as $flt) { |
|
33 | + foreach ($filters as $flt) { |
|
34 | 34 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
35 | 35 | if (isset($flt['source'])) { |
36 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
36 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
37 | 37 | } else { |
38 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
38 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | if (isset($filter['source']) && !empty($filter['source'])) { |
43 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
43 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
44 | 44 | } |
45 | 45 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
46 | 46 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -68,38 +68,38 @@ discard block |
||
68 | 68 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_archive_output.date) = '".$filter['day']."'"; |
69 | 69 | } |
70 | 70 | } |
71 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
71 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
72 | 72 | } |
73 | 73 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
74 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
74 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
75 | 75 | } |
76 | 76 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
77 | 77 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
78 | 78 | if ($filter_query_where != '') { |
79 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
79 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
80 | 80 | } |
81 | 81 | $filter_query = $filter_query_join.$filter_query_where; |
82 | 82 | return $filter_query; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // tracker_archive |
86 | - public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') { |
|
86 | + public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') { |
|
87 | 87 | require_once(dirname(__FILE__).'/class.Tracker.php'); |
88 | 88 | if ($over_country == '') { |
89 | 89 | $Tracker = new Tracker($this->db); |
90 | - $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
90 | + $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
91 | 91 | if (!empty($data_country)) $country = $data_country['iso2']; |
92 | 92 | else $country = ''; |
93 | 93 | } else $country = $over_country; |
94 | 94 | // Route is not added in tracker_archive |
95 | - $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
95 | + $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
96 | 96 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
97 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type); |
|
97 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type); |
|
98 | 98 | try { |
99 | 99 | $sth = $this->db->prepare($query); |
100 | 100 | $sth->execute($query_values); |
101 | 101 | $sth->closeCursor(); |
102 | - } catch(PDOException $e) { |
|
102 | + } catch (PDOException $e) { |
|
103 | 103 | return "error : ".$e->getMessage(); |
104 | 104 | } |
105 | 105 | return "success"; |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | |
120 | 120 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
121 | 121 | //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
122 | - $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
122 | + $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
123 | 123 | |
124 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
124 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident)); |
|
125 | 125 | |
126 | 126 | return $spotter_array; |
127 | 127 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
141 | 141 | //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
142 | 142 | //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
143 | - $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
143 | + $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
144 | 144 | |
145 | 145 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
146 | 146 | /* |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
155 | 155 | */ |
156 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
156 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id)); |
|
157 | 157 | |
158 | 158 | return $spotter_array; |
159 | 159 | } |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | { |
169 | 169 | date_default_timezone_set('UTC'); |
170 | 170 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
171 | - $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
171 | + $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
172 | 172 | |
173 | 173 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
174 | 174 | |
175 | 175 | try { |
176 | 176 | $sth = $this->db->prepare($query); |
177 | 177 | $sth->execute(array(':id' => $id)); |
178 | - } catch(PDOException $e) { |
|
178 | + } catch (PDOException $e) { |
|
179 | 179 | echo $e->getMessage(); |
180 | 180 | die; |
181 | 181 | } |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | { |
195 | 195 | date_default_timezone_set('UTC'); |
196 | 196 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
197 | - $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
197 | + $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
198 | 198 | |
199 | 199 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
200 | 200 | |
201 | 201 | try { |
202 | 202 | $sth = $this->db->prepare($query); |
203 | 203 | $sth->execute(array(':id' => $id)); |
204 | - } catch(PDOException $e) { |
|
204 | + } catch (PDOException $e) { |
|
205 | 205 | echo $e->getMessage(); |
206 | 206 | die; |
207 | 207 | } |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | date_default_timezone_set('UTC'); |
224 | 224 | |
225 | 225 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
226 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
226 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
227 | 227 | |
228 | 228 | try { |
229 | 229 | $sth = $this->db->prepare($query); |
230 | 230 | $sth->execute(array(':ident' => $ident)); |
231 | - } catch(PDOException $e) { |
|
231 | + } catch (PDOException $e) { |
|
232 | 232 | echo $e->getMessage(); |
233 | 233 | die; |
234 | 234 | } |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | date_default_timezone_set('UTC'); |
250 | 250 | |
251 | 251 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
252 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
252 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
253 | 253 | |
254 | 254 | try { |
255 | 255 | $sth = $this->db->prepare($query); |
256 | 256 | $sth->execute(array(':id' => $id)); |
257 | - } catch(PDOException $e) { |
|
257 | + } catch (PDOException $e) { |
|
258 | 258 | echo $e->getMessage(); |
259 | 259 | die; |
260 | 260 | } |
@@ -275,12 +275,12 @@ discard block |
||
275 | 275 | date_default_timezone_set('UTC'); |
276 | 276 | |
277 | 277 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
278 | - $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
278 | + $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
279 | 279 | |
280 | 280 | try { |
281 | 281 | $sth = $this->db->prepare($query); |
282 | 282 | $sth->execute(array(':id' => $id)); |
283 | - } catch(PDOException $e) { |
|
283 | + } catch (PDOException $e) { |
|
284 | 284 | echo $e->getMessage(); |
285 | 285 | die; |
286 | 286 | } |
@@ -302,13 +302,13 @@ discard block |
||
302 | 302 | date_default_timezone_set('UTC'); |
303 | 303 | |
304 | 304 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
305 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
305 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
306 | 306 | // $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident"; |
307 | 307 | |
308 | 308 | try { |
309 | 309 | $sth = $this->db->prepare($query); |
310 | 310 | $sth->execute(array(':ident' => $ident)); |
311 | - } catch(PDOException $e) { |
|
311 | + } catch (PDOException $e) { |
|
312 | 312 | echo $e->getMessage(); |
313 | 313 | die; |
314 | 314 | } |
@@ -325,13 +325,13 @@ discard block |
||
325 | 325 | * @return Array the spotter information |
326 | 326 | * |
327 | 327 | */ |
328 | - public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
328 | + public function getTrackerArchiveData($ident, $famtrackid, $date) |
|
329 | 329 | { |
330 | 330 | $Tracker = new Tracker($this->db); |
331 | 331 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
332 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
332 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
333 | 333 | |
334 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
334 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':famtrackid' => $famtrackid, ':date' => $date.'%')); |
|
335 | 335 | |
336 | 336 | return $spotter_array; |
337 | 337 | } |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | try { |
345 | 345 | $sth = $this->db->prepare($query); |
346 | 346 | $sth->execute(); |
347 | - } catch(PDOException $e) { |
|
347 | + } catch (PDOException $e) { |
|
348 | 348 | echo $e->getMessage(); |
349 | 349 | die; |
350 | 350 | } |
@@ -356,24 +356,24 @@ discard block |
||
356 | 356 | * @return Array the spotter information |
357 | 357 | * |
358 | 358 | */ |
359 | - public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
359 | + public function getMinLiveTrackerData($begindate, $enddate, $filter = array()) |
|
360 | 360 | { |
361 | 361 | global $globalDBdriver, $globalLiveInterval; |
362 | 362 | date_default_timezone_set('UTC'); |
363 | 363 | |
364 | 364 | $filter_query = ''; |
365 | 365 | if (isset($filter['source']) && !empty($filter['source'])) { |
366 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
366 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
367 | 367 | } |
368 | 368 | // Use spotter_output also ? |
369 | 369 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
370 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
370 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
371 | 371 | } |
372 | 372 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
373 | 373 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
374 | 374 | } |
375 | 375 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
376 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
376 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid |
393 | 393 | AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
394 | 394 | */ |
395 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
395 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
396 | 396 | FROM tracker_archive |
397 | 397 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
398 | 398 | WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
399 | 399 | '.$filter_query.' ORDER BY famtrackid'; |
400 | 400 | } else { |
401 | 401 | //$query = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao'; |
402 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
402 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
403 | 403 | FROM tracker_archive |
404 | 404 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
405 | 405 | WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".' |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | try { |
410 | 410 | $sth = $this->db->prepare($query); |
411 | 411 | $sth->execute(); |
412 | - } catch(PDOException $e) { |
|
412 | + } catch (PDOException $e) { |
|
413 | 413 | echo $e->getMessage(); |
414 | 414 | die; |
415 | 415 | } |
@@ -424,24 +424,24 @@ discard block |
||
424 | 424 | * @return Array the spotter information |
425 | 425 | * |
426 | 426 | */ |
427 | - public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
427 | + public function getMinLiveTrackerDataPlayback($begindate, $enddate, $filter = array()) |
|
428 | 428 | { |
429 | 429 | global $globalDBdriver, $globalLiveInterval; |
430 | 430 | date_default_timezone_set('UTC'); |
431 | 431 | |
432 | 432 | $filter_query = ''; |
433 | 433 | if (isset($filter['source']) && !empty($filter['source'])) { |
434 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
434 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
435 | 435 | } |
436 | 436 | // Should use spotter_output also ? |
437 | 437 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
438 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
438 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
439 | 439 | } |
440 | 440 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
441 | 441 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
442 | 442 | } |
443 | 443 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
444 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
444 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | FROM tracker_archive |
452 | 452 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
453 | 453 | */ |
454 | - $query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk |
|
454 | + $query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk |
|
455 | 455 | FROM tracker_archive_output |
456 | 456 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive_output.aircraft_icao = a.icao |
457 | 457 | WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
467 | 467 | '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow'; |
468 | 468 | */ |
469 | - $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
469 | + $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
470 | 470 | FROM tracker_archive_output |
471 | 471 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
472 | 472 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | try { |
479 | 479 | $sth = $this->db->prepare($query); |
480 | 480 | $sth->execute(); |
481 | - } catch(PDOException $e) { |
|
481 | + } catch (PDOException $e) { |
|
482 | 482 | echo $e->getMessage(); |
483 | 483 | die; |
484 | 484 | } |
@@ -493,23 +493,23 @@ discard block |
||
493 | 493 | * @return Array the spotter information |
494 | 494 | * |
495 | 495 | */ |
496 | - public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
496 | + public function getLiveTrackerCount($begindate, $enddate, $filter = array()) |
|
497 | 497 | { |
498 | 498 | global $globalDBdriver, $globalLiveInterval; |
499 | 499 | date_default_timezone_set('UTC'); |
500 | 500 | |
501 | 501 | $filter_query = ''; |
502 | 502 | if (isset($filter['source']) && !empty($filter['source'])) { |
503 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
503 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
504 | 504 | } |
505 | 505 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
506 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
506 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
507 | 507 | } |
508 | 508 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
509 | 509 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
510 | 510 | } |
511 | 511 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
512 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
512 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | try { |
525 | 525 | $sth = $this->db->prepare($query); |
526 | 526 | $sth->execute(); |
527 | - } catch(PDOException $e) { |
|
527 | + } catch (PDOException $e) { |
|
528 | 528 | echo $e->getMessage(); |
529 | 529 | die; |
530 | 530 | } |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | * @return Array the spotter information |
545 | 545 | * |
546 | 546 | */ |
547 | - public function searchTrackerData($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()) |
|
547 | + public function searchTrackerData($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()) |
|
548 | 548 | { |
549 | 549 | global $globalTimezone, $globalDBdriver; |
550 | 550 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | |
567 | 567 | $q_array = explode(" ", $q); |
568 | 568 | |
569 | - foreach ($q_array as $q_item){ |
|
569 | + foreach ($q_array as $q_item) { |
|
570 | 570 | $additional_query .= " AND ("; |
571 | 571 | $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
572 | 572 | $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | |
599 | 599 | if ($registration != "") |
600 | 600 | { |
601 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
601 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
602 | 602 | if (!is_string($registration)) |
603 | 603 | { |
604 | 604 | return false; |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | |
610 | 610 | if ($aircraft_icao != "") |
611 | 611 | { |
612 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
612 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
613 | 613 | if (!is_string($aircraft_icao)) |
614 | 614 | { |
615 | 615 | return false; |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | |
621 | 621 | if ($aircraft_manufacturer != "") |
622 | 622 | { |
623 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
623 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
624 | 624 | if (!is_string($aircraft_manufacturer)) |
625 | 625 | { |
626 | 626 | return false; |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | |
642 | 642 | if ($airline_icao != "") |
643 | 643 | { |
644 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
644 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
645 | 645 | if (!is_string($airline_icao)) |
646 | 646 | { |
647 | 647 | return false; |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | |
653 | 653 | if ($airline_country != "") |
654 | 654 | { |
655 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
655 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
656 | 656 | if (!is_string($airline_country)) |
657 | 657 | { |
658 | 658 | return false; |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | |
664 | 664 | if ($airline_type != "") |
665 | 665 | { |
666 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
666 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
667 | 667 | if (!is_string($airline_type)) |
668 | 668 | { |
669 | 669 | return false; |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | |
686 | 686 | if ($airport != "") |
687 | 687 | { |
688 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
688 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
689 | 689 | if (!is_string($airport)) |
690 | 690 | { |
691 | 691 | return false; |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | |
697 | 697 | if ($airport_country != "") |
698 | 698 | { |
699 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
699 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
700 | 700 | if (!is_string($airport_country)) |
701 | 701 | { |
702 | 702 | return false; |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | |
708 | 708 | if ($callsign != "") |
709 | 709 | { |
710 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
710 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
711 | 711 | if (!is_string($callsign)) |
712 | 712 | { |
713 | 713 | return false; |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | $translate = $Translation->ident2icao($callsign); |
716 | 716 | if ($translate != $callsign) { |
717 | 717 | $additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)"; |
718 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
718 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
719 | 719 | } else { |
720 | 720 | $additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')"; |
721 | 721 | } |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | |
725 | 725 | if ($owner != "") |
726 | 726 | { |
727 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
727 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
728 | 728 | if (!is_string($owner)) |
729 | 729 | { |
730 | 730 | return false; |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | |
736 | 736 | if ($pilot_name != "") |
737 | 737 | { |
738 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
738 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
739 | 739 | if (!is_string($pilot_name)) |
740 | 740 | { |
741 | 741 | return false; |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | |
747 | 747 | if ($pilot_id != "") |
748 | 748 | { |
749 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
749 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
750 | 750 | if (!is_string($pilot_id)) |
751 | 751 | { |
752 | 752 | return false; |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | |
758 | 758 | if ($departure_airport_route != "") |
759 | 759 | { |
760 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
760 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
761 | 761 | if (!is_string($departure_airport_route)) |
762 | 762 | { |
763 | 763 | return false; |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | |
769 | 769 | if ($arrival_airport_route != "") |
770 | 770 | { |
771 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
771 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
772 | 772 | if (!is_string($arrival_airport_route)) |
773 | 773 | { |
774 | 774 | return false; |
@@ -781,8 +781,8 @@ discard block |
||
781 | 781 | { |
782 | 782 | $altitude_array = explode(",", $altitude); |
783 | 783 | |
784 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
785 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
784 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
785 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
786 | 786 | |
787 | 787 | |
788 | 788 | if ($altitude_array[1] != "") |
@@ -800,8 +800,8 @@ discard block |
||
800 | 800 | { |
801 | 801 | $date_array = explode(",", $date_posted); |
802 | 802 | |
803 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
804 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
803 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
804 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
805 | 805 | |
806 | 806 | if ($globalTimezone != '') { |
807 | 807 | date_default_timezone_set($globalTimezone); |
@@ -833,8 +833,8 @@ discard block |
||
833 | 833 | { |
834 | 834 | $limit_array = explode(",", $limit); |
835 | 835 | |
836 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
837 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
836 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
837 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
838 | 838 | |
839 | 839 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
840 | 840 | { |
@@ -845,8 +845,8 @@ discard block |
||
845 | 845 | |
846 | 846 | |
847 | 847 | if ($origLat != "" && $origLon != "" && $dist != "") { |
848 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
849 | - $query="SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
848 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
849 | + $query = "SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
850 | 850 | FROM tracker_archive_output, tracker_archive WHERE spotter_output_archive.famtrackid = tracker_archive.famtrackid AND spotter_output.ident <> '' ".$additional_query."AND CAST(tracker_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(tracker_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
851 | 851 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
852 | 852 | } else { |
@@ -863,12 +863,12 @@ discard block |
||
863 | 863 | $additional_query .= " AND (tracker_archive_output.waypoints <> '')"; |
864 | 864 | } |
865 | 865 | |
866 | - $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
866 | + $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
867 | 867 | WHERE tracker_archive_output.ident <> '' |
868 | 868 | ".$additional_query." |
869 | 869 | ".$filter_query.$orderby_query; |
870 | 870 | } |
871 | - $spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query); |
|
871 | + $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
|
872 | 872 | |
873 | 873 | return $spotter_array; |
874 | 874 | } |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | try { |
886 | 886 | $sth = $this->db->prepare($query); |
887 | 887 | $sth->execute(); |
888 | - } catch(PDOException $e) { |
|
888 | + } catch (PDOException $e) { |
|
889 | 889 | return "error"; |
890 | 890 | } |
891 | 891 | } |
@@ -922,8 +922,8 @@ discard block |
||
922 | 922 | { |
923 | 923 | $limit_array = explode(",", $limit); |
924 | 924 | |
925 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
926 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
925 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
926 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
927 | 927 | |
928 | 928 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
929 | 929 | { |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | $query_values = array(); |
965 | 965 | $limit_query = ''; |
966 | 966 | $additional_query = ''; |
967 | - $filter_query = $this->getFilter($filter,true,true); |
|
967 | + $filter_query = $this->getFilter($filter, true, true); |
|
968 | 968 | |
969 | 969 | if ($owner != "") |
970 | 970 | { |
@@ -981,8 +981,8 @@ discard block |
||
981 | 981 | { |
982 | 982 | $limit_array = explode(",", $limit); |
983 | 983 | |
984 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
985 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
984 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
985 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
986 | 986 | |
987 | 987 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
988 | 988 | { |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | $query_values = array(); |
1023 | 1023 | $limit_query = ''; |
1024 | 1024 | $additional_query = ''; |
1025 | - $filter_query = $this->getFilter($filter,true,true); |
|
1025 | + $filter_query = $this->getFilter($filter, true, true); |
|
1026 | 1026 | |
1027 | 1027 | if ($pilot != "") |
1028 | 1028 | { |
@@ -1034,8 +1034,8 @@ discard block |
||
1034 | 1034 | { |
1035 | 1035 | $limit_array = explode(",", $limit); |
1036 | 1036 | |
1037 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1038 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1037 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1038 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1039 | 1039 | |
1040 | 1040 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1041 | 1041 | { |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | * @return Array the airline country list |
1066 | 1066 | * |
1067 | 1067 | */ |
1068 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1068 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1069 | 1069 | { |
1070 | 1070 | global $globalDBdriver; |
1071 | 1071 | /* |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | $flight_array = array(); |
1095 | 1095 | $temp_array = array(); |
1096 | 1096 | |
1097 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1097 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1098 | 1098 | { |
1099 | 1099 | $temp_array['flight_count'] = $row['nb']; |
1100 | 1100 | $temp_array['flight_country'] = $row['name']; |
@@ -1111,7 +1111,7 @@ discard block |
||
1111 | 1111 | * @return Array the airline country list |
1112 | 1112 | * |
1113 | 1113 | */ |
1114 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1114 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1115 | 1115 | { |
1116 | 1116 | global $globalDBdriver; |
1117 | 1117 | /* |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | $flight_array = array(); |
1141 | 1141 | $temp_array = array(); |
1142 | 1142 | |
1143 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1143 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1144 | 1144 | { |
1145 | 1145 | $temp_array['airline_icao'] = $row['airline_icao']; |
1146 | 1146 | $temp_array['flight_count'] = $row['nb']; |
@@ -1158,14 +1158,14 @@ discard block |
||
1158 | 1158 | * @return Array the spotter information |
1159 | 1159 | * |
1160 | 1160 | */ |
1161 | - public function getDateArchiveTrackerDataById($id,$date) |
|
1161 | + public function getDateArchiveTrackerDataById($id, $date) |
|
1162 | 1162 | { |
1163 | 1163 | $Tracker = new Tracker($this->db); |
1164 | 1164 | date_default_timezone_set('UTC'); |
1165 | 1165 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1166 | - $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1167 | - $date = date('c',$date); |
|
1168 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1166 | + $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1167 | + $date = date('c', $date); |
|
1168 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1169 | 1169 | return $spotter_array; |
1170 | 1170 | } |
1171 | 1171 | |
@@ -1175,14 +1175,14 @@ discard block |
||
1175 | 1175 | * @return Array the spotter information |
1176 | 1176 | * |
1177 | 1177 | */ |
1178 | - public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
1178 | + public function getDateArchiveTrackerDataByIdent($ident, $date) |
|
1179 | 1179 | { |
1180 | 1180 | $Tracker = new Tracker($this->db); |
1181 | 1181 | date_default_timezone_set('UTC'); |
1182 | 1182 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1183 | - $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1184 | - $date = date('c',$date); |
|
1185 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1183 | + $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
1184 | + $date = date('c', $date); |
|
1185 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1186 | 1186 | return $spotter_array; |
1187 | 1187 | } |
1188 | 1188 | |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | * @return Array the spotter information |
1193 | 1193 | * |
1194 | 1194 | */ |
1195 | - public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1195 | + public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1196 | 1196 | { |
1197 | 1197 | global $global_query; |
1198 | 1198 | $Tracker = new Tracker($this->db); |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | $query_values = array(); |
1201 | 1201 | $limit_query = ''; |
1202 | 1202 | $additional_query = ''; |
1203 | - $filter_query = $this->getFilter($filters,true,true); |
|
1203 | + $filter_query = $this->getFilter($filters, true, true); |
|
1204 | 1204 | |
1205 | 1205 | if ($airport != "") |
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 | { |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
5 | 5 | $global_query = "SELECT tracker_output.* FROM tracker_output"; |
6 | 6 | |
7 | -class Tracker{ |
|
7 | +class Tracker { |
|
8 | 8 | public $db; |
9 | 9 | |
10 | 10 | public function __construct($dbc = null) { |
@@ -19,33 +19,33 @@ discard block |
||
19 | 19 | * @return Array the SQL part |
20 | 20 | */ |
21 | 21 | |
22 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
22 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
23 | 23 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
24 | 24 | $filters = array(); |
25 | 25 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
26 | 26 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
27 | 27 | $filters = $globalStatsFilters[$globalFilterName]; |
28 | 28 | } else { |
29 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
29 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | if (isset($filter[0]['source'])) { |
33 | - $filters = array_merge($filters,$filter); |
|
33 | + $filters = array_merge($filters, $filter); |
|
34 | 34 | } |
35 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
35 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
36 | 36 | $filter_query_join = ''; |
37 | 37 | $filter_query_where = ''; |
38 | - foreach($filters as $flt) { |
|
38 | + foreach ($filters as $flt) { |
|
39 | 39 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
40 | 40 | if (isset($flt['source'])) { |
41 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
42 | 42 | } else { |
43 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
43 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
47 | 47 | if (isset($filter['source']) && !empty($filter['source'])) { |
48 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
48 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
49 | 49 | } |
50 | 50 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
51 | 51 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
75 | 75 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
76 | 76 | if ($filter_query_where != '') { |
77 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
77 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
78 | 78 | } |
79 | 79 | $filter_query = $filter_query_join.$filter_query_where; |
80 | 80 | return $filter_query; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return Array the spotter information |
90 | 90 | * |
91 | 91 | */ |
92 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
92 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
93 | 93 | { |
94 | 94 | date_default_timezone_set('UTC'); |
95 | 95 | if (!is_string($query)) |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | $sth = $this->db->prepare($query.$limitQuery); |
110 | 110 | $sth->execute($params); |
111 | 111 | } catch (PDOException $e) { |
112 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
112 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
113 | 113 | exit(); |
114 | 114 | } |
115 | 115 | |
116 | 116 | $num_rows = 0; |
117 | 117 | $spotter_array = array(); |
118 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
118 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
119 | 119 | { |
120 | 120 | $num_rows++; |
121 | 121 | $temp_array = array(); |
@@ -171,17 +171,17 @@ discard block |
||
171 | 171 | { |
172 | 172 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
173 | 173 | } else { |
174 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
174 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
175 | 175 | } |
176 | 176 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
177 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
178 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
177 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
178 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
179 | 179 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
180 | 180 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
181 | 181 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
182 | 182 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
183 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
184 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
183 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
184 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
185 | 185 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
186 | 186 | } |
187 | 187 | } |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | { |
219 | 219 | $limit_array = explode(",", $limit); |
220 | 220 | |
221 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
222 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
221 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
222 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
223 | 223 | |
224 | 224 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
225 | 225 | { |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | $orderby_query = " ORDER BY tracker_output.date DESC"; |
237 | 237 | } |
238 | 238 | |
239 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
239 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
240 | 240 | |
241 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
241 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
242 | 242 | |
243 | 243 | return $spotter_array; |
244 | 244 | } |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | if ($id == '') return array(); |
258 | 258 | $additional_query = "tracker_output.famtrackid = :id"; |
259 | 259 | $query_values = array(':id' => $id); |
260 | - $query = $global_query." WHERE ".$additional_query." "; |
|
261 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
260 | + $query = $global_query." WHERE ".$additional_query." "; |
|
261 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
262 | 262 | return $spotter_array; |
263 | 263 | } |
264 | 264 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $query_values = array(); |
278 | 278 | $limit_query = ''; |
279 | 279 | $additional_query = ''; |
280 | - $filter_query = $this->getFilter($filter,true,true); |
|
280 | + $filter_query = $this->getFilter($filter, true, true); |
|
281 | 281 | if ($ident != "") |
282 | 282 | { |
283 | 283 | if (!is_string($ident)) |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | { |
294 | 294 | $limit_array = explode(",", $limit); |
295 | 295 | |
296 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
297 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
296 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
297 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
298 | 298 | |
299 | 299 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
300 | 300 | { |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | return $spotter_array; |
319 | 319 | } |
320 | 320 | |
321 | - public function getTrackerDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
321 | + public function getTrackerDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
322 | 322 | { |
323 | 323 | global $global_query, $globalTimezone, $globalDBdriver; |
324 | 324 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $limit_query = ''; |
327 | 327 | $additional_query = ''; |
328 | 328 | |
329 | - $filter_query = $this->getFilter($filter,true,true); |
|
329 | + $filter_query = $this->getFilter($filter, true, true); |
|
330 | 330 | |
331 | 331 | if ($date != "") |
332 | 332 | { |
@@ -352,8 +352,8 @@ discard block |
||
352 | 352 | { |
353 | 353 | $limit_array = explode(",", $limit); |
354 | 354 | |
355 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
356 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
355 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
356 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
357 | 357 | |
358 | 358 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
359 | 359 | { |
@@ -384,11 +384,11 @@ discard block |
||
384 | 384 | * @return Array list of source name |
385 | 385 | * |
386 | 386 | */ |
387 | - public function getAllSourceName($type = '',$filters = array()) |
|
387 | + public function getAllSourceName($type = '', $filters = array()) |
|
388 | 388 | { |
389 | - $filter_query = $this->getFilter($filters,true,true); |
|
389 | + $filter_query = $this->getFilter($filters, true, true); |
|
390 | 390 | $query_values = array(); |
391 | - $query = "SELECT DISTINCT tracker_output.source_name |
|
391 | + $query = "SELECT DISTINCT tracker_output.source_name |
|
392 | 392 | FROM tracker_output".$filter_query." tracker_output.source_name <> ''"; |
393 | 393 | if ($type != '') { |
394 | 394 | $query_values = array(':type' => $type); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $source_array = array(); |
404 | 404 | $temp_array = array(); |
405 | 405 | |
406 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
406 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
407 | 407 | { |
408 | 408 | $temp_array['source_name'] = $row['source_name']; |
409 | 409 | $source_array[] = $temp_array; |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function getAllIdents($filters = array()) |
422 | 422 | { |
423 | - $filter_query = $this->getFilter($filters,true,true); |
|
424 | - $query = "SELECT DISTINCT tracker_output.ident |
|
423 | + $filter_query = $this->getFilter($filters, true, true); |
|
424 | + $query = "SELECT DISTINCT tracker_output.ident |
|
425 | 425 | FROM tracker_output".$filter_query." tracker_output.ident <> '' |
426 | 426 | ORDER BY tracker_output.date ASC LIMIT 700 OFFSET 0"; |
427 | 427 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | $ident_array = array(); |
432 | 432 | $temp_array = array(); |
433 | 433 | |
434 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
434 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
435 | 435 | { |
436 | 436 | $temp_array['ident'] = $row['ident']; |
437 | 437 | $ident_array[] = $temp_array; |
@@ -456,12 +456,12 @@ discard block |
||
456 | 456 | } else $offset = '+00:00'; |
457 | 457 | |
458 | 458 | if ($globalDBdriver == 'mysql') { |
459 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
459 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
460 | 460 | FROM tracker_output |
461 | 461 | WHERE tracker_output.date <> '' |
462 | 462 | ORDER BY tracker_output.date ASC LIMIT 0,200"; |
463 | 463 | } else { |
464 | - $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
464 | + $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
465 | 465 | FROM tracker_output |
466 | 466 | WHERE tracker_output.date <> '' |
467 | 467 | ORDER BY tracker_output.date ASC LIMIT 0,200"; |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $date_array = array(); |
474 | 474 | $temp_array = array(); |
475 | 475 | |
476 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
476 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
477 | 477 | { |
478 | 478 | $temp_array['date'] = $row['date']; |
479 | 479 | |
@@ -492,11 +492,11 @@ discard block |
||
492 | 492 | * @return String success or false |
493 | 493 | * |
494 | 494 | */ |
495 | - public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
|
495 | + public function updateIdentTrackerData($famtrackid = '', $ident = '', $fromsource = NULL) |
|
496 | 496 | { |
497 | 497 | |
498 | 498 | $query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid'; |
499 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
499 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident); |
|
500 | 500 | |
501 | 501 | try { |
502 | 502 | $sth = $this->db->prepare($query); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
521 | 521 | { |
522 | 522 | $query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid'; |
523 | - $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
523 | + $query_values = array(':famtrackid' => $famtrackid, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
524 | 524 | |
525 | 525 | try { |
526 | 526 | $sth = $this->db->prepare($query); |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | * @param String $verticalrate vertival rate of flight |
561 | 561 | * @return String success or false |
562 | 562 | */ |
563 | - public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
|
563 | + public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '', $format_source = '', $source_name = '') |
|
564 | 564 | { |
565 | 565 | global $globalURL; |
566 | 566 | |
@@ -628,21 +628,21 @@ discard block |
||
628 | 628 | } |
629 | 629 | |
630 | 630 | |
631 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
631 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
632 | 632 | { |
633 | 633 | $date = date("Y-m-d H:i:s", time()); |
634 | 634 | } |
635 | 635 | |
636 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
637 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
638 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
639 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
640 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
641 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
642 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
643 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
644 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
645 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
636 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
637 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
638 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
639 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
640 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
641 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
642 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
643 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
644 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
645 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
646 | 646 | |
647 | 647 | if ($latitude == '' && $longitude == '') { |
648 | 648 | $latitude = 0; |
@@ -650,10 +650,10 @@ discard block |
||
650 | 650 | } |
651 | 651 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
652 | 652 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
653 | - $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
653 | + $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
654 | 654 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
655 | 655 | |
656 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
656 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':comment' => $comment, ':type' => $type); |
|
657 | 657 | |
658 | 658 | try { |
659 | 659 | |
@@ -679,13 +679,13 @@ discard block |
||
679 | 679 | { |
680 | 680 | global $globalDBdriver, $globalTimezone; |
681 | 681 | if ($globalDBdriver == 'mysql') { |
682 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
682 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
683 | 683 | WHERE tracker_output.ident = :ident |
684 | 684 | AND tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
685 | 685 | AND tracker_output.date < UTC_TIMESTAMP()"; |
686 | 686 | $query_data = array(':ident' => $ident); |
687 | 687 | } else { |
688 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
688 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
689 | 689 | WHERE tracker_output.ident = :ident |
690 | 690 | AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
691 | 691 | AND tracker_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -694,8 +694,8 @@ discard block |
||
694 | 694 | |
695 | 695 | $sth = $this->db->prepare($query); |
696 | 696 | $sth->execute($query_data); |
697 | - $ident_result=''; |
|
698 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
697 | + $ident_result = ''; |
|
698 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
699 | 699 | { |
700 | 700 | $ident_result = $row['ident']; |
701 | 701 | } |
@@ -721,8 +721,8 @@ discard block |
||
721 | 721 | return false; |
722 | 722 | } else { |
723 | 723 | $q_array = explode(" ", $q); |
724 | - foreach ($q_array as $q_item){ |
|
725 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
724 | + foreach ($q_array as $q_item) { |
|
725 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
726 | 726 | $additional_query .= " AND ("; |
727 | 727 | $additional_query .= "(tracker_output.ident like '%".$q_item."%')"; |
728 | 728 | $additional_query .= ")"; |
@@ -730,11 +730,11 @@ discard block |
||
730 | 730 | } |
731 | 731 | } |
732 | 732 | if ($globalDBdriver == 'mysql') { |
733 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
733 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
734 | 734 | WHERE tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
735 | 735 | AND tracker_output.date < UTC_TIMESTAMP()"; |
736 | 736 | } else { |
737 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
737 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
738 | 738 | WHERE tracker_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
739 | 739 | AND tracker_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
740 | 740 | } |
@@ -753,16 +753,16 @@ discard block |
||
753 | 753 | * |
754 | 754 | */ |
755 | 755 | |
756 | - public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
756 | + public function countAllTrackerOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
757 | 757 | { |
758 | 758 | global $globalDBdriver, $globalArchive; |
759 | 759 | //$filter_query = $this->getFilter($filters,true,true); |
760 | - $Connection= new Connection($this->db); |
|
760 | + $Connection = new Connection($this->db); |
|
761 | 761 | if (!$Connection->tableExists('countries')) return array(); |
762 | 762 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
763 | 763 | require_once('class.TrackerLive.php'); |
764 | 764 | $TrackerLive = new TrackerLive($this->db); |
765 | - $filter_query = $TrackerLive->getFilter($filters,true,true); |
|
765 | + $filter_query = $TrackerLive->getFilter($filters, true, true); |
|
766 | 766 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
767 | 767 | if ($olderthanmonths > 0) { |
768 | 768 | if ($globalDBdriver == 'mysql') { |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | } else { |
783 | 783 | require_once('class.TrackerArchive.php'); |
784 | 784 | $TrackerArchive = new TrackerArchive($this->db); |
785 | - $filter_query = $TrackerArchive->getFilter($filters,true,true); |
|
785 | + $filter_query = $TrackerArchive->getFilter($filters, true, true); |
|
786 | 786 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
787 | 787 | if ($olderthanmonths > 0) { |
788 | 788 | if ($globalDBdriver == 'mysql') { |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | $flight_array = array(); |
811 | 811 | $temp_array = array(); |
812 | 812 | |
813 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
813 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
814 | 814 | { |
815 | 815 | $temp_array['flight_count'] = $row['nb']; |
816 | 816 | $temp_array['flight_country'] = $row['name']; |
@@ -827,11 +827,11 @@ discard block |
||
827 | 827 | * @return Array the callsign list |
828 | 828 | * |
829 | 829 | */ |
830 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
830 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
831 | 831 | { |
832 | 832 | global $globalDBdriver; |
833 | - $filter_query = $this->getFilter($filters,true,true); |
|
834 | - $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
833 | + $filter_query = $this->getFilter($filters, true, true); |
|
834 | + $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
835 | 835 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
836 | 836 | if ($olderthanmonths > 0) { |
837 | 837 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -845,28 +845,28 @@ discard block |
||
845 | 845 | if ($year != '') { |
846 | 846 | if ($globalDBdriver == 'mysql') { |
847 | 847 | $query .= " AND YEAR(tracker_output.date) = :year"; |
848 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
848 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
849 | 849 | } else { |
850 | 850 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
851 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
851 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
852 | 852 | } |
853 | 853 | } |
854 | 854 | if ($month != '') { |
855 | 855 | if ($globalDBdriver == 'mysql') { |
856 | 856 | $query .= " AND MONTH(tracker_output.date) = :month"; |
857 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
857 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
858 | 858 | } else { |
859 | 859 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
860 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
860 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
861 | 861 | } |
862 | 862 | } |
863 | 863 | if ($day != '') { |
864 | 864 | if ($globalDBdriver == 'mysql') { |
865 | 865 | $query .= " AND DAY(tracker_output.date) = :day"; |
866 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
866 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
867 | 867 | } else { |
868 | 868 | $query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day"; |
869 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
869 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
870 | 870 | } |
871 | 871 | } |
872 | 872 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | $callsign_array = array(); |
879 | 879 | $temp_array = array(); |
880 | 880 | |
881 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
881 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
882 | 882 | { |
883 | 883 | $temp_array['callsign_icao'] = $row['ident']; |
884 | 884 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | $date_array = array(); |
931 | 931 | $temp_array = array(); |
932 | 932 | |
933 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
933 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
934 | 934 | { |
935 | 935 | $temp_array['date_name'] = $row['date_name']; |
936 | 936 | $temp_array['date_count'] = $row['date_count']; |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | $datetime = new DateTime(); |
957 | 957 | $offset = $datetime->format('P'); |
958 | 958 | } else $offset = '+00:00'; |
959 | - $filter_query = $this->getFilter($filters,true,true); |
|
959 | + $filter_query = $this->getFilter($filters, true, true); |
|
960 | 960 | if ($globalDBdriver == 'mysql') { |
961 | 961 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
962 | 962 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | $date_array = array(); |
978 | 978 | $temp_array = array(); |
979 | 979 | |
980 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
980 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
981 | 981 | { |
982 | 982 | $temp_array['date_name'] = $row['date_name']; |
983 | 983 | $temp_array['date_count'] = $row['date_count']; |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | $datetime = new DateTime(); |
1003 | 1003 | $offset = $datetime->format('P'); |
1004 | 1004 | } else $offset = '+00:00'; |
1005 | - $filter_query = $this->getFilter($filters,true,true); |
|
1005 | + $filter_query = $this->getFilter($filters, true, true); |
|
1006 | 1006 | if ($globalDBdriver == 'mysql') { |
1007 | 1007 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1008 | 1008 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | $date_array = array(); |
1024 | 1024 | $temp_array = array(); |
1025 | 1025 | |
1026 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1026 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1027 | 1027 | { |
1028 | 1028 | $temp_array['date_name'] = $row['date_name']; |
1029 | 1029 | $temp_array['date_count'] = $row['date_count']; |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | $date_array = array(); |
1071 | 1071 | $temp_array = array(); |
1072 | 1072 | |
1073 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1073 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1074 | 1074 | { |
1075 | 1075 | $temp_array['month_name'] = $row['month_name']; |
1076 | 1076 | $temp_array['year_name'] = $row['year_name']; |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | $datetime = new DateTime(); |
1100 | 1100 | $offset = $datetime->format('P'); |
1101 | 1101 | } else $offset = '+00:00'; |
1102 | - $filter_query = $this->getFilter($filters,true,true); |
|
1102 | + $filter_query = $this->getFilter($filters, true, true); |
|
1103 | 1103 | if ($globalDBdriver == 'mysql') { |
1104 | 1104 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
1105 | 1105 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | $date_array = array(); |
1121 | 1121 | $temp_array = array(); |
1122 | 1122 | |
1123 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1123 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1124 | 1124 | { |
1125 | 1125 | $temp_array['year_name'] = $row['year_name']; |
1126 | 1126 | $temp_array['month_name'] = $row['month_name']; |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | * @return Array the hour list |
1141 | 1141 | * |
1142 | 1142 | */ |
1143 | - public function countAllHours($orderby,$filters = array()) |
|
1143 | + public function countAllHours($orderby, $filters = array()) |
|
1144 | 1144 | { |
1145 | 1145 | global $globalTimezone, $globalDBdriver; |
1146 | 1146 | if ($globalTimezone != '') { |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | $hour_array = array(); |
1189 | 1189 | $temp_array = array(); |
1190 | 1190 | |
1191 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1191 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1192 | 1192 | { |
1193 | 1193 | $temp_array['hour_name'] = $row['hour_name']; |
1194 | 1194 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1210,8 +1210,8 @@ discard block |
||
1210 | 1210 | public function countAllHoursByDate($date, $filters = array()) |
1211 | 1211 | { |
1212 | 1212 | global $globalTimezone, $globalDBdriver; |
1213 | - $filter_query = $this->getFilter($filters,true,true); |
|
1214 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
1213 | + $filter_query = $this->getFilter($filters, true, true); |
|
1214 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
1215 | 1215 | if ($globalTimezone != '') { |
1216 | 1216 | date_default_timezone_set($globalTimezone); |
1217 | 1217 | $datetime = new DateTime($date); |
@@ -1219,12 +1219,12 @@ discard block |
||
1219 | 1219 | } else $offset = '+00:00'; |
1220 | 1220 | |
1221 | 1221 | if ($globalDBdriver == 'mysql') { |
1222 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1222 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1223 | 1223 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = :date |
1224 | 1224 | GROUP BY hour_name |
1225 | 1225 | ORDER BY hour_name ASC"; |
1226 | 1226 | } else { |
1227 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1227 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1228 | 1228 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
1229 | 1229 | GROUP BY hour_name |
1230 | 1230 | ORDER BY hour_name ASC"; |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | $hour_array = array(); |
1237 | 1237 | $temp_array = array(); |
1238 | 1238 | |
1239 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1239 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1240 | 1240 | { |
1241 | 1241 | $temp_array['hour_name'] = $row['hour_name']; |
1242 | 1242 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1258,8 +1258,8 @@ discard block |
||
1258 | 1258 | public function countAllHoursByIdent($ident, $filters = array()) |
1259 | 1259 | { |
1260 | 1260 | global $globalTimezone, $globalDBdriver; |
1261 | - $filter_query = $this->getFilter($filters,true,true); |
|
1262 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1261 | + $filter_query = $this->getFilter($filters, true, true); |
|
1262 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1263 | 1263 | if ($globalTimezone != '') { |
1264 | 1264 | date_default_timezone_set($globalTimezone); |
1265 | 1265 | $datetime = new DateTime(); |
@@ -1267,12 +1267,12 @@ discard block |
||
1267 | 1267 | } else $offset = '+00:00'; |
1268 | 1268 | |
1269 | 1269 | if ($globalDBdriver == 'mysql') { |
1270 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1270 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1271 | 1271 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
1272 | 1272 | GROUP BY hour_name |
1273 | 1273 | ORDER BY hour_name ASC"; |
1274 | 1274 | } else { |
1275 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1275 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1276 | 1276 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
1277 | 1277 | GROUP BY hour_name |
1278 | 1278 | ORDER BY hour_name ASC"; |
@@ -1280,12 +1280,12 @@ discard block |
||
1280 | 1280 | |
1281 | 1281 | |
1282 | 1282 | $sth = $this->db->prepare($query); |
1283 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
1283 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
1284 | 1284 | |
1285 | 1285 | $hour_array = array(); |
1286 | 1286 | $temp_array = array(); |
1287 | 1287 | |
1288 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1288 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1289 | 1289 | { |
1290 | 1290 | $temp_array['hour_name'] = $row['hour_name']; |
1291 | 1291 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1304,33 +1304,33 @@ discard block |
||
1304 | 1304 | * @return Integer the number of trackers |
1305 | 1305 | * |
1306 | 1306 | */ |
1307 | - public function countOverallTracker($filters = array(),$year = '',$month = '') |
|
1307 | + public function countOverallTracker($filters = array(), $year = '', $month = '') |
|
1308 | 1308 | { |
1309 | 1309 | global $globalDBdriver; |
1310 | 1310 | //$queryi = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output"; |
1311 | - $queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output"; |
|
1311 | + $queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output"; |
|
1312 | 1312 | $query_values = array(); |
1313 | 1313 | $query = ''; |
1314 | 1314 | if ($year != '') { |
1315 | 1315 | if ($globalDBdriver == 'mysql') { |
1316 | 1316 | $query .= " AND YEAR(tracker_output.date) = :year"; |
1317 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1317 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1318 | 1318 | } else { |
1319 | 1319 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
1320 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1320 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1321 | 1321 | } |
1322 | 1322 | } |
1323 | 1323 | if ($month != '') { |
1324 | 1324 | if ($globalDBdriver == 'mysql') { |
1325 | 1325 | $query .= " AND MONTH(tracker_output.date) = :month"; |
1326 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1326 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1327 | 1327 | } else { |
1328 | 1328 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
1329 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1329 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1330 | 1330 | } |
1331 | 1331 | } |
1332 | 1332 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1333 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1333 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1334 | 1334 | |
1335 | 1335 | $sth = $this->db->prepare($queryi); |
1336 | 1336 | $sth->execute($query_values); |
@@ -1343,32 +1343,32 @@ discard block |
||
1343 | 1343 | * @return Integer the number of flights |
1344 | 1344 | * |
1345 | 1345 | */ |
1346 | - public function countOverallTrackerTypes($filters = array(),$year = '',$month = '') |
|
1346 | + public function countOverallTrackerTypes($filters = array(), $year = '', $month = '') |
|
1347 | 1347 | { |
1348 | 1348 | global $globalDBdriver; |
1349 | - $queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output"; |
|
1349 | + $queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output"; |
|
1350 | 1350 | $query_values = array(); |
1351 | 1351 | $query = ''; |
1352 | 1352 | if ($year != '') { |
1353 | 1353 | if ($globalDBdriver == 'mysql') { |
1354 | 1354 | $query .= " AND YEAR(tracker_output.date) = :year"; |
1355 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1355 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1356 | 1356 | } else { |
1357 | 1357 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
1358 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1358 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1359 | 1359 | } |
1360 | 1360 | } |
1361 | 1361 | if ($month != '') { |
1362 | 1362 | if ($globalDBdriver == 'mysql') { |
1363 | 1363 | $query .= " AND MONTH(tracker_output.date) = :month"; |
1364 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1364 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1365 | 1365 | } else { |
1366 | 1366 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
1367 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1367 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1368 | 1368 | } |
1369 | 1369 | } |
1370 | 1370 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1371 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1371 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1372 | 1372 | |
1373 | 1373 | $sth = $this->db->prepare($queryi); |
1374 | 1374 | $sth->execute($query_values); |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | public function countAllHoursFromToday($filters = array()) |
1386 | 1386 | { |
1387 | 1387 | global $globalTimezone, $globalDBdriver; |
1388 | - $filter_query = $this->getFilter($filters,true,true); |
|
1388 | + $filter_query = $this->getFilter($filters, true, true); |
|
1389 | 1389 | if ($globalTimezone != '') { |
1390 | 1390 | date_default_timezone_set($globalTimezone); |
1391 | 1391 | $datetime = new DateTime(); |
@@ -1393,12 +1393,12 @@ discard block |
||
1393 | 1393 | } else $offset = '+00:00'; |
1394 | 1394 | |
1395 | 1395 | if ($globalDBdriver == 'mysql') { |
1396 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1396 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1397 | 1397 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = CURDATE() |
1398 | 1398 | GROUP BY hour_name |
1399 | 1399 | ORDER BY hour_name ASC"; |
1400 | 1400 | } else { |
1401 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1401 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1402 | 1402 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
1403 | 1403 | GROUP BY hour_name |
1404 | 1404 | ORDER BY hour_name ASC"; |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | $hour_array = array(); |
1411 | 1411 | $temp_array = array(); |
1412 | 1412 | |
1413 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1413 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1414 | 1414 | { |
1415 | 1415 | $temp_array['hour_name'] = $row['hour_name']; |
1416 | 1416 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1429,9 +1429,9 @@ discard block |
||
1429 | 1429 | */ |
1430 | 1430 | public function getTrackerIDBasedOnFamTrackID($famtrackid) |
1431 | 1431 | { |
1432 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
1432 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
1433 | 1433 | |
1434 | - $query = "SELECT tracker_output.tracker_id |
|
1434 | + $query = "SELECT tracker_output.tracker_id |
|
1435 | 1435 | FROM tracker_output |
1436 | 1436 | WHERE tracker_output.famtrackid = '".$famtrackid."'"; |
1437 | 1437 | |
@@ -1439,7 +1439,7 @@ discard block |
||
1439 | 1439 | $sth = $this->db->prepare($query); |
1440 | 1440 | $sth->execute(); |
1441 | 1441 | |
1442 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1442 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1443 | 1443 | { |
1444 | 1444 | return $row['tracker_id']; |
1445 | 1445 | } |
@@ -1464,23 +1464,23 @@ discard block |
||
1464 | 1464 | } |
1465 | 1465 | |
1466 | 1466 | $current_date = date("Y-m-d H:i:s"); |
1467 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
1467 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
1468 | 1468 | |
1469 | 1469 | $diff = abs(strtotime($current_date) - strtotime($date)); |
1470 | 1470 | |
1471 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
1471 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
1472 | 1472 | $years = $time_array['years']; |
1473 | 1473 | |
1474 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
1474 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
1475 | 1475 | $months = $time_array['months']; |
1476 | 1476 | |
1477 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
1477 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
1478 | 1478 | $days = $time_array['days']; |
1479 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
1479 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
1480 | 1480 | $hours = $time_array['hours']; |
1481 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
1481 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
1482 | 1482 | $minutes = $time_array['minutes']; |
1483 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1483 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1484 | 1484 | |
1485 | 1485 | return $time_array; |
1486 | 1486 | } |
@@ -1503,63 +1503,63 @@ discard block |
||
1503 | 1503 | $temp_array['direction_degree'] = $direction; |
1504 | 1504 | $temp_array['direction_shortname'] = "N"; |
1505 | 1505 | $temp_array['direction_fullname'] = "North"; |
1506 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
1506 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
1507 | 1507 | $temp_array['direction_degree'] = $direction; |
1508 | 1508 | $temp_array['direction_shortname'] = "NNE"; |
1509 | 1509 | $temp_array['direction_fullname'] = "North-Northeast"; |
1510 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
1510 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
1511 | 1511 | $temp_array['direction_degree'] = $direction; |
1512 | 1512 | $temp_array['direction_shortname'] = "NE"; |
1513 | 1513 | $temp_array['direction_fullname'] = "Northeast"; |
1514 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
1514 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
1515 | 1515 | $temp_array['direction_degree'] = $direction; |
1516 | 1516 | $temp_array['direction_shortname'] = "ENE"; |
1517 | 1517 | $temp_array['direction_fullname'] = "East-Northeast"; |
1518 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
1518 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
1519 | 1519 | $temp_array['direction_degree'] = $direction; |
1520 | 1520 | $temp_array['direction_shortname'] = "E"; |
1521 | 1521 | $temp_array['direction_fullname'] = "East"; |
1522 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
1522 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
1523 | 1523 | $temp_array['direction_degree'] = $direction; |
1524 | 1524 | $temp_array['direction_shortname'] = "ESE"; |
1525 | 1525 | $temp_array['direction_fullname'] = "East-Southeast"; |
1526 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
1526 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
1527 | 1527 | $temp_array['direction_degree'] = $direction; |
1528 | 1528 | $temp_array['direction_shortname'] = "SE"; |
1529 | 1529 | $temp_array['direction_fullname'] = "Southeast"; |
1530 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
1530 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
1531 | 1531 | $temp_array['direction_degree'] = $direction; |
1532 | 1532 | $temp_array['direction_shortname'] = "SSE"; |
1533 | 1533 | $temp_array['direction_fullname'] = "South-Southeast"; |
1534 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
1534 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
1535 | 1535 | $temp_array['direction_degree'] = $direction; |
1536 | 1536 | $temp_array['direction_shortname'] = "S"; |
1537 | 1537 | $temp_array['direction_fullname'] = "South"; |
1538 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
1538 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
1539 | 1539 | $temp_array['direction_degree'] = $direction; |
1540 | 1540 | $temp_array['direction_shortname'] = "SSW"; |
1541 | 1541 | $temp_array['direction_fullname'] = "South-Southwest"; |
1542 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
1542 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
1543 | 1543 | $temp_array['direction_degree'] = $direction; |
1544 | 1544 | $temp_array['direction_shortname'] = "SW"; |
1545 | 1545 | $temp_array['direction_fullname'] = "Southwest"; |
1546 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
1546 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
1547 | 1547 | $temp_array['direction_degree'] = $direction; |
1548 | 1548 | $temp_array['direction_shortname'] = "WSW"; |
1549 | 1549 | $temp_array['direction_fullname'] = "West-Southwest"; |
1550 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
1550 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
1551 | 1551 | $temp_array['direction_degree'] = $direction; |
1552 | 1552 | $temp_array['direction_shortname'] = "W"; |
1553 | 1553 | $temp_array['direction_fullname'] = "West"; |
1554 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
1554 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
1555 | 1555 | $temp_array['direction_degree'] = $direction; |
1556 | 1556 | $temp_array['direction_shortname'] = "WNW"; |
1557 | 1557 | $temp_array['direction_fullname'] = "West-Northwest"; |
1558 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
1558 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
1559 | 1559 | $temp_array['direction_degree'] = $direction; |
1560 | 1560 | $temp_array['direction_shortname'] = "NW"; |
1561 | 1561 | $temp_array['direction_fullname'] = "Northwest"; |
1562 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
1562 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
1563 | 1563 | $temp_array['direction_degree'] = $direction; |
1564 | 1564 | $temp_array['direction_shortname'] = "NNW"; |
1565 | 1565 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1576,11 +1576,11 @@ discard block |
||
1576 | 1576 | * @param Float $longitude longitute of the flight |
1577 | 1577 | * @return String the countrie |
1578 | 1578 | */ |
1579 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
1579 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
1580 | 1580 | { |
1581 | 1581 | global $globalDBdriver, $globalDebug; |
1582 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1583 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1582 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1583 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1584 | 1584 | |
1585 | 1585 | $Connection = new Connection($this->db); |
1586 | 1586 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1620,7 +1620,7 @@ discard block |
||
1620 | 1620 | public function getCountryFromISO2($iso2) |
1621 | 1621 | { |
1622 | 1622 | global $globalDBdriver, $globalDebug; |
1623 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
1623 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
1624 | 1624 | |
1625 | 1625 | $Connection = new Connection($this->db); |
1626 | 1626 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1649,11 +1649,11 @@ discard block |
||
1649 | 1649 | * @return Array the vessel type list |
1650 | 1650 | * |
1651 | 1651 | */ |
1652 | - public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
1652 | + public function countAllTrackerTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
1653 | 1653 | { |
1654 | 1654 | global $globalDBdriver; |
1655 | - $filter_query = $this->getFilter($filters,true,true); |
|
1656 | - $query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count |
|
1655 | + $filter_query = $this->getFilter($filters, true, true); |
|
1656 | + $query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count |
|
1657 | 1657 | FROM tracker_output ".$filter_query." tracker_output.type <> ''"; |
1658 | 1658 | if ($olderthanmonths > 0) { |
1659 | 1659 | if ($globalDBdriver == 'mysql') { |
@@ -1673,28 +1673,28 @@ discard block |
||
1673 | 1673 | if ($year != '') { |
1674 | 1674 | if ($globalDBdriver == 'mysql') { |
1675 | 1675 | $query .= " AND YEAR(tracker_output.date) = :year"; |
1676 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1676 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1677 | 1677 | } else { |
1678 | 1678 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
1679 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1679 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1680 | 1680 | } |
1681 | 1681 | } |
1682 | 1682 | if ($month != '') { |
1683 | 1683 | if ($globalDBdriver == 'mysql') { |
1684 | 1684 | $query .= " AND MONTH(tracker_output.date) = :month"; |
1685 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1685 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1686 | 1686 | } else { |
1687 | 1687 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
1688 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1688 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1689 | 1689 | } |
1690 | 1690 | } |
1691 | 1691 | if ($day != '') { |
1692 | 1692 | if ($globalDBdriver == 'mysql') { |
1693 | 1693 | $query .= " AND DAY(tracker_output.date) = :day"; |
1694 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1694 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1695 | 1695 | } else { |
1696 | 1696 | $query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day"; |
1697 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1697 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1698 | 1698 | } |
1699 | 1699 | } |
1700 | 1700 | $query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC"; |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | $sth->execute($query_values); |
1704 | 1704 | $tracker_array = array(); |
1705 | 1705 | $temp_array = array(); |
1706 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1706 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1707 | 1707 | { |
1708 | 1708 | $temp_array['tracker_type'] = $row['tracker_type']; |
1709 | 1709 | $temp_array['tracker_type_count'] = $row['tracker_type_count']; |
@@ -1738,7 +1738,7 @@ discard block |
||
1738 | 1738 | |
1739 | 1739 | $bitly_data = json_decode($bitly_data); |
1740 | 1740 | $bitly_url = ''; |
1741 | - if ($bitly_data->status_txt = "OK"){ |
|
1741 | + if ($bitly_data->status_txt = "OK") { |
|
1742 | 1742 | $bitly_url = $bitly_data->data->url; |
1743 | 1743 | } |
1744 | 1744 | |
@@ -1748,7 +1748,7 @@ discard block |
||
1748 | 1748 | |
1749 | 1749 | public function getOrderBy() |
1750 | 1750 | { |
1751 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_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")); |
|
1751 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_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")); |
|
1752 | 1752 | |
1753 | 1753 | return $orderby; |
1754 | 1754 |
@@ -55,23 +55,23 @@ discard block |
||
55 | 55 | $min = true; |
56 | 56 | $allhistory = false; |
57 | 57 | $filter['source'] = array(); |
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
65 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
66 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
67 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
58 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
59 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
60 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
61 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
62 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
63 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
64 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
65 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
66 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
67 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
68 | 68 | |
69 | 69 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
70 | 70 | $min = true; |
71 | 71 | } else $min = false; |
72 | 72 | |
73 | 73 | if (isset($_GET['ident'])) { |
74 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
74 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
75 | 75 | if ($tracker) { |
76 | 76 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
77 | 77 | } elseif ($marine) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | $allhistory = true; |
87 | 87 | } elseif (isset($_GET['flightaware_id'])) { |
88 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
88 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
89 | 89 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
90 | 90 | if (empty($spotter_array)) { |
91 | 91 | $from_archive = true; |
@@ -93,44 +93,44 @@ discard block |
||
93 | 93 | } |
94 | 94 | $allhistory = true; |
95 | 95 | } elseif (isset($_GET['famtrack_id'])) { |
96 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
96 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
97 | 97 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
98 | 98 | $allhistory = true; |
99 | 99 | } elseif (isset($_GET['fammarine_id'])) { |
100 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
100 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
101 | 101 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
102 | 102 | $allhistory = true; |
103 | 103 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
104 | 104 | //} elseif (isset($_GET['coord'])) { |
105 | 105 | $usecoord = true; |
106 | - $coord = explode(',',$_GET['coord']); |
|
106 | + $coord = explode(',', $_GET['coord']); |
|
107 | 107 | if ($tracker) { |
108 | - $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter); |
|
108 | + $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter); |
|
109 | 109 | } elseif ($marine) { |
110 | - $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter); |
|
110 | + $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter); |
|
111 | 111 | } else { |
112 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
112 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
113 | 113 | } |
114 | 114 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
115 | 115 | $usecoord = true; |
116 | - $coord = explode(',',$_GET['coord']); |
|
116 | + $coord = explode(',', $_GET['coord']); |
|
117 | 117 | if ($tracker) { |
118 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
118 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
119 | 119 | } elseif ($marine) { |
120 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
120 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
121 | 121 | } else { |
122 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
122 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
123 | 123 | } |
124 | 124 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
125 | 125 | $from_archive = true; |
126 | 126 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
127 | 127 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
128 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
129 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
130 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
131 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
132 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
133 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
128 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
129 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
130 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
131 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
132 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
133 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
134 | 134 | } elseif ($min) { |
135 | 135 | if ($tracker) { |
136 | 136 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -142,17 +142,17 @@ discard block |
||
142 | 142 | # $min = true; |
143 | 143 | } else { |
144 | 144 | if ($tracker) { |
145 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
145 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
146 | 146 | } elseif ($marine) { |
147 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
147 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
148 | 148 | } else { |
149 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
149 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | 153 | if ($usecoord) { |
154 | 154 | if (isset($_GET['archive'])) { |
155 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
155 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
156 | 156 | } else { |
157 | 157 | if ($tracker) { |
158 | 158 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | if ($flightcnt == '') $flightcnt = 0; |
166 | 166 | } else $flightcnt = 0; |
167 | 167 | |
168 | -$sqltime = round(microtime(true)-$begintime,2); |
|
168 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
169 | 169 | |
170 | 170 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
171 | 171 | else $usenextlatlon = true; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | if (!empty($spotter_array) && is_array($spotter_array)) |
183 | 183 | { |
184 | 184 | $output .= '"features": ['; |
185 | - foreach($spotter_array as $spotter_item) |
|
185 | + foreach ($spotter_array as $spotter_item) |
|
186 | 186 | { |
187 | 187 | $j++; |
188 | 188 | date_default_timezone_set('UTC'); |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | */ |
239 | 239 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
240 | 240 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
241 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
242 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
241 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
242 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
243 | 243 | //" |
244 | 244 | } else { |
245 | 245 | if ($compress) $output .= '"c": "NA",'; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
249 | 249 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
250 | 250 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
251 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
251 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
252 | 252 | } elseif (isset($spotter_item['aircraft_type'])) { |
253 | 253 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
254 | 254 | } elseif (!$min) { |
@@ -389,16 +389,16 @@ discard block |
||
389 | 389 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
390 | 390 | |
391 | 391 | if (isset($archivespeed)) { |
392 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
392 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
393 | 393 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
394 | 394 | } elseif ($usenextlatlon) { |
395 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
395 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
396 | 396 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
397 | 397 | } |
398 | 398 | |
399 | 399 | if (!$min) $output .= '"image": "'.$image.'",'; |
400 | 400 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
401 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
401 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
402 | 402 | } |
403 | 403 | if (isset($spotter_item['image_source_website'])) { |
404 | 404 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
421 | 421 | } |
422 | 422 | if (isset($spotter_item['acars'])) { |
423 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
423 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
424 | 424 | } |
425 | 425 | // type when not aircraft ? |
426 | 426 | if (isset($spotter_item['type'])) { |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | |
499 | 499 | } |
500 | 500 | */ |
501 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
501 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
502 | 502 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
503 | 503 | |
504 | 504 | if ( |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
507 | 507 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
508 | 508 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
509 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
509 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
510 | 510 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
511 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
511 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
512 | 512 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
513 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
513 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
514 | 514 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
515 | 515 | ) { |
516 | 516 | if ($tracker) { |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
548 | 548 | } |
549 | 549 | $output_history .= '['; |
550 | - $output_history .= $spotter_history['longitude'].', '; |
|
551 | - $output_history .= $spotter_history['latitude'].', '; |
|
552 | - $output_history .= $spotter_history['altitude']*30.48; |
|
550 | + $output_history .= $spotter_history['longitude'].', '; |
|
551 | + $output_history .= $spotter_history['latitude'].', '; |
|
552 | + $output_history .= $spotter_history['altitude']*30.48; |
|
553 | 553 | $output_history .= '],'; |
554 | 554 | /* |
555 | 555 | if ($from_archive === false) { |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
568 | 568 | } else $d = true; |
569 | 569 | $output_history .= '['; |
570 | - $output_history .= $spotter_history['longitude'].', '; |
|
571 | - $output_history .= $spotter_history['latitude']; |
|
570 | + $output_history .= $spotter_history['longitude'].', '; |
|
571 | + $output_history .= $spotter_history['latitude']; |
|
572 | 572 | $output_history .= '],'; |
573 | 573 | /* |
574 | 574 | if ($from_archive === false) { |
@@ -584,9 +584,9 @@ discard block |
||
584 | 584 | |
585 | 585 | if ($from_archive === false) { |
586 | 586 | $output_historyd = '['; |
587 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
588 | - $output_historyd .= $spotter_item['latitude']; |
|
589 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
587 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
588 | + $output_historyd .= $spotter_item['latitude']; |
|
589 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
590 | 590 | $output_historyd .= '],'; |
591 | 591 | //$output_history = $output_historyd.$output_history; |
592 | 592 | $output_history = $output_history.$output_historyd; |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | } |
601 | 601 | } |
602 | 602 | |
603 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
603 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
604 | 604 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
605 | 605 | && (isset($spotter_item['departure_airport']) |
606 | 606 | && $spotter_item['departure_airport'] != 'NA' |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | |
635 | 635 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
636 | 636 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
637 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
637 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
638 | 638 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
639 | 639 | && (isset($spotter_item['arrival_airport']) |
640 | 640 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | $output = substr($output, 0, -1); |
666 | 666 | $output .= ']'; |
667 | 667 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
668 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
668 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
669 | 669 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
670 | 670 | $output .= '"fc": "'.$j.'"'; |
671 | 671 | } else { |
@@ -17,33 +17,33 @@ 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, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
73 | 73 | } |
74 | 74 | } |
75 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
75 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
76 | 76 | } |
77 | 77 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
78 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
78 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
79 | 79 | } |
80 | 80 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
81 | 81 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
82 | 82 | if ($filter_query_where != '') { |
83 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
83 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
84 | 84 | } |
85 | 85 | $filter_query = $filter_query_join.$filter_query_where; |
86 | 86 | return $filter_query; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | if ($limit != '') |
104 | 104 | { |
105 | 105 | $limit_array = explode(',', $limit); |
106 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
107 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
106 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
107 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
108 | 108 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
109 | 109 | { |
110 | 110 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } else { |
128 | 128 | $query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query; |
129 | 129 | } |
130 | - $spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true); |
|
130 | + $spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true); |
|
131 | 131 | |
132 | 132 | return $spotter_array; |
133 | 133 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | global $globalDBdriver, $globalLiveInterval; |
144 | 144 | date_default_timezone_set('UTC'); |
145 | 145 | |
146 | - $filter_query = $this->getFilter($filter,true,true); |
|
146 | + $filter_query = $this->getFilter($filter, true, true); |
|
147 | 147 | |
148 | 148 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
149 | 149 | if ($globalDBdriver == 'mysql') { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | try { |
162 | 162 | $sth = $this->db->prepare($query); |
163 | 163 | $sth->execute(); |
164 | - } catch(PDOException $e) { |
|
164 | + } catch (PDOException $e) { |
|
165 | 165 | echo $e->getMessage(); |
166 | 166 | die; |
167 | 167 | } |
@@ -176,25 +176,25 @@ discard block |
||
176 | 176 | * @return Array the spotter information |
177 | 177 | * |
178 | 178 | */ |
179 | - public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false) |
|
179 | + public function getMinLastLiveTrackerData($coord, $filter = array(), $limit = false) |
|
180 | 180 | { |
181 | 181 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit; |
182 | 182 | date_default_timezone_set('UTC'); |
183 | 183 | $usecoord = false; |
184 | 184 | if (is_array($coord) && !empty($coord)) { |
185 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
186 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
187 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
188 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
185 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
186 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
187 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
188 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
189 | 189 | $usecoord = true; |
190 | 190 | } |
191 | - $filter_query = $this->getFilter($filter,true,true); |
|
191 | + $filter_query = $this->getFilter($filter, true, true); |
|
192 | 192 | |
193 | 193 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
194 | 194 | if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300'; |
195 | 195 | if ($globalDBdriver == 'mysql') { |
196 | 196 | if (isset($globalArchive) && $globalArchive) { |
197 | - $query = "SELECT * FROM ( |
|
197 | + $query = "SELECT * FROM ( |
|
198 | 198 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
199 | 199 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
200 | 200 | if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | } else { |
218 | 218 | if (isset($globalArchive) && $globalArchive) { |
219 | - $query = "SELECT * FROM ( |
|
219 | + $query = "SELECT * FROM ( |
|
220 | 220 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
221 | 221 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
222 | 222 | if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | try { |
241 | 241 | $sth = $this->db->prepare($query); |
242 | 242 | $sth->execute(); |
243 | - } catch(PDOException $e) { |
|
243 | + } catch (PDOException $e) { |
|
244 | 244 | echo $e->getMessage(); |
245 | 245 | die; |
246 | 246 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | public function getLiveTrackerCount($filter = array()) |
258 | 258 | { |
259 | 259 | global $globalDBdriver, $globalLiveInterval; |
260 | - $filter_query = $this->getFilter($filter,true,true); |
|
260 | + $filter_query = $this->getFilter($filter, true, true); |
|
261 | 261 | |
262 | 262 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
263 | 263 | if ($globalDBdriver == 'mysql') { |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | try { |
269 | 269 | $sth = $this->db->prepare($query); |
270 | 270 | $sth->execute(); |
271 | - } catch(PDOException $e) { |
|
271 | + } catch (PDOException $e) { |
|
272 | 272 | echo $e->getMessage(); |
273 | 273 | die; |
274 | 274 | } |
@@ -291,10 +291,10 @@ discard block |
||
291 | 291 | $filter_query = $this->getFilter($filter); |
292 | 292 | |
293 | 293 | if (is_array($coord)) { |
294 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
295 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
296 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
297 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
294 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
295 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
296 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
297 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
298 | 298 | } else return array(); |
299 | 299 | if ($globalDBdriver == 'mysql') { |
300 | 300 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
@@ -319,17 +319,17 @@ discard block |
||
319 | 319 | $filter_query = $this->getFilter($filter); |
320 | 320 | |
321 | 321 | if (is_array($coord)) { |
322 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
323 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
324 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
325 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
322 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
323 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
324 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
325 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
326 | 326 | } else return array(); |
327 | 327 | if ($globalDBdriver == 'mysql') { |
328 | 328 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
329 | 329 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
330 | 330 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
331 | 331 | } else { |
332 | - $query = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
332 | + $query = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
333 | 333 | FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date l.latitude BETWEEN ".$minlat." AND ".$maxlat." AND l.longitude BETWEEN ".$minlong." AND ".$maxlong." GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query." tracker_live.latitude <> '0' AND tracker_live.longitude <> '0'"; |
334 | 334 | } |
335 | 335 | $spotter_array = $Spotter->getDataFromDB($query); |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | if ($interval == '1m') |
378 | 378 | { |
379 | 379 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
380 | - } else if ($interval == '15m'){ |
|
380 | + } else if ($interval == '15m') { |
|
381 | 381 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
382 | 382 | } |
383 | 383 | } |
@@ -385,14 +385,14 @@ discard block |
||
385 | 385 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
386 | 386 | } |
387 | 387 | |
388 | - $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
388 | + $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
389 | 389 | WHERE tracker_live.latitude <> '' |
390 | 390 | AND tracker_live.longitude <> '' |
391 | 391 | ".$additional_query." |
392 | 392 | HAVING distance < :radius |
393 | 393 | ORDER BY distance"; |
394 | 394 | |
395 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
395 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
396 | 396 | |
397 | 397 | return $spotter_array; |
398 | 398 | } |
@@ -410,9 +410,9 @@ discard block |
||
410 | 410 | date_default_timezone_set('UTC'); |
411 | 411 | |
412 | 412 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
413 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
413 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
414 | 414 | |
415 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
415 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
416 | 416 | |
417 | 417 | return $spotter_array; |
418 | 418 | } |
@@ -423,16 +423,16 @@ discard block |
||
423 | 423 | * @return Array the spotter information |
424 | 424 | * |
425 | 425 | */ |
426 | - public function getDateLiveTrackerDataByIdent($ident,$date) |
|
426 | + public function getDateLiveTrackerDataByIdent($ident, $date) |
|
427 | 427 | { |
428 | 428 | $Tracker = new Tracker($this->db); |
429 | 429 | date_default_timezone_set('UTC'); |
430 | 430 | |
431 | 431 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
432 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
432 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
433 | 433 | |
434 | - $date = date('c',$date); |
|
435 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
434 | + $date = date('c', $date); |
|
435 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
436 | 436 | |
437 | 437 | return $spotter_array; |
438 | 438 | } |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | date_default_timezone_set('UTC'); |
450 | 450 | |
451 | 451 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
452 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
452 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
453 | 453 | |
454 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
|
454 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true); |
|
455 | 455 | |
456 | 456 | return $spotter_array; |
457 | 457 | } |
@@ -462,15 +462,15 @@ discard block |
||
462 | 462 | * @return Array the spotter information |
463 | 463 | * |
464 | 464 | */ |
465 | - public function getDateLiveTrackerDataById($id,$date) |
|
465 | + public function getDateLiveTrackerDataById($id, $date) |
|
466 | 466 | { |
467 | 467 | $Tracker = new Tracker($this->db); |
468 | 468 | date_default_timezone_set('UTC'); |
469 | 469 | |
470 | 470 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
471 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
472 | - $date = date('c',$date); |
|
473 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
471 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
472 | + $date = date('c', $date); |
|
473 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
474 | 474 | |
475 | 475 | return $spotter_array; |
476 | 476 | } |
@@ -487,13 +487,13 @@ discard block |
||
487 | 487 | date_default_timezone_set('UTC'); |
488 | 488 | |
489 | 489 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
490 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
490 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
491 | 491 | |
492 | 492 | try { |
493 | 493 | |
494 | 494 | $sth = $this->db->prepare($query); |
495 | 495 | $sth->execute(array(':ident' => $ident)); |
496 | - } catch(PDOException $e) { |
|
496 | + } catch (PDOException $e) { |
|
497 | 497 | echo $e->getMessage(); |
498 | 498 | die; |
499 | 499 | } |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @return Array the spotter information |
509 | 509 | * |
510 | 510 | */ |
511 | - public function getAllLiveTrackerDataById($id,$liveinterval = false) |
|
511 | + public function getAllLiveTrackerDataById($id, $liveinterval = false) |
|
512 | 512 | { |
513 | 513 | global $globalDBdriver, $globalLiveInterval; |
514 | 514 | date_default_timezone_set('UTC'); |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | try { |
528 | 528 | $sth = $this->db->prepare($query); |
529 | 529 | $sth->execute(array(':id' => $id)); |
530 | - } catch(PDOException $e) { |
|
530 | + } catch (PDOException $e) { |
|
531 | 531 | echo $e->getMessage(); |
532 | 532 | die; |
533 | 533 | } |
@@ -545,12 +545,12 @@ discard block |
||
545 | 545 | { |
546 | 546 | date_default_timezone_set('UTC'); |
547 | 547 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
548 | - $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
548 | + $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
549 | 549 | try { |
550 | 550 | |
551 | 551 | $sth = $this->db->prepare($query); |
552 | 552 | $sth->execute(array(':ident' => $ident)); |
553 | - } catch(PDOException $e) { |
|
553 | + } catch (PDOException $e) { |
|
554 | 554 | echo $e->getMessage(); |
555 | 555 | die; |
556 | 556 | } |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | |
581 | 581 | $sth = $this->db->prepare($query); |
582 | 582 | $sth->execute(); |
583 | - } catch(PDOException $e) { |
|
583 | + } catch (PDOException $e) { |
|
584 | 584 | return "error"; |
585 | 585 | } |
586 | 586 | |
@@ -603,14 +603,14 @@ discard block |
||
603 | 603 | |
604 | 604 | $sth = $this->db->prepare($query); |
605 | 605 | $sth->execute(); |
606 | - } catch(PDOException $e) { |
|
606 | + } catch (PDOException $e) { |
|
607 | 607 | return "error"; |
608 | 608 | } |
609 | 609 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
610 | 610 | $i = 0; |
611 | - $j =0; |
|
611 | + $j = 0; |
|
612 | 612 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
613 | - foreach($all as $row) |
|
613 | + foreach ($all as $row) |
|
614 | 614 | { |
615 | 615 | $i++; |
616 | 616 | $j++; |
@@ -618,9 +618,9 @@ discard block |
||
618 | 618 | if ($globalDebug) echo "."; |
619 | 619 | try { |
620 | 620 | |
621 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
621 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
622 | 622 | $sth->execute(); |
623 | - } catch(PDOException $e) { |
|
623 | + } catch (PDOException $e) { |
|
624 | 624 | return "error"; |
625 | 625 | } |
626 | 626 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
@@ -631,9 +631,9 @@ discard block |
||
631 | 631 | if ($i > 0) { |
632 | 632 | try { |
633 | 633 | |
634 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
634 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
635 | 635 | $sth->execute(); |
636 | - } catch(PDOException $e) { |
|
636 | + } catch (PDOException $e) { |
|
637 | 637 | return "error"; |
638 | 638 | } |
639 | 639 | } |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | |
647 | 647 | $sth = $this->db->prepare($query); |
648 | 648 | $sth->execute(); |
649 | - } catch(PDOException $e) { |
|
649 | + } catch (PDOException $e) { |
|
650 | 650 | return "error"; |
651 | 651 | } |
652 | 652 | /* $query_delete = "DELETE FROM tracker_live WHERE famtrackid IN ("; |
@@ -694,13 +694,13 @@ discard block |
||
694 | 694 | public function deleteLiveTrackerDataByIdent($ident) |
695 | 695 | { |
696 | 696 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
697 | - $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
697 | + $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
698 | 698 | |
699 | 699 | try { |
700 | 700 | |
701 | 701 | $sth = $this->db->prepare($query); |
702 | 702 | $sth->execute(array(':ident' => $ident)); |
703 | - } catch(PDOException $e) { |
|
703 | + } catch (PDOException $e) { |
|
704 | 704 | return "error"; |
705 | 705 | } |
706 | 706 | |
@@ -716,13 +716,13 @@ discard block |
||
716 | 716 | public function deleteLiveTrackerDataById($id) |
717 | 717 | { |
718 | 718 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
719 | - $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
719 | + $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
720 | 720 | |
721 | 721 | try { |
722 | 722 | |
723 | 723 | $sth = $this->db->prepare($query); |
724 | 724 | $sth->execute(array(':id' => $id)); |
725 | - } catch(PDOException $e) { |
|
725 | + } catch (PDOException $e) { |
|
726 | 726 | return "error"; |
727 | 727 | } |
728 | 728 | |
@@ -740,13 +740,13 @@ discard block |
||
740 | 740 | { |
741 | 741 | global $globalDBdriver, $globalTimezone; |
742 | 742 | if ($globalDBdriver == 'mysql') { |
743 | - $query = 'SELECT tracker_live.ident FROM tracker_live |
|
743 | + $query = 'SELECT tracker_live.ident FROM tracker_live |
|
744 | 744 | WHERE tracker_live.ident = :ident |
745 | 745 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
746 | 746 | AND tracker_live.date < UTC_TIMESTAMP()'; |
747 | 747 | $query_data = array(':ident' => $ident); |
748 | 748 | } else { |
749 | - $query = "SELECT tracker_live.ident FROM tracker_live |
|
749 | + $query = "SELECT tracker_live.ident FROM tracker_live |
|
750 | 750 | WHERE tracker_live.ident = :ident |
751 | 751 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
752 | 752 | AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -755,8 +755,8 @@ discard block |
||
755 | 755 | |
756 | 756 | $sth = $this->db->prepare($query); |
757 | 757 | $sth->execute($query_data); |
758 | - $ident_result=''; |
|
759 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
758 | + $ident_result = ''; |
|
759 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
760 | 760 | { |
761 | 761 | $ident_result = $row['ident']; |
762 | 762 | } |
@@ -773,13 +773,13 @@ discard block |
||
773 | 773 | { |
774 | 774 | global $globalDBdriver, $globalTimezone; |
775 | 775 | if ($globalDBdriver == 'mysql') { |
776 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
776 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
777 | 777 | WHERE tracker_live.ident = :ident |
778 | 778 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
779 | 779 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
780 | 780 | $query_data = array(':ident' => $ident); |
781 | 781 | } else { |
782 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
782 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
783 | 783 | WHERE tracker_live.ident = :ident |
784 | 784 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
785 | 785 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -788,8 +788,8 @@ discard block |
||
788 | 788 | |
789 | 789 | $sth = $this->db->prepare($query); |
790 | 790 | $sth->execute($query_data); |
791 | - $ident_result=''; |
|
792 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
791 | + $ident_result = ''; |
|
792 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
793 | 793 | { |
794 | 794 | $ident_result = $row['famtrackid']; |
795 | 795 | } |
@@ -806,13 +806,13 @@ discard block |
||
806 | 806 | { |
807 | 807 | global $globalDBdriver, $globalTimezone; |
808 | 808 | if ($globalDBdriver == 'mysql') { |
809 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
809 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
810 | 810 | WHERE tracker_live.famtrackid = :id |
811 | 811 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
812 | 812 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
813 | 813 | $query_data = array(':id' => $id); |
814 | 814 | } else { |
815 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
815 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
816 | 816 | WHERE tracker_live.famtrackid = :id |
817 | 817 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
818 | 818 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -821,8 +821,8 @@ discard block |
||
821 | 821 | |
822 | 822 | $sth = $this->db->prepare($query); |
823 | 823 | $sth->execute($query_data); |
824 | - $ident_result=''; |
|
825 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
824 | + $ident_result = ''; |
|
825 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
826 | 826 | { |
827 | 827 | $ident_result = $row['famtrackid']; |
828 | 828 | } |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | * @return String success or false |
841 | 841 | * |
842 | 842 | */ |
843 | - public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
843 | + public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
844 | 844 | { |
845 | 845 | global $globalURL, $globalArchive, $globalDebug; |
846 | 846 | $Common = new Common(); |
@@ -899,21 +899,21 @@ discard block |
||
899 | 899 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
900 | 900 | |
901 | 901 | |
902 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
903 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
904 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
905 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
906 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
907 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
908 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
909 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
910 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
911 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
912 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
913 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
914 | - |
|
915 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
916 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
902 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
903 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
904 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
905 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
906 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
907 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
908 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
909 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
910 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
911 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
912 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
913 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
914 | + |
|
915 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
916 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
917 | 917 | |
918 | 918 | $query = ''; |
919 | 919 | if ($globalArchive) { |
@@ -923,12 +923,12 @@ discard block |
||
923 | 923 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
924 | 924 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
925 | 925 | |
926 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type); |
|
926 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type); |
|
927 | 927 | try { |
928 | 928 | |
929 | 929 | $sth = $this->db->prepare($query); |
930 | 930 | $sth->execute($query_values); |
931 | - } catch(PDOException $e) { |
|
931 | + } catch (PDOException $e) { |
|
932 | 932 | return "error : ".$e->getMessage(); |
933 | 933 | } |
934 | 934 | /* |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
939 | 939 | if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
940 | 940 | $TrackerArchive = new TrackerArchive($this->db); |
941 | - $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
941 | + $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country); |
|
942 | 942 | if ($globalDebug) echo $result.')'; |
943 | 943 | } |
944 | 944 | |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | |
949 | 949 | public function getOrderBy() |
950 | 950 | { |
951 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
951 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
952 | 952 | return $orderby; |
953 | 953 | } |
954 | 954 |
@@ -17,33 +17,33 @@ 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, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | $filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
73 | 73 | } |
74 | 74 | } |
75 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
75 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
76 | 76 | } |
77 | 77 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
78 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
78 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
79 | 79 | } |
80 | 80 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
81 | 81 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
82 | 82 | if ($filter_query_where != '') { |
83 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
83 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
84 | 84 | } |
85 | 85 | $filter_query = $filter_query_join.$filter_query_where; |
86 | 86 | return $filter_query; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | if ($limit != '') |
104 | 104 | { |
105 | 105 | $limit_array = explode(',', $limit); |
106 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
107 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
106 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
107 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
108 | 108 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
109 | 109 | { |
110 | 110 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
120 | 120 | } |
121 | 121 | } |
122 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
122 | + if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
123 | 123 | |
124 | 124 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
125 | 125 | if ($globalDBdriver == 'mysql') { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } else { |
129 | 129 | $query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query; |
130 | 130 | } |
131 | - $spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true); |
|
131 | + $spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true); |
|
132 | 132 | |
133 | 133 | return $spotter_array; |
134 | 134 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | global $globalDBdriver, $globalLiveInterval; |
145 | 145 | date_default_timezone_set('UTC'); |
146 | 146 | |
147 | - $filter_query = $this->getFilter($filter,true,true); |
|
147 | + $filter_query = $this->getFilter($filter, true, true); |
|
148 | 148 | |
149 | 149 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
150 | 150 | if ($globalDBdriver == 'mysql') { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | try { |
159 | 159 | $sth = $this->db->prepare($query); |
160 | 160 | $sth->execute(); |
161 | - } catch(PDOException $e) { |
|
161 | + } catch (PDOException $e) { |
|
162 | 162 | echo $e->getMessage(); |
163 | 163 | die; |
164 | 164 | } |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | * @return Array the spotter information |
174 | 174 | * |
175 | 175 | */ |
176 | - public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false) |
|
176 | + public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false) |
|
177 | 177 | { |
178 | 178 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
179 | 179 | date_default_timezone_set('UTC'); |
180 | 180 | $usecoord = false; |
181 | 181 | if (is_array($coord) && !empty($coord)) { |
182 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
183 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
184 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
185 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
182 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
183 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
184 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
185 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
186 | 186 | $usecoord = true; |
187 | 187 | } |
188 | - $filter_query = $this->getFilter($filter,true,true); |
|
188 | + $filter_query = $this->getFilter($filter, true, true); |
|
189 | 189 | |
190 | 190 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
191 | 191 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | try { |
235 | 235 | $sth = $this->db->prepare($query); |
236 | 236 | $sth->execute(); |
237 | - } catch(PDOException $e) { |
|
237 | + } catch (PDOException $e) { |
|
238 | 238 | echo $e->getMessage(); |
239 | 239 | die; |
240 | 240 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | public function getLiveMarineCount($filter = array()) |
252 | 252 | { |
253 | 253 | global $globalDBdriver, $globalLiveInterval; |
254 | - $filter_query = $this->getFilter($filter,true,true); |
|
254 | + $filter_query = $this->getFilter($filter, true, true); |
|
255 | 255 | |
256 | 256 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
257 | 257 | if ($globalDBdriver == 'mysql') { |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | try { |
263 | 263 | $sth = $this->db->prepare($query); |
264 | 264 | $sth->execute(); |
265 | - } catch(PDOException $e) { |
|
265 | + } catch (PDOException $e) { |
|
266 | 266 | echo $e->getMessage(); |
267 | 267 | die; |
268 | 268 | } |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | $filter_query = $this->getFilter($filter); |
286 | 286 | |
287 | 287 | if (is_array($coord)) { |
288 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
289 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
290 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
291 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
288 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
289 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
290 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
291 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
292 | 292 | } else return array(); |
293 | 293 | if ($globalDBdriver == 'mysql') { |
294 | 294 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id'.$filter_query; |
@@ -313,17 +313,17 @@ discard block |
||
313 | 313 | $filter_query = $this->getFilter($filter); |
314 | 314 | |
315 | 315 | if (is_array($coord)) { |
316 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
317 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
318 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
319 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
316 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
317 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
318 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
319 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
320 | 320 | } else return array(); |
321 | 321 | if ($globalDBdriver == 'mysql') { |
322 | 322 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
323 | 323 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
324 | 324 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
325 | 325 | } else { |
326 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
326 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
327 | 327 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
328 | 328 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
329 | 329 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | if ($interval == '1m') |
373 | 373 | { |
374 | 374 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
375 | - } else if ($interval == '15m'){ |
|
375 | + } else if ($interval == '15m') { |
|
376 | 376 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
377 | 377 | } |
378 | 378 | } |
@@ -380,14 +380,14 @@ discard block |
||
380 | 380 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
381 | 381 | } |
382 | 382 | |
383 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
383 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
384 | 384 | WHERE marine_live.latitude <> '' |
385 | 385 | AND marine_live.longitude <> '' |
386 | 386 | ".$additional_query." |
387 | 387 | HAVING distance < :radius |
388 | 388 | ORDER BY distance"; |
389 | 389 | |
390 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
390 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
391 | 391 | |
392 | 392 | return $spotter_array; |
393 | 393 | } |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | date_default_timezone_set('UTC'); |
406 | 406 | |
407 | 407 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
408 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
408 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
409 | 409 | |
410 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
410 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
411 | 411 | |
412 | 412 | return $spotter_array; |
413 | 413 | } |
@@ -418,16 +418,16 @@ discard block |
||
418 | 418 | * @return Array the spotter information |
419 | 419 | * |
420 | 420 | */ |
421 | - public function getDateLiveMarineDataByIdent($ident,$date) |
|
421 | + public function getDateLiveMarineDataByIdent($ident, $date) |
|
422 | 422 | { |
423 | 423 | $Marine = new Marine($this->db); |
424 | 424 | date_default_timezone_set('UTC'); |
425 | 425 | |
426 | 426 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
427 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
427 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
428 | 428 | |
429 | - $date = date('c',$date); |
|
430 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
429 | + $date = date('c', $date); |
|
430 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
431 | 431 | |
432 | 432 | return $spotter_array; |
433 | 433 | } |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | date_default_timezone_set('UTC'); |
445 | 445 | |
446 | 446 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
447 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
447 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
448 | 448 | |
449 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
|
449 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true); |
|
450 | 450 | |
451 | 451 | return $spotter_array; |
452 | 452 | } |
@@ -457,15 +457,15 @@ discard block |
||
457 | 457 | * @return Array the spotter information |
458 | 458 | * |
459 | 459 | */ |
460 | - public function getDateLiveMarineDataById($id,$date) |
|
460 | + public function getDateLiveMarineDataById($id, $date) |
|
461 | 461 | { |
462 | 462 | $Marine = new Marine($this->db); |
463 | 463 | date_default_timezone_set('UTC'); |
464 | 464 | |
465 | 465 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
466 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
467 | - $date = date('c',$date); |
|
468 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
466 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
467 | + $date = date('c', $date); |
|
468 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
469 | 469 | |
470 | 470 | return $spotter_array; |
471 | 471 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @return Array the spotter information |
478 | 478 | * |
479 | 479 | */ |
480 | - public function getAllLiveMarineDataById($id,$liveinterval = false) |
|
480 | + public function getAllLiveMarineDataById($id, $liveinterval = false) |
|
481 | 481 | { |
482 | 482 | global $globalDBdriver, $globalLiveInterval; |
483 | 483 | date_default_timezone_set('UTC'); |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | try { |
497 | 497 | $sth = $this->db->prepare($query); |
498 | 498 | $sth->execute(array(':id' => $id)); |
499 | - } catch(PDOException $e) { |
|
499 | + } catch (PDOException $e) { |
|
500 | 500 | echo $e->getMessage(); |
501 | 501 | die; |
502 | 502 | } |
@@ -514,12 +514,12 @@ discard block |
||
514 | 514 | { |
515 | 515 | date_default_timezone_set('UTC'); |
516 | 516 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
517 | - $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
517 | + $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
518 | 518 | try { |
519 | 519 | |
520 | 520 | $sth = $this->db->prepare($query); |
521 | 521 | $sth->execute(array(':ident' => $ident)); |
522 | - } catch(PDOException $e) { |
|
522 | + } catch (PDOException $e) { |
|
523 | 523 | echo $e->getMessage(); |
524 | 524 | die; |
525 | 525 | } |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | |
550 | 550 | $sth = $this->db->prepare($query); |
551 | 551 | $sth->execute(); |
552 | - } catch(PDOException $e) { |
|
552 | + } catch (PDOException $e) { |
|
553 | 553 | return "error"; |
554 | 554 | } |
555 | 555 | |
@@ -572,14 +572,14 @@ discard block |
||
572 | 572 | |
573 | 573 | $sth = $this->db->prepare($query); |
574 | 574 | $sth->execute(); |
575 | - } catch(PDOException $e) { |
|
575 | + } catch (PDOException $e) { |
|
576 | 576 | return "error"; |
577 | 577 | } |
578 | 578 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
579 | 579 | $i = 0; |
580 | - $j =0; |
|
580 | + $j = 0; |
|
581 | 581 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
582 | - foreach($all as $row) |
|
582 | + foreach ($all as $row) |
|
583 | 583 | { |
584 | 584 | $i++; |
585 | 585 | $j++; |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | if ($globalDebug) echo "."; |
588 | 588 | try { |
589 | 589 | |
590 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
590 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
591 | 591 | $sth->execute(); |
592 | - } catch(PDOException $e) { |
|
592 | + } catch (PDOException $e) { |
|
593 | 593 | return "error"; |
594 | 594 | } |
595 | 595 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
@@ -600,9 +600,9 @@ discard block |
||
600 | 600 | if ($i > 0) { |
601 | 601 | try { |
602 | 602 | |
603 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
603 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
604 | 604 | $sth->execute(); |
605 | - } catch(PDOException $e) { |
|
605 | + } catch (PDOException $e) { |
|
606 | 606 | return "error"; |
607 | 607 | } |
608 | 608 | } |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | |
616 | 616 | $sth = $this->db->prepare($query); |
617 | 617 | $sth->execute(); |
618 | - } catch(PDOException $e) { |
|
618 | + } catch (PDOException $e) { |
|
619 | 619 | return "error"; |
620 | 620 | } |
621 | 621 | /* $query_delete = "DELETE FROM marine_live WHERE fammarine_id IN ("; |
@@ -663,13 +663,13 @@ discard block |
||
663 | 663 | public function deleteLiveMarineDataByIdent($ident) |
664 | 664 | { |
665 | 665 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
666 | - $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
666 | + $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
667 | 667 | |
668 | 668 | try { |
669 | 669 | |
670 | 670 | $sth = $this->db->prepare($query); |
671 | 671 | $sth->execute(array(':ident' => $ident)); |
672 | - } catch(PDOException $e) { |
|
672 | + } catch (PDOException $e) { |
|
673 | 673 | return "error"; |
674 | 674 | } |
675 | 675 | |
@@ -685,13 +685,13 @@ discard block |
||
685 | 685 | public function deleteLiveMarineDataById($id) |
686 | 686 | { |
687 | 687 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
688 | - $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
688 | + $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
689 | 689 | |
690 | 690 | try { |
691 | 691 | |
692 | 692 | $sth = $this->db->prepare($query); |
693 | 693 | $sth->execute(array(':id' => $id)); |
694 | - } catch(PDOException $e) { |
|
694 | + } catch (PDOException $e) { |
|
695 | 695 | return "error"; |
696 | 696 | } |
697 | 697 | |
@@ -709,13 +709,13 @@ discard block |
||
709 | 709 | { |
710 | 710 | global $globalDBdriver, $globalTimezone; |
711 | 711 | if ($globalDBdriver == 'mysql') { |
712 | - $query = 'SELECT marine_live.ident FROM marine_live |
|
712 | + $query = 'SELECT marine_live.ident FROM marine_live |
|
713 | 713 | WHERE marine_live.ident = :ident |
714 | 714 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
715 | 715 | AND marine_live.date < UTC_TIMESTAMP()'; |
716 | 716 | $query_data = array(':ident' => $ident); |
717 | 717 | } else { |
718 | - $query = "SELECT marine_live.ident FROM marine_live |
|
718 | + $query = "SELECT marine_live.ident FROM marine_live |
|
719 | 719 | WHERE marine_live.ident = :ident |
720 | 720 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
721 | 721 | AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -724,8 +724,8 @@ discard block |
||
724 | 724 | |
725 | 725 | $sth = $this->db->prepare($query); |
726 | 726 | $sth->execute($query_data); |
727 | - $ident_result=''; |
|
728 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
727 | + $ident_result = ''; |
|
728 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
729 | 729 | { |
730 | 730 | $ident_result = $row['ident']; |
731 | 731 | } |
@@ -742,13 +742,13 @@ discard block |
||
742 | 742 | { |
743 | 743 | global $globalDBdriver, $globalTimezone; |
744 | 744 | if ($globalDBdriver == 'mysql') { |
745 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
745 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
746 | 746 | WHERE marine_live.ident = :ident |
747 | 747 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
748 | 748 | // AND marine_live.date < UTC_TIMESTAMP()"; |
749 | 749 | $query_data = array(':ident' => $ident); |
750 | 750 | } else { |
751 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
751 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
752 | 752 | WHERE marine_live.ident = :ident |
753 | 753 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
754 | 754 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -757,8 +757,8 @@ discard block |
||
757 | 757 | |
758 | 758 | $sth = $this->db->prepare($query); |
759 | 759 | $sth->execute($query_data); |
760 | - $ident_result=''; |
|
761 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
760 | + $ident_result = ''; |
|
761 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
762 | 762 | { |
763 | 763 | $ident_result = $row['fammarine_id']; |
764 | 764 | } |
@@ -775,13 +775,13 @@ discard block |
||
775 | 775 | { |
776 | 776 | global $globalDBdriver, $globalTimezone; |
777 | 777 | if ($globalDBdriver == 'mysql') { |
778 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
778 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
779 | 779 | WHERE marine_live.fammarine_id = :id |
780 | 780 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
781 | 781 | // AND marine_live.date < UTC_TIMESTAMP()"; |
782 | 782 | $query_data = array(':id' => $id); |
783 | 783 | } else { |
784 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
784 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
785 | 785 | WHERE marine_live.fammarine_id = :id |
786 | 786 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
787 | 787 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -790,8 +790,8 @@ discard block |
||
790 | 790 | |
791 | 791 | $sth = $this->db->prepare($query); |
792 | 792 | $sth->execute($query_data); |
793 | - $ident_result=''; |
|
794 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
793 | + $ident_result = ''; |
|
794 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
795 | 795 | { |
796 | 796 | $ident_result = $row['fammarine_id']; |
797 | 797 | } |
@@ -808,13 +808,13 @@ discard block |
||
808 | 808 | { |
809 | 809 | global $globalDBdriver, $globalTimezone; |
810 | 810 | if ($globalDBdriver == 'mysql') { |
811 | - $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
811 | + $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
812 | 812 | WHERE marine_live.mmsi = :mmsi |
813 | 813 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
814 | 814 | // AND marine_live.date < UTC_TIMESTAMP()"; |
815 | 815 | $query_data = array(':mmsi' => $mmsi); |
816 | 816 | } else { |
817 | - $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
817 | + $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
818 | 818 | WHERE marine_live.mmsi = :mmsi |
819 | 819 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
820 | 820 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -823,8 +823,8 @@ discard block |
||
823 | 823 | |
824 | 824 | $sth = $this->db->prepare($query); |
825 | 825 | $sth->execute($query_data); |
826 | - $ident_result=''; |
|
827 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
826 | + $ident_result = ''; |
|
827 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
828 | 828 | { |
829 | 829 | $ident_result = $row['fammarine_id']; |
830 | 830 | } |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | * @return String success or false |
843 | 843 | * |
844 | 844 | */ |
845 | - public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
845 | + public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
846 | 846 | { |
847 | 847 | global $globalURL, $globalArchive, $globalDebug; |
848 | 848 | $Common = new Common(); |
@@ -894,26 +894,26 @@ discard block |
||
894 | 894 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
895 | 895 | |
896 | 896 | |
897 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
898 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
899 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
900 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
901 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
902 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
903 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
904 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
905 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
906 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
907 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
908 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
909 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
910 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
911 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
912 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
897 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
898 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
899 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
900 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
901 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
902 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
903 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
904 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
905 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
906 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
907 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
908 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
909 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
910 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
911 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
912 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
913 | 913 | |
914 | 914 | |
915 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
916 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
915 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
916 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
917 | 917 | if ($arrival_date == '') $arrival_date = NULL; |
918 | 918 | $query = ''; |
919 | 919 | if ($globalArchive) { |
@@ -923,18 +923,18 @@ discard block |
||
923 | 923 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) |
924 | 924 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)'; |
925 | 925 | |
926 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':status' => $status,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date); |
|
926 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':status' => $status, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date); |
|
927 | 927 | try { |
928 | 928 | $sth = $this->db->prepare($query); |
929 | 929 | $sth->execute($query_values); |
930 | - } catch(PDOException $e) { |
|
930 | + } catch (PDOException $e) { |
|
931 | 931 | return "error : ".$e->getMessage(); |
932 | 932 | } |
933 | 933 | |
934 | 934 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
935 | 935 | if ($globalDebug) echo '(Add to Marine archive : '; |
936 | 936 | $MarineArchive = new MarineArchive($this->db); |
937 | - $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$noarchive,$format_source, $source_name, $over_country); |
|
937 | + $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $noarchive, $format_source, $source_name, $over_country); |
|
938 | 938 | if ($globalDebug) echo $result.')'; |
939 | 939 | } |
940 | 940 | return "success"; |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | |
943 | 943 | public function getOrderBy() |
944 | 944 | { |
945 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
945 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
946 | 946 | return $orderby; |
947 | 947 | } |
948 | 948 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | default: |
42 | 42 | throw new \Exception("bad resolution can be only one of 1,3"); |
43 | 43 | } |
44 | - register_shutdown_function(function () { |
|
44 | + register_shutdown_function(function() { |
|
45 | 45 | $this->closeAllFiles(); |
46 | 46 | }); |
47 | 47 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | |
56 | 56 | private function getElevationAtPosition($fileName, $row, $column) { |
57 | 57 | if (!array_key_exists($fileName, $this->openedFiles)) { |
58 | - if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) { |
|
58 | + if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) { |
|
59 | 59 | throw new \Exception("File '{$fileName}' not exists."); |
60 | 60 | } |
61 | - $file = fopen($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName, "r"); |
|
61 | + $file = fopen($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName, "r"); |
|
62 | 62 | if ($file === false) { |
63 | 63 | throw new \Exception("Cant open file '{$fileName}' for reading."); |
64 | 64 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | throw new \Exception("Not implemented yet"); |
73 | 73 | } |
74 | 74 | $aRow = $this->measPerDeg - $row; |
75 | - $position = ($this->measPerDeg * ($aRow - 1)) + $column; |
|
75 | + $position = ($this->measPerDeg*($aRow - 1)) + $column; |
|
76 | 76 | $position *= 2; |
77 | 77 | fseek($file, $position); |
78 | 78 | $short = fread($file, 2); |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | $latSec = $this->getSec($lat); |
101 | 101 | $lonSec = $this->getSec($lon); |
102 | 102 | |
103 | - $Xn = round($latSec / $this->resolution, 3); |
|
104 | - $Yn = round($lonSec / $this->resolution, 3); |
|
103 | + $Xn = round($latSec/$this->resolution, 3); |
|
104 | + $Yn = round($lonSec/$this->resolution, 3); |
|
105 | 105 | |
106 | 106 | $a1 = round($Xn); |
107 | 107 | $a2 = round($Yn); |
@@ -133,55 +133,55 @@ discard block |
||
133 | 133 | $b3 = $this->getElevationAtPosition($fName, $b1, $b2); |
134 | 134 | $c3 = $this->getElevationAtPosition($fName, $c1, $c2); |
135 | 135 | |
136 | - $n1 = ($c2 - $a2) * ($b3 - $a3) - ($c3 - $a3) * ($b2 - $a2); |
|
137 | - $n2 = ($c3 - $a3) * ($b1 - $a1) - ($c1 - $a1) * ($b3 - $a3); |
|
138 | - $n3 = ($c1 - $a1) * ($b2 - $a2) - ($c2 - $a2) * ($b1 - $a1); |
|
136 | + $n1 = ($c2 - $a2)*($b3 - $a3) - ($c3 - $a3)*($b2 - $a2); |
|
137 | + $n2 = ($c3 - $a3)*($b1 - $a1) - ($c1 - $a1)*($b3 - $a3); |
|
138 | + $n3 = ($c1 - $a1)*($b2 - $a2) - ($c2 - $a2)*($b1 - $a1); |
|
139 | 139 | |
140 | - $d = -$n1 * $a1 - $n2 * $a2 - $n3 * $a3; |
|
141 | - $zN = (-$n1 * $Xn - $n2 * $Yn - $d) / $n3; |
|
140 | + $d = -$n1*$a1 - $n2*$a2 - $n3*$a3; |
|
141 | + $zN = (-$n1*$Xn - $n2*$Yn - $d)/$n3; |
|
142 | 142 | |
143 | 143 | return $zN; |
144 | 144 | } |
145 | 145 | |
146 | 146 | private function getDeg($deg, $numPrefix) { |
147 | 147 | $deg = abs($deg); |
148 | - $d = floor($deg); // round degrees |
|
148 | + $d = floor($deg); // round degrees |
|
149 | 149 | if ($numPrefix >= 3) { |
150 | 150 | if ($d < 100) { |
151 | - $d = '0' . $d; |
|
151 | + $d = '0'.$d; |
|
152 | 152 | } |
153 | 153 | } // pad with leading zeros |
154 | 154 | if ($d < 10) { |
155 | - $d = '0' . $d; |
|
155 | + $d = '0'.$d; |
|
156 | 156 | } |
157 | 157 | return $d; |
158 | 158 | } |
159 | 159 | |
160 | 160 | private function getSec($deg) { |
161 | 161 | $deg = abs($deg); |
162 | - $sec = round($deg * 3600, 4); |
|
163 | - $m = fmod(floor($sec / 60), 60); |
|
162 | + $sec = round($deg*3600, 4); |
|
163 | + $m = fmod(floor($sec/60), 60); |
|
164 | 164 | $s = round(fmod($sec, 60), 4); |
165 | - return ($m * 60) + $s; |
|
165 | + return ($m*60) + $s; |
|
166 | 166 | } |
167 | 167 | |
168 | - public function download($lat,$lon, $debug = false) { |
|
168 | + public function download($lat, $lon, $debug = false) { |
|
169 | 169 | $N = $this->getDeg($lat, 2); |
170 | 170 | $E = $this->getDeg($lon, 3); |
171 | - $fileName = "N{$N}E{$E}.hgt"; |
|
172 | - if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) { |
|
171 | + $fileName = "N{$N}E{$E}.hgt"; |
|
172 | + if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) { |
|
173 | 173 | $Common = new Common(); |
174 | 174 | if ($debug) echo 'Downloading '.$fileName.'.gz ...'; |
175 | - $Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
|
176 | - if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) { |
|
175 | + $Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz'); |
|
176 | + if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz')) { |
|
177 | 177 | if ($debug) echo "File '{$fileName}.gz' not exists."; |
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | if ($debug) echo 'Done'."\n"; |
181 | 181 | if ($debug) echo 'Decompress '.$fileName.' ....'; |
182 | - $Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName); |
|
182 | + $Common->gunzip($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName); |
|
183 | 183 | if ($debug) echo 'Done'."\n"; |
184 | - unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
|
184 | + unlink($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz'); |
|
185 | 185 | } |
186 | 186 | return true; |
187 | 187 | } |
@@ -194,22 +194,22 @@ discard block |
||
194 | 194 | try { |
195 | 195 | $sth = $db->prepare($query); |
196 | 196 | $sth->execute($query_values); |
197 | - } catch(PDOException $e) { |
|
197 | + } catch (PDOException $e) { |
|
198 | 198 | return "error : ".$e->getMessage(); |
199 | 199 | } |
200 | 200 | while ($data = $sth->fetch(PDO::FETCH_ASSOC)) { |
201 | - $this->download($data['latitude'],$data['longitude'],true); |
|
201 | + $this->download($data['latitude'], $data['longitude'], true); |
|
202 | 202 | } |
203 | 203 | $query = 'SELECT latitude, longitude FROM tracker_output WHERE latitude <> 0 AND longitude <> 0 ORDER BY date DESC LIMIT 50'; |
204 | 204 | $query_values = array(); |
205 | 205 | try { |
206 | 206 | $sth = $db->prepare($query); |
207 | 207 | $sth->execute($query_values); |
208 | - } catch(PDOException $e) { |
|
208 | + } catch (PDOException $e) { |
|
209 | 209 | return "error : ".$e->getMessage(); |
210 | 210 | } |
211 | 211 | while ($data = $sth->fetch(PDO::FETCH_ASSOC)) { |
212 | - $this->download($data['latitude'],$data['longitude'],true); |
|
212 | + $this->download($data['latitude'], $data['longitude'], true); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
@@ -16,24 +16,24 @@ discard block |
||
16 | 16 | $sql_date = ''; |
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 | if (strtotime($_GET['start_date']) !== false && strtotime($_GET['end_date']) !== false) { |
21 | 21 | //$start_date = $_GET['start_date']." 00:00:00"; |
22 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
22 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
23 | 23 | //$end_date = $_GET['end_date']." 00:00:00"; |
24 | - $end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
24 | + $end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
25 | 25 | $sql_date = $start_date.",".$end_date; |
26 | 26 | } |
27 | - } else if($_GET['start_date'] != ""){ |
|
27 | + } else if ($_GET['start_date'] != "") { |
|
28 | 28 | if (strtotime($_GET['start_date']) !== false) { |
29 | 29 | //$start_date = $_GET['start_date']." 00:00:00"; |
30 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
30 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
31 | 31 | $sql_date = $start_date; |
32 | 32 | } |
33 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
33 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
34 | 34 | if (strtotime($_GET['end_date']) !== false) { |
35 | 35 | //$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00"; |
36 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
36 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
37 | 37 | $sql_date = $end_date; |
38 | 38 | } |
39 | 39 | } else $sql_date = ''; |
@@ -41,21 +41,21 @@ discard block |
||
41 | 41 | |
42 | 42 | if (isset($_GET['highest_altitude'])) { |
43 | 43 | //for altitude manipulation |
44 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
45 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
46 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
44 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
45 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
46 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
47 | 47 | $sql_altitude = $start_altitude.",".$end_altitude; |
48 | - } else if($_GET['highest_altitude'] != ""){ |
|
49 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
48 | + } else if ($_GET['highest_altitude'] != "") { |
|
49 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
50 | 50 | $sql_altitude = $end_altitude; |
51 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
52 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
51 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
52 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
53 | 53 | $sql_altitude = $start_altitude; |
54 | 54 | } else $sql_altitude = ''; |
55 | 55 | } else $sql_altitude = ''; |
56 | 56 | |
57 | 57 | //calculuation for the pagination |
58 | -if(!isset($_GET['limit'])) |
|
58 | +if (!isset($_GET['limit'])) |
|
59 | 59 | { |
60 | 60 | if (!isset($_GET['number_results'])) |
61 | 61 | { |
@@ -63,45 +63,45 @@ discard block |
||
63 | 63 | $limit_end = 25; |
64 | 64 | $absolute_difference = 25; |
65 | 65 | } else { |
66 | - if ($_GET['number_results'] > 1000){ |
|
66 | + if ($_GET['number_results'] > 1000) { |
|
67 | 67 | $_GET['number_results'] = 1000; |
68 | 68 | } |
69 | 69 | $limit_start = 0; |
70 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
71 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
70 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
71 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
72 | 72 | } |
73 | -} else { |
|
73 | +} else { |
|
74 | 74 | $limit_explode = explode(",", $_GET['limit']); |
75 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
76 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
75 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
76 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
77 | 77 | } |
78 | 78 | $absolute_difference = abs($limit_start - $limit_end); |
79 | 79 | $limit_next = $limit_end + $absolute_difference; |
80 | 80 | $limit_previous_1 = $limit_start - $absolute_difference; |
81 | 81 | $limit_previous_2 = $limit_end - $absolute_difference; |
82 | 82 | |
83 | -if (!empty($_GET)){ |
|
84 | - $q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING); |
|
85 | - $registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING); |
|
86 | - $aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING); |
|
87 | - $manufacturer = filter_input(INPUT_GET, 'manufacturer',FILTER_SANITIZE_STRING); |
|
88 | - $highlights = filter_input(INPUT_GET, 'highlights',FILTER_SANITIZE_STRING); |
|
89 | - $airline = filter_input(INPUT_GET, 'airline',FILTER_SANITIZE_STRING); |
|
90 | - $airline_country = filter_input(INPUT_GET, 'airline_country',FILTER_SANITIZE_STRING); |
|
91 | - $airline_type = filter_input(INPUT_GET, 'airline_type',FILTER_SANITIZE_STRING); |
|
92 | - $airport = filter_input(INPUT_GET, 'airport',FILTER_SANITIZE_STRING); |
|
93 | - $airport_country = filter_input(INPUT_GET, 'airport_country',FILTER_SANITIZE_STRING); |
|
94 | - $callsign = filter_input(INPUT_GET, 'callsign',FILTER_SANITIZE_STRING); |
|
95 | - $owner = filter_input(INPUT_GET, 'owner',FILTER_SANITIZE_STRING); |
|
96 | - $pilot_name = filter_input(INPUT_GET, 'pilot_name',FILTER_SANITIZE_STRING); |
|
97 | - $pilot_id = filter_input(INPUT_GET, 'pilot_id',FILTER_SANITIZE_STRING); |
|
98 | - $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route',FILTER_SANITIZE_STRING); |
|
99 | - $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
100 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
101 | - $archive = filter_input(INPUT_GET,'archive',FILTER_SANITIZE_NUMBER_INT); |
|
102 | - $origlat = filter_input(INPUT_GET,'origlat',FILTER_SANITIZE_NUMBER_FLOAT); |
|
103 | - $origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_NUMBER_FLOAT); |
|
104 | - $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
|
83 | +if (!empty($_GET)) { |
|
84 | + $q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
85 | + $registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
86 | + $aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
87 | + $manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
88 | + $highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
89 | + $airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
90 | + $airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
91 | + $airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
92 | + $airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
93 | + $airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
94 | + $callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
95 | + $owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
96 | + $pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
97 | + $pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
98 | + $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
99 | + $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
100 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
101 | + $archive = filter_input(INPUT_GET, 'archive', FILTER_SANITIZE_NUMBER_INT); |
|
102 | + $origlat = filter_input(INPUT_GET, 'origlat', FILTER_SANITIZE_NUMBER_FLOAT); |
|
103 | + $origlon = filter_input(INPUT_GET, 'origlon', FILTER_SANITIZE_NUMBER_FLOAT); |
|
104 | + $dist = filter_input(INPUT_GET, 'dist', FILTER_SANITIZE_NUMBER_INT); |
|
105 | 105 | if ($dist != '') { |
106 | 106 | if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
107 | 107 | elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | if (!isset($sql_date)) $sql_date = ''; |
110 | 110 | if ($archive == 1) { |
111 | 111 | $SpotterArchive = new SpotterArchive(); |
112 | - $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); |
|
112 | + $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); |
|
113 | 113 | } else { |
114 | - $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); |
|
114 | + $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); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | print '<span class="sub-menu-statistic column mobile">'; |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | //remove 3D=true parameter |
145 | 145 | $no3D = str_replace("&3D=true", "", $_SERVER['QUERY_STRING']); |
146 | 146 | $kmlURL = str_replace("http://", "kml://", $globalURL); |
147 | - if (!isset($_GET['3D'])){ |
|
147 | + if (!isset($_GET['3D'])) { |
|
148 | 148 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'" class="active"><i class="fa fa-table"></i> '._("Table").'</a></li>'; |
149 | 149 | } else { |
150 | 150 | print '<li><span class="notablet"><a href="'.$globalURL.'/search?'.$no3D.'"><i class="fa fa-table"></i> '._("Table").'</a></span></li>'; |
151 | 151 | } |
152 | - if (isset($_GET['3D'])){ |
|
152 | + if (isset($_GET['3D'])) { |
|
153 | 153 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="active"><i class="fa fa-globe"></i> '._("3D Map").'</a></li>'; |
154 | 154 | } else { |
155 | 155 | 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>'; |
@@ -170,30 +170,30 @@ discard block |
||
170 | 170 | print '<div class="column">'; |
171 | 171 | print '<div class="info">'; |
172 | 172 | print '<h1>'._("Search Results for").' '; |
173 | - if (isset($_GET['q']) && $_GET['q'] != ""){ print _("Keyword:").' <span>'.$q.'</span> '; } |
|
174 | - if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
175 | - if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
176 | - if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; } |
|
177 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
178 | - if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; } |
|
179 | - if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
180 | - if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
181 | - if (isset($_GET['airport']) && $_GET['airport'] != ""){ print _("Airport:").' <span>'.$airport.'</span> '; } |
|
182 | - if (isset($_GET['airport_country']) && $_GET['airport_country'] != ""){ print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
183 | - if (isset($_GET['callsign']) && $_GET['callsign'] != ""){ print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
184 | - if (isset($_GET['owner']) && $_GET['owner'] != ""){ print _("Owner:").' <span>'.$owner.'</span> '; } |
|
185 | - if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != ""){ print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
186 | - if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != ""){ print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
187 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")){ print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
188 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
189 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
190 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == ""){ print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
191 | - if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
192 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
193 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == ""){ print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
194 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
195 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
196 | - if (isset($_GET['number_results']) && $_GET['number_results'] != ""){ print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
173 | + if (isset($_GET['q']) && $_GET['q'] != "") { print _("Keyword:").' <span>'.$q.'</span> '; } |
|
174 | + if (isset($_GET['aircraft']) && $_GET['aircraft'] != "") { print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
175 | + if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != "") { print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
176 | + if (isset($_GET['registration']) && $_GET['registration'] != "") { print _("Registration:").' <span>'.$registration.'</span> '; } |
|
177 | + if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
178 | + if (isset($_GET['airline']) && $_GET['airline'] != "") { print _("Airline:").' <span>'.$airline.'</span> '; } |
|
179 | + if (isset($_GET['airline_country']) && $_GET['airline_country'] != "") { print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
180 | + if (isset($_GET['airline_type']) && $_GET['airline_type'] != "") { print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
181 | + if (isset($_GET['airport']) && $_GET['airport'] != "") { print _("Airport:").' <span>'.$airport.'</span> '; } |
|
182 | + if (isset($_GET['airport_country']) && $_GET['airport_country'] != "") { print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
183 | + if (isset($_GET['callsign']) && $_GET['callsign'] != "") { print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
184 | + if (isset($_GET['owner']) && $_GET['owner'] != "") { print _("Owner:").' <span>'.$owner.'</span> '; } |
|
185 | + if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != "") { print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
186 | + if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != "") { print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
187 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")) { print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
188 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
189 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
190 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == "") { print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
191 | + if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
192 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
193 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == "") { print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
194 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
195 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
196 | + if (isset($_GET['number_results']) && $_GET['number_results'] != "") { print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
197 | 197 | print '</h1>'; |
198 | 198 | print '</div>'; |
199 | 199 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | </select> |
301 | 301 | </div> |
302 | 302 | </div> |
303 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
303 | + <script type="text/javascript">getSelect('manufacturer','<?php if (isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
304 | 304 | <div class="form-group"> |
305 | 305 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
306 | 306 | <div class="col-sm-10"> |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | </select> |
310 | 310 | </div> |
311 | 311 | </div> |
312 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
312 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if (isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
313 | 313 | <div class="form-group"> |
314 | 314 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
315 | 315 | <div class="col-sm-10"> |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | </div> |
333 | 333 | </div> |
334 | 334 | <?php |
335 | -}else { |
|
335 | +} else { |
|
336 | 336 | ?> |
337 | 337 | <div class="form-group"> |
338 | 338 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | ?> |
346 | 346 | <div class="form-group"> |
347 | 347 | <div class="col-sm-offset-2 col-sm-10"> |
348 | - <!--<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>--> |
|
349 | - <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> |
|
348 | + <!--<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>--> |
|
349 | + <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> |
|
350 | 350 | </div> |
351 | 351 | </div> |
352 | 352 | </fieldset> |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | </select> |
361 | 361 | </div> |
362 | 362 | </div> |
363 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script> |
|
363 | + <script type="text/javascript">getSelect('airlinenames','<?php if (isset($_GET['airline'])) print $airline; ?>');</script> |
|
364 | 364 | <div class="form-group"> |
365 | 365 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
366 | 366 | <div class="col-sm-10"> |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | </select> |
370 | 370 | </div> |
371 | 371 | </div> |
372 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
372 | + <script type="text/javascript">getSelect('airlinecountries','<?php if (isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
373 | 373 | <div class="form-group"> |
374 | 374 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
375 | 375 | <div class="col-sm-10"> |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | </div> |
379 | 379 | <div class="form-group"> |
380 | 380 | <div class="col-sm-offset-2 col-sm-10"> |
381 | - <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> |
|
382 | - <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> |
|
383 | - <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> |
|
384 | - <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> |
|
381 | + <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> |
|
382 | + <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> |
|
383 | + <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> |
|
384 | + <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> |
|
385 | 385 | </div> |
386 | 386 | </div> |
387 | 387 | </fieldset> |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | </select> |
396 | 396 | </div> |
397 | 397 | </div> |
398 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
398 | + <script type="text/javascript">getSelect('airportnames','<?php if (isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
399 | 399 | <div class="form-group"> |
400 | 400 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
401 | 401 | <div class="col-sm-10"> |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | </select> |
405 | 405 | </div> |
406 | 406 | </div> |
407 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
407 | + <script type="text/javascript">getSelect('airportcountries','<?php if (isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
408 | 408 | </fieldset> |
409 | 409 | <fieldset> |
410 | 410 | <legend><?php echo _("Route"); ?></legend> |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | </select> |
417 | 417 | </div> |
418 | 418 | </div> |
419 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
419 | + <script type="text/javascript">getSelect('departureairportnames','<?php if (isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
420 | 420 | <div class="form-group"> |
421 | 421 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
422 | 422 | <div class="col-sm-10"> |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | </select> |
426 | 426 | </div> |
427 | 427 | </div> |
428 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
428 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if (isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
429 | 429 | </fieldset> |
430 | 430 | <fieldset> |
431 | 431 | <legend><?php echo _("Date"); ?></legend> |
@@ -479,9 +479,9 @@ discard block |
||
479 | 479 | <option></option> |
480 | 480 | <?php |
481 | 481 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
482 | -foreach($altitude_array as $altitude) |
|
482 | +foreach ($altitude_array as $altitude) |
|
483 | 483 | { |
484 | - if(isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
484 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
485 | 485 | { |
486 | 486 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
487 | 487 | } else { |
@@ -499,9 +499,9 @@ discard block |
||
499 | 499 | <option></option> |
500 | 500 | <?php |
501 | 501 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
502 | -foreach($altitude_array as $altitude) |
|
502 | +foreach ($altitude_array as $altitude) |
|
503 | 503 | { |
504 | - if(isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
504 | + if (isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
505 | 505 | { |
506 | 506 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
507 | 507 | } else { |
@@ -540,10 +540,10 @@ discard block |
||
540 | 540 | <div class="col-sm-10"> |
541 | 541 | <select class="form-control" name="number_results"> |
542 | 542 | <?php |
543 | -$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
544 | -foreach($number_results_array as $number) |
|
543 | +$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
544 | +foreach ($number_results_array as $number) |
|
545 | 545 | { |
546 | - if(isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
546 | + if (isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
547 | 547 | { |
548 | 548 | print '<option value="'.$number.'" selected="selected">'.$number.'</option>'; |
549 | 549 | } else { |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | <fieldset> |
563 | 563 | <div class="form-group"> |
564 | 564 | <div class="col-sm-offset-2 col-sm-10"> |
565 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
565 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
566 | 566 | <p class="help-block">Disabled in demo</p> |
567 | 567 | </div> |
568 | 568 | </div> |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | <fieldset> |
574 | 574 | <div class="form-group"> |
575 | 575 | <div class="col-sm-offset-2 col-sm-10"> |
576 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
576 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
577 | 577 | </div> |
578 | 578 | </div> |
579 | 579 | </fieldset> |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | require_once('require/class.Satellite.php'); |
6 | 6 | |
7 | -$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING); |
|
7 | +$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING); |
|
8 | 8 | if ($trackident != '') { |
9 | 9 | require_once('require/class.SpotterLive.php'); |
10 | 10 | $SpotterLive = new SpotterLive(); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident); |
15 | 15 | header('Location: '.$globalURL.'/flightid/'.$spotterid); |
16 | 16 | } else { |
17 | - setcookie('MapTrack',$resulttrackident[0]['flightaware_id']); |
|
17 | + setcookie('MapTrack', $resulttrackident[0]['flightaware_id']); |
|
18 | 18 | } |
19 | 19 | } else { |
20 | 20 | unset($_COOKIE['MapTrack']); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | <div class="form-group"> |
195 | 195 | <label>From (UTC):</label> |
196 | 196 | <div class='input-group date' id='datetimepicker1'> |
197 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> |
|
197 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a", $_COOKIE['archive_begin']); ?>" required /> |
|
198 | 198 | <span class="input-group-addon"> |
199 | 199 | <span class="glyphicon glyphicon-calendar"></span> |
200 | 200 | </span> |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | <div class="form-group"> |
204 | 204 | <label>To (UTC):</label> |
205 | 205 | <div class='input-group date' id='datetimepicker2'> |
206 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" /> |
|
206 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a", $_COOKIE['archive_end']); ?>" /> |
|
207 | 207 | <span class="input-group-addon"> |
208 | 208 | <span class="glyphicon glyphicon-calendar"></span> |
209 | 209 | </span> |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | <li><?php echo _("Type of Terrain:"); ?> |
328 | 328 | <select class="selectpicker" onchange="terrainType(this);"> |
329 | 329 | <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
330 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
331 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
332 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
330 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option> |
|
331 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option> |
|
332 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option> |
|
333 | 333 | </select> |
334 | 334 | </li> |
335 | 335 | <?php |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
366 | 366 | <?php |
367 | 367 | } |
368 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
368 | + if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) { |
|
369 | 369 | ?> |
370 | 370 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
371 | 371 | <?php |
@@ -541,10 +541,10 @@ discard block |
||
541 | 541 | $Spotter = new Spotter(); |
542 | 542 | $allairlinenames = $Spotter->getAllAirlineNames(); |
543 | 543 | } |
544 | - foreach($allairlinenames as $airline) { |
|
544 | + foreach ($allairlinenames as $airline) { |
|
545 | 545 | $airline_name = $airline['airline_name']; |
546 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
547 | - if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
|
546 | + if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...'; |
|
547 | + if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) { |
|
548 | 548 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
549 | 549 | } else { |
550 | 550 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
564 | 564 | <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
565 | 565 | <?php |
566 | - foreach($allalliancenames as $alliance) { |
|
566 | + foreach ($allalliancenames as $alliance) { |
|
567 | 567 | $alliance_name = $alliance['alliance']; |
568 | 568 | if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) { |
569 | 569 | echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>'; |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | */ |
600 | 600 | $Source = new Source(); |
601 | 601 | $datasource = $Source->getLocationInfoByType('gs'); |
602 | - foreach($datasource as $src) { |
|
603 | - if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) { |
|
602 | + foreach ($datasource as $src) { |
|
603 | + if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) { |
|
604 | 604 | echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>'; |
605 | 605 | } else { |
606 | 606 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
680 | 680 | else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
681 | 681 | |
682 | - if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
|
682 | + if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) { |
|
683 | 683 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
684 | 684 | } else { |
685 | 685 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | |
6 | -if (!isset($_GET['country'])){ |
|
6 | +if (!isset($_GET['country'])) { |
|
7 | 7 | header('Location: '.$globalURL.''); |
8 | 8 | } else { |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | //calculuation for the pagination |
11 | - if(!isset($_GET['limit'])) |
|
11 | + if (!isset($_GET['limit'])) |
|
12 | 12 | { |
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
15 | 15 | $absolute_difference = 25; |
16 | - } else { |
|
16 | + } else { |
|
17 | 17 | $limit_explode = explode(",", $_GET['limit']); |
18 | 18 | $limit_start = $limit_explode[0]; |
19 | 19 | $limit_end = $limit_explode[1]; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $country = ucwords(str_replace("-", " ", $_GET['country'])); |
31 | 31 | |
32 | 32 | $page_url = $globalURL.'/country/'.$_GET['country']; |
33 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
33 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
34 | 34 | if ($country == 'Na') { |
35 | 35 | $spotter_array = array(); |
36 | 36 | } else { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | if (!empty($spotter_array)) |
45 | 45 | { |
46 | - $title = sprintf(_("Detailed View for Airports & Airlines from %s"),$country); |
|
46 | + $title = sprintf(_("Detailed View for Airports & Airlines from %s"), $country); |
|
47 | 47 | |
48 | 48 | require_once('header.php'); |
49 | 49 | print '<div class="select-item">'; |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | print '<select name="country" class="selectpicker" data-live-search="true">'; |
52 | 52 | print '<option></option>'; |
53 | 53 | $all_countries = $Spotter->getAllCountries(); |
54 | - foreach($all_countries as $all_country) |
|
54 | + foreach ($all_countries as $all_country) |
|
55 | 55 | { |
56 | - if($country == $all_country['country']) |
|
56 | + if ($country == $all_country['country']) |
|
57 | 57 | { |
58 | 58 | print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>'; |
59 | 59 | } else { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | if ($_GET['country'] != "NA") |
69 | 69 | { |
70 | 70 | print '<div class="info column">'; |
71 | - print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>'; |
|
71 | + print '<h1>'.sprintf(_("Airports & Airlines from %s"), $country).'</h1>'; |
|
72 | 72 | print '</div>'; |
73 | 73 | } else { |
74 | 74 | print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>'; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | include('country-sub-menu.php'); |
78 | 78 | print '<div class="table column">'; |
79 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure & arrival) OR airlines from <strong>%s</strong>."),$country).'</p>'; |
|
79 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure & arrival) OR airlines from <strong>%s</strong>."), $country).'</p>'; |
|
80 | 80 | |
81 | 81 | include('table-output.php'); |
82 | 82 | print '<div class="pagination">'; |