|
@@ -13,33 +13,33 @@ discard block |
|
|
block discarded – undo |
|
13
|
13
|
* @param Array $filter the filter |
|
14
|
14
|
* @return Array the SQL part |
|
15
|
15
|
*/ |
|
16
|
|
- public function getFilter($filter = array(),$where = false,$and = false) { |
|
|
16
|
+ public function getFilter($filter = array(), $where = false, $and = false) { |
|
17
|
17
|
global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
|
18
|
18
|
$filters = array(); |
|
19
|
19
|
if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
|
20
|
20
|
if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
|
21
|
21
|
$filters = $globalStatsFilters[$globalFilterName]; |
|
22
|
22
|
} else { |
|
23
|
|
- $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
|
23
|
+ $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
24
|
24
|
} |
|
25
|
25
|
} |
|
26
|
26
|
if (isset($filter[0]['source'])) { |
|
27
|
|
- $filters = array_merge($filters,$filter); |
|
|
27
|
+ $filters = array_merge($filters, $filter); |
|
28
|
28
|
} |
|
29
|
|
- if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
|
29
|
+ if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
30
|
30
|
$filter_query_join = ''; |
|
31
|
31
|
$filter_query_where = ''; |
|
32
|
|
- foreach($filters as $flt) { |
|
|
32
|
+ foreach ($filters as $flt) { |
|
33
|
33
|
if (isset($flt['idents']) && !empty($flt['idents'])) { |
|
34
|
34
|
if (isset($flt['source'])) { |
|
35
|
|
- $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"; |
|
|
35
|
+ $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
|
36
|
} else { |
|
37
|
|
- $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"; |
|
|
37
|
+ $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
|
38
|
} |
|
39
|
39
|
} |
|
40
|
40
|
} |
|
41
|
41
|
if (isset($filter['source']) && !empty($filter['source'])) { |
|
42
|
|
- $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
|
42
|
+ $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
43
|
43
|
} |
|
44
|
44
|
if (isset($filter['ident']) && !empty($filter['ident'])) { |
|
45
|
45
|
$filter_query_where .= " AND ident = '".$filter['ident']."'"; |
|
@@ -67,22 +67,22 @@ discard block |
|
|
block discarded – undo |
|
67
|
67
|
$filter_query_date .= " AND EXTRACT(DAY FROM tracker_archive_output.date) = '".$filter['day']."'"; |
|
68
|
68
|
} |
|
69
|
69
|
} |
|
70
|
|
- $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"; |
|
|
70
|
+ $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
|
71
|
} |
|
72
|
72
|
if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
73
|
|
- $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
|
73
|
+ $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
74
|
74
|
} |
|
75
|
75
|
if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
76
|
76
|
elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
77
|
77
|
if ($filter_query_where != '') { |
|
78
|
|
- $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
|
78
|
+ $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
79
|
79
|
} |
|
80
|
80
|
$filter_query = $filter_query_join.$filter_query_where; |
|
81
|
81
|
return $filter_query; |
|
82
|
82
|
} |
|
83
|
83
|
|
|
84
|
84
|
// tracker_archive |
|
85
|
|
- public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') { |
|
|
85
|
+ public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') { |
|
86
|
86
|
/* |
|
87
|
87
|
require_once(dirname(__FILE__).'/class.Tracker.php'); |
|
88
|
88
|
if ($over_country == '') { |
|
@@ -94,14 +94,14 @@ discard block |
|
|
block discarded – undo |
|
94
|
94
|
*/ |
|
95
|
95
|
$country = $over_country; |
|
96
|
96
|
// Route is not added in tracker_archive |
|
97
|
|
- $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
|
97
|
+ $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
98
|
98
|
VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
|
99
|
|
- $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); |
|
|
99
|
+ $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); |
|
100
|
100
|
try { |
|
101
|
101
|
$sth = $this->db->prepare($query); |
|
102
|
102
|
$sth->execute($query_values); |
|
103
|
103
|
$sth->closeCursor(); |
|
104
|
|
- } catch(PDOException $e) { |
|
|
104
|
+ } catch (PDOException $e) { |
|
105
|
105
|
return "error : ".$e->getMessage(); |
|
106
|
106
|
} |
|
107
|
107
|
return "success"; |
|
@@ -121,9 +121,9 @@ discard block |
|
|
block discarded – undo |
|
121
|
121
|
|
|
122
|
122
|
$ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
123
|
123
|
//$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"; |
|
124
|
|
- $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
|
124
|
+ $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
125
|
125
|
|
|
126
|
|
- $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
|
126
|
+ $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident)); |
|
127
|
127
|
|
|
128
|
128
|
return $spotter_array; |
|
129
|
129
|
} |
|
@@ -142,7 +142,7 @@ discard block |
|
|
block discarded – undo |
|
142
|
142
|
$id = filter_var($id, FILTER_SANITIZE_STRING); |
|
143
|
143
|
//$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
|
144
|
144
|
//$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"; |
|
145
|
|
- $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
|
145
|
+ $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
146
|
146
|
|
|
147
|
147
|
// $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
|
148
|
148
|
/* |
|
@@ -155,7 +155,7 @@ discard block |
|
|
block discarded – undo |
|
155
|
155
|
} |
|
156
|
156
|
$spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
|
157
|
157
|
*/ |
|
158
|
|
- $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
|
158
|
+ $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id)); |
|
159
|
159
|
|
|
160
|
160
|
return $spotter_array; |
|
161
|
161
|
} |
|
@@ -170,14 +170,14 @@ discard block |
|
|
block discarded – undo |
|
170
|
170
|
{ |
|
171
|
171
|
date_default_timezone_set('UTC'); |
|
172
|
172
|
$id = filter_var($id, FILTER_SANITIZE_STRING); |
|
173
|
|
- $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
|
173
|
+ $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
174
|
174
|
|
|
175
|
175
|
// $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
|
176
|
176
|
|
|
177
|
177
|
try { |
|
178
|
178
|
$sth = $this->db->prepare($query); |
|
179
|
179
|
$sth->execute(array(':id' => $id)); |
|
180
|
|
- } catch(PDOException $e) { |
|
|
180
|
+ } catch (PDOException $e) { |
|
181
|
181
|
echo $e->getMessage(); |
|
182
|
182
|
die; |
|
183
|
183
|
} |
|
@@ -196,14 +196,14 @@ discard block |
|
|
block discarded – undo |
|
196
|
196
|
{ |
|
197
|
197
|
date_default_timezone_set('UTC'); |
|
198
|
198
|
$id = filter_var($id, FILTER_SANITIZE_STRING); |
|
199
|
|
- $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
|
199
|
+ $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
200
|
200
|
|
|
201
|
201
|
// $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
|
202
|
202
|
|
|
203
|
203
|
try { |
|
204
|
204
|
$sth = $this->db->prepare($query); |
|
205
|
205
|
$sth->execute(array(':id' => $id)); |
|
206
|
|
- } catch(PDOException $e) { |
|
|
206
|
+ } catch (PDOException $e) { |
|
207
|
207
|
echo $e->getMessage(); |
|
208
|
208
|
die; |
|
209
|
209
|
} |
|
@@ -225,12 +225,12 @@ discard block |
|
|
block discarded – undo |
|
225
|
225
|
date_default_timezone_set('UTC'); |
|
226
|
226
|
|
|
227
|
227
|
$ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
228
|
|
- $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"; |
|
|
228
|
+ $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"; |
|
229
|
229
|
|
|
230
|
230
|
try { |
|
231
|
231
|
$sth = $this->db->prepare($query); |
|
232
|
232
|
$sth->execute(array(':ident' => $ident)); |
|
233
|
|
- } catch(PDOException $e) { |
|
|
233
|
+ } catch (PDOException $e) { |
|
234
|
234
|
echo $e->getMessage(); |
|
235
|
235
|
die; |
|
236
|
236
|
} |
|
@@ -251,12 +251,12 @@ discard block |
|
|
block discarded – undo |
|
251
|
251
|
date_default_timezone_set('UTC'); |
|
252
|
252
|
|
|
253
|
253
|
$id = filter_var($id, FILTER_SANITIZE_STRING); |
|
254
|
|
- $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"; |
|
|
254
|
+ $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"; |
|
255
|
255
|
|
|
256
|
256
|
try { |
|
257
|
257
|
$sth = $this->db->prepare($query); |
|
258
|
258
|
$sth->execute(array(':id' => $id)); |
|
259
|
|
- } catch(PDOException $e) { |
|
|
259
|
+ } catch (PDOException $e) { |
|
260
|
260
|
echo $e->getMessage(); |
|
261
|
261
|
die; |
|
262
|
262
|
} |
|
@@ -277,12 +277,12 @@ discard block |
|
|
block discarded – undo |
|
277
|
277
|
date_default_timezone_set('UTC'); |
|
278
|
278
|
|
|
279
|
279
|
$id = filter_var($id, FILTER_SANITIZE_STRING); |
|
280
|
|
- $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
|
280
|
+ $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
281
|
281
|
|
|
282
|
282
|
try { |
|
283
|
283
|
$sth = $this->db->prepare($query); |
|
284
|
284
|
$sth->execute(array(':id' => $id)); |
|
285
|
|
- } catch(PDOException $e) { |
|
|
285
|
+ } catch (PDOException $e) { |
|
286
|
286
|
echo $e->getMessage(); |
|
287
|
287
|
die; |
|
288
|
288
|
} |
|
@@ -304,13 +304,13 @@ discard block |
|
|
block discarded – undo |
|
304
|
304
|
date_default_timezone_set('UTC'); |
|
305
|
305
|
|
|
306
|
306
|
$ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
307
|
|
- $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"; |
|
|
307
|
+ $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"; |
|
308
|
308
|
// $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident"; |
|
309
|
309
|
|
|
310
|
310
|
try { |
|
311
|
311
|
$sth = $this->db->prepare($query); |
|
312
|
312
|
$sth->execute(array(':ident' => $ident)); |
|
313
|
|
- } catch(PDOException $e) { |
|
|
313
|
+ } catch (PDOException $e) { |
|
314
|
314
|
echo $e->getMessage(); |
|
315
|
315
|
die; |
|
316
|
316
|
} |
|
@@ -327,13 +327,13 @@ discard block |
|
|
block discarded – undo |
|
327
|
327
|
* @return Array the spotter information |
|
328
|
328
|
* |
|
329
|
329
|
*/ |
|
330
|
|
- public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
|
330
|
+ public function getTrackerArchiveData($ident, $famtrackid, $date) |
|
331
|
331
|
{ |
|
332
|
332
|
$Tracker = new Tracker($this->db); |
|
333
|
333
|
$ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
334
|
|
- $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"; |
|
|
334
|
+ $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"; |
|
335
|
335
|
|
|
336
|
|
- $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
|
336
|
+ $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':famtrackid' => $famtrackid, ':date' => $date.'%')); |
|
337
|
337
|
|
|
338
|
338
|
return $spotter_array; |
|
339
|
339
|
} |
|
@@ -346,7 +346,7 @@ discard block |
|
|
block discarded – undo |
|
346
|
346
|
try { |
|
347
|
347
|
$sth = $this->db->prepare($query); |
|
348
|
348
|
$sth->execute(); |
|
349
|
|
- } catch(PDOException $e) { |
|
|
349
|
+ } catch (PDOException $e) { |
|
350
|
350
|
echo $e->getMessage(); |
|
351
|
351
|
die; |
|
352
|
352
|
} |
|
@@ -358,24 +358,24 @@ discard block |
|
|
block discarded – undo |
|
358
|
358
|
* @return Array the spotter information |
|
359
|
359
|
* |
|
360
|
360
|
*/ |
|
361
|
|
- public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
|
361
|
+ public function getMinLiveTrackerData($begindate, $enddate, $filter = array()) |
|
362
|
362
|
{ |
|
363
|
363
|
global $globalDBdriver, $globalLiveInterval; |
|
364
|
364
|
date_default_timezone_set('UTC'); |
|
365
|
365
|
|
|
366
|
366
|
$filter_query = ''; |
|
367
|
367
|
if (isset($filter['source']) && !empty($filter['source'])) { |
|
368
|
|
- $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
|
368
|
+ $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
369
|
369
|
} |
|
370
|
370
|
// Use spotter_output also ? |
|
371
|
371
|
if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
372
|
|
- $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 "; |
|
|
372
|
+ $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 "; |
|
373
|
373
|
} |
|
374
|
374
|
if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
375
|
375
|
$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 "; |
|
376
|
376
|
} |
|
377
|
377
|
if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
378
|
|
- $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
|
378
|
+ $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
379
|
379
|
} |
|
380
|
380
|
|
|
381
|
381
|
//if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
@@ -394,14 +394,14 @@ discard block |
|
|
block discarded – undo |
|
394
|
394
|
GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid |
|
395
|
395
|
AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
|
396
|
396
|
*/ |
|
397
|
|
- $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 |
|
|
397
|
+ $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 |
|
398
|
398
|
FROM tracker_archive |
|
399
|
399
|
INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
|
400
|
400
|
WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
|
401
|
401
|
'.$filter_query.' ORDER BY famtrackid'; |
|
402
|
402
|
} else { |
|
403
|
403
|
//$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'; |
|
404
|
|
- $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 |
|
|
404
|
+ $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 |
|
405
|
405
|
FROM tracker_archive |
|
406
|
406
|
INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
|
407
|
407
|
WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".' |
|
@@ -411,7 +411,7 @@ discard block |
|
|
block discarded – undo |
|
411
|
411
|
try { |
|
412
|
412
|
$sth = $this->db->prepare($query); |
|
413
|
413
|
$sth->execute(); |
|
414
|
|
- } catch(PDOException $e) { |
|
|
414
|
+ } catch (PDOException $e) { |
|
415
|
415
|
echo $e->getMessage(); |
|
416
|
416
|
die; |
|
417
|
417
|
} |
|
@@ -426,24 +426,24 @@ discard block |
|
|
block discarded – undo |
|
426
|
426
|
* @return Array the spotter information |
|
427
|
427
|
* |
|
428
|
428
|
*/ |
|
429
|
|
- public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
|
429
|
+ public function getMinLiveTrackerDataPlayback($begindate, $enddate, $filter = array()) |
|
430
|
430
|
{ |
|
431
|
431
|
global $globalDBdriver, $globalLiveInterval; |
|
432
|
432
|
date_default_timezone_set('UTC'); |
|
433
|
433
|
|
|
434
|
434
|
$filter_query = ''; |
|
435
|
435
|
if (isset($filter['source']) && !empty($filter['source'])) { |
|
436
|
|
- $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
|
436
|
+ $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
437
|
437
|
} |
|
438
|
438
|
// Should use spotter_output also ? |
|
439
|
439
|
if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
440
|
|
- $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 "; |
|
|
440
|
+ $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 "; |
|
441
|
441
|
} |
|
442
|
442
|
if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
443
|
443
|
$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 "; |
|
444
|
444
|
} |
|
445
|
445
|
if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
446
|
|
- $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
|
446
|
+ $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
447
|
447
|
} |
|
448
|
448
|
|
|
449
|
449
|
//if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
@@ -453,7 +453,7 @@ discard block |
|
|
block discarded – undo |
|
453
|
453
|
FROM tracker_archive |
|
454
|
454
|
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'; |
|
455
|
455
|
*/ |
|
456
|
|
- $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 |
|
|
456
|
+ $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 |
|
457
|
457
|
FROM tracker_archive_output |
|
458
|
458
|
LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive_output.aircraft_icao = a.icao |
|
459
|
459
|
WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
|
@@ -468,7 +468,7 @@ discard block |
|
|
block discarded – undo |
|
468
|
468
|
WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
|
469
|
469
|
'.$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'; |
|
470
|
470
|
*/ |
|
471
|
|
- $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 |
|
|
471
|
+ $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 |
|
472
|
472
|
FROM tracker_archive_output |
|
473
|
473
|
INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
|
474
|
474
|
WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
|
@@ -480,7 +480,7 @@ discard block |
|
|
block discarded – undo |
|
480
|
480
|
try { |
|
481
|
481
|
$sth = $this->db->prepare($query); |
|
482
|
482
|
$sth->execute(); |
|
483
|
|
- } catch(PDOException $e) { |
|
|
483
|
+ } catch (PDOException $e) { |
|
484
|
484
|
echo $e->getMessage(); |
|
485
|
485
|
die; |
|
486
|
486
|
} |
|
@@ -495,23 +495,23 @@ discard block |
|
|
block discarded – undo |
|
495
|
495
|
* @return Array the spotter information |
|
496
|
496
|
* |
|
497
|
497
|
*/ |
|
498
|
|
- public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
|
498
|
+ public function getLiveTrackerCount($begindate, $enddate, $filter = array()) |
|
499
|
499
|
{ |
|
500
|
500
|
global $globalDBdriver, $globalLiveInterval; |
|
501
|
501
|
date_default_timezone_set('UTC'); |
|
502
|
502
|
|
|
503
|
503
|
$filter_query = ''; |
|
504
|
504
|
if (isset($filter['source']) && !empty($filter['source'])) { |
|
505
|
|
- $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
|
505
|
+ $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
506
|
506
|
} |
|
507
|
507
|
if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
508
|
|
- $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 "; |
|
|
508
|
+ $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 "; |
|
509
|
509
|
} |
|
510
|
510
|
if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
511
|
511
|
$filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
512
|
512
|
} |
|
513
|
513
|
if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
514
|
|
- $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
|
514
|
+ $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
515
|
515
|
} |
|
516
|
516
|
|
|
517
|
517
|
//if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
@@ -526,7 +526,7 @@ discard block |
|
|
block discarded – undo |
|
526
|
526
|
try { |
|
527
|
527
|
$sth = $this->db->prepare($query); |
|
528
|
528
|
$sth->execute(); |
|
529
|
|
- } catch(PDOException $e) { |
|
|
529
|
+ } catch (PDOException $e) { |
|
530
|
530
|
echo $e->getMessage(); |
|
531
|
531
|
die; |
|
532
|
532
|
} |
|
@@ -546,7 +546,7 @@ discard block |
|
|
block discarded – undo |
|
546
|
546
|
* @return Array the spotter information |
|
547
|
547
|
* |
|
548
|
548
|
*/ |
|
549
|
|
- 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()) |
|
|
549
|
+ 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()) |
|
550
|
550
|
{ |
|
551
|
551
|
global $globalTimezone, $globalDBdriver; |
|
552
|
552
|
require_once(dirname(__FILE__).'/class.Translation.php'); |
|
@@ -568,7 +568,7 @@ discard block |
|
|
block discarded – undo |
|
568
|
568
|
|
|
569
|
569
|
$q_array = explode(" ", $q); |
|
570
|
570
|
|
|
571
|
|
- foreach ($q_array as $q_item){ |
|
|
571
|
+ foreach ($q_array as $q_item) { |
|
572
|
572
|
$additional_query .= " AND ("; |
|
573
|
573
|
$additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
574
|
574
|
$additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
@@ -600,7 +600,7 @@ discard block |
|
|
block discarded – undo |
|
600
|
600
|
|
|
601
|
601
|
if ($registration != "") |
|
602
|
602
|
{ |
|
603
|
|
- $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
|
603
|
+ $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
604
|
604
|
if (!is_string($registration)) |
|
605
|
605
|
{ |
|
606
|
606
|
return false; |
|
@@ -611,7 +611,7 @@ discard block |
|
|
block discarded – undo |
|
611
|
611
|
|
|
612
|
612
|
if ($aircraft_icao != "") |
|
613
|
613
|
{ |
|
614
|
|
- $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
|
614
|
+ $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
615
|
615
|
if (!is_string($aircraft_icao)) |
|
616
|
616
|
{ |
|
617
|
617
|
return false; |
|
@@ -622,7 +622,7 @@ discard block |
|
|
block discarded – undo |
|
622
|
622
|
|
|
623
|
623
|
if ($aircraft_manufacturer != "") |
|
624
|
624
|
{ |
|
625
|
|
- $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
|
625
|
+ $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
626
|
626
|
if (!is_string($aircraft_manufacturer)) |
|
627
|
627
|
{ |
|
628
|
628
|
return false; |
|
@@ -643,7 +643,7 @@ discard block |
|
|
block discarded – undo |
|
643
|
643
|
|
|
644
|
644
|
if ($airline_icao != "") |
|
645
|
645
|
{ |
|
646
|
|
- $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
|
646
|
+ $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
647
|
647
|
if (!is_string($airline_icao)) |
|
648
|
648
|
{ |
|
649
|
649
|
return false; |
|
@@ -654,7 +654,7 @@ discard block |
|
|
block discarded – undo |
|
654
|
654
|
|
|
655
|
655
|
if ($airline_country != "") |
|
656
|
656
|
{ |
|
657
|
|
- $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
|
657
|
+ $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
658
|
658
|
if (!is_string($airline_country)) |
|
659
|
659
|
{ |
|
660
|
660
|
return false; |
|
@@ -665,7 +665,7 @@ discard block |
|
|
block discarded – undo |
|
665
|
665
|
|
|
666
|
666
|
if ($airline_type != "") |
|
667
|
667
|
{ |
|
668
|
|
- $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
|
668
|
+ $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
669
|
669
|
if (!is_string($airline_type)) |
|
670
|
670
|
{ |
|
671
|
671
|
return false; |
|
@@ -687,7 +687,7 @@ discard block |
|
|
block discarded – undo |
|
687
|
687
|
|
|
688
|
688
|
if ($airport != "") |
|
689
|
689
|
{ |
|
690
|
|
- $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
|
690
|
+ $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
691
|
691
|
if (!is_string($airport)) |
|
692
|
692
|
{ |
|
693
|
693
|
return false; |
|
@@ -698,7 +698,7 @@ discard block |
|
|
block discarded – undo |
|
698
|
698
|
|
|
699
|
699
|
if ($airport_country != "") |
|
700
|
700
|
{ |
|
701
|
|
- $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
|
701
|
+ $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
702
|
702
|
if (!is_string($airport_country)) |
|
703
|
703
|
{ |
|
704
|
704
|
return false; |
|
@@ -709,7 +709,7 @@ discard block |
|
|
block discarded – undo |
|
709
|
709
|
|
|
710
|
710
|
if ($callsign != "") |
|
711
|
711
|
{ |
|
712
|
|
- $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
|
712
|
+ $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
713
|
713
|
if (!is_string($callsign)) |
|
714
|
714
|
{ |
|
715
|
715
|
return false; |
|
@@ -717,7 +717,7 @@ discard block |
|
|
block discarded – undo |
|
717
|
717
|
$translate = $Translation->ident2icao($callsign); |
|
718
|
718
|
if ($translate != $callsign) { |
|
719
|
719
|
$additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)"; |
|
720
|
|
- $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
|
720
|
+ $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
721
|
721
|
} else { |
|
722
|
722
|
$additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')"; |
|
723
|
723
|
} |
|
@@ -726,7 +726,7 @@ discard block |
|
|
block discarded – undo |
|
726
|
726
|
|
|
727
|
727
|
if ($owner != "") |
|
728
|
728
|
{ |
|
729
|
|
- $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
|
729
|
+ $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
730
|
730
|
if (!is_string($owner)) |
|
731
|
731
|
{ |
|
732
|
732
|
return false; |
|
@@ -737,7 +737,7 @@ discard block |
|
|
block discarded – undo |
|
737
|
737
|
|
|
738
|
738
|
if ($pilot_name != "") |
|
739
|
739
|
{ |
|
740
|
|
- $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
|
740
|
+ $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
741
|
741
|
if (!is_string($pilot_name)) |
|
742
|
742
|
{ |
|
743
|
743
|
return false; |
|
@@ -748,7 +748,7 @@ discard block |
|
|
block discarded – undo |
|
748
|
748
|
|
|
749
|
749
|
if ($pilot_id != "") |
|
750
|
750
|
{ |
|
751
|
|
- $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
|
751
|
+ $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
752
|
752
|
if (!is_string($pilot_id)) |
|
753
|
753
|
{ |
|
754
|
754
|
return false; |
|
@@ -759,7 +759,7 @@ discard block |
|
|
block discarded – undo |
|
759
|
759
|
|
|
760
|
760
|
if ($departure_airport_route != "") |
|
761
|
761
|
{ |
|
762
|
|
- $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
|
762
|
+ $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
763
|
763
|
if (!is_string($departure_airport_route)) |
|
764
|
764
|
{ |
|
765
|
765
|
return false; |
|
@@ -770,7 +770,7 @@ discard block |
|
|
block discarded – undo |
|
770
|
770
|
|
|
771
|
771
|
if ($arrival_airport_route != "") |
|
772
|
772
|
{ |
|
773
|
|
- $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
|
773
|
+ $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
774
|
774
|
if (!is_string($arrival_airport_route)) |
|
775
|
775
|
{ |
|
776
|
776
|
return false; |
|
@@ -783,8 +783,8 @@ discard block |
|
|
block discarded – undo |
|
783
|
783
|
{ |
|
784
|
784
|
$altitude_array = explode(",", $altitude); |
|
785
|
785
|
|
|
786
|
|
- $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
787
|
|
- $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
|
786
|
+ $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
|
787
|
+ $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
788
|
788
|
|
|
789
|
789
|
|
|
790
|
790
|
if ($altitude_array[1] != "") |
|
@@ -802,8 +802,8 @@ discard block |
|
|
block discarded – undo |
|
802
|
802
|
{ |
|
803
|
803
|
$date_array = explode(",", $date_posted); |
|
804
|
804
|
|
|
805
|
|
- $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
806
|
|
- $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
|
805
|
+ $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
|
806
|
+ $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
807
|
807
|
|
|
808
|
808
|
if ($globalTimezone != '') { |
|
809
|
809
|
date_default_timezone_set($globalTimezone); |
|
@@ -835,8 +835,8 @@ discard block |
|
|
block discarded – undo |
|
835
|
835
|
{ |
|
836
|
836
|
$limit_array = explode(",", $limit); |
|
837
|
837
|
|
|
838
|
|
- $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
839
|
|
- $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
|
838
|
+ $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
|
839
|
+ $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
840
|
840
|
|
|
841
|
841
|
if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
842
|
842
|
{ |
|
@@ -847,8 +847,8 @@ discard block |
|
|
block discarded – undo |
|
847
|
847
|
|
|
848
|
848
|
|
|
849
|
849
|
if ($origLat != "" && $origLon != "" && $dist != "") { |
|
850
|
|
- $dist = number_format($dist*0.621371,2,'.',''); |
|
851
|
|
- $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
|
+ $dist = number_format($dist*0.621371, 2, '.', ''); |
|
|
851
|
+ $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 |
|
852
|
852
|
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)) |
|
853
|
853
|
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"; |
|
854
|
854
|
} else { |
|
@@ -865,12 +865,12 @@ discard block |
|
|
block discarded – undo |
|
865
|
865
|
$additional_query .= " AND (tracker_archive_output.waypoints <> '')"; |
|
866
|
866
|
} |
|
867
|
867
|
|
|
868
|
|
- $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
|
868
|
+ $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
869
|
869
|
WHERE tracker_archive_output.ident <> '' |
|
870
|
870
|
".$additional_query." |
|
871
|
871
|
".$filter_query.$orderby_query; |
|
872
|
872
|
} |
|
873
|
|
- $spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query); |
|
|
873
|
+ $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
|
874
|
874
|
|
|
875
|
875
|
return $spotter_array; |
|
876
|
876
|
} |
|
@@ -887,7 +887,7 @@ discard block |
|
|
block discarded – undo |
|
887
|
887
|
try { |
|
888
|
888
|
$sth = $this->db->prepare($query); |
|
889
|
889
|
$sth->execute(); |
|
890
|
|
- } catch(PDOException $e) { |
|
|
890
|
+ } catch (PDOException $e) { |
|
891
|
891
|
return "error"; |
|
892
|
892
|
} |
|
893
|
893
|
} |
|
@@ -924,8 +924,8 @@ discard block |
|
|
block discarded – undo |
|
924
|
924
|
{ |
|
925
|
925
|
$limit_array = explode(",", $limit); |
|
926
|
926
|
|
|
927
|
|
- $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
928
|
|
- $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
|
927
|
+ $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
|
928
|
+ $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
929
|
929
|
|
|
930
|
930
|
if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
931
|
931
|
{ |
|
@@ -966,7 +966,7 @@ discard block |
|
|
block discarded – undo |
|
966
|
966
|
$query_values = array(); |
|
967
|
967
|
$limit_query = ''; |
|
968
|
968
|
$additional_query = ''; |
|
969
|
|
- $filter_query = $this->getFilter($filter,true,true); |
|
|
969
|
+ $filter_query = $this->getFilter($filter, true, true); |
|
970
|
970
|
|
|
971
|
971
|
if ($owner != "") |
|
972
|
972
|
{ |
|
@@ -983,8 +983,8 @@ discard block |
|
|
block discarded – undo |
|
983
|
983
|
{ |
|
984
|
984
|
$limit_array = explode(",", $limit); |
|
985
|
985
|
|
|
986
|
|
- $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
987
|
|
- $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
|
986
|
+ $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
|
987
|
+ $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
988
|
988
|
|
|
989
|
989
|
if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
990
|
990
|
{ |
|
@@ -1024,7 +1024,7 @@ discard block |
|
|
block discarded – undo |
|
1024
|
1024
|
$query_values = array(); |
|
1025
|
1025
|
$limit_query = ''; |
|
1026
|
1026
|
$additional_query = ''; |
|
1027
|
|
- $filter_query = $this->getFilter($filter,true,true); |
|
|
1027
|
+ $filter_query = $this->getFilter($filter, true, true); |
|
1028
|
1028
|
|
|
1029
|
1029
|
if ($pilot != "") |
|
1030
|
1030
|
{ |
|
@@ -1036,8 +1036,8 @@ discard block |
|
|
block discarded – undo |
|
1036
|
1036
|
{ |
|
1037
|
1037
|
$limit_array = explode(",", $limit); |
|
1038
|
1038
|
|
|
1039
|
|
- $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1040
|
|
- $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
|
1039
|
+ $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
|
1040
|
+ $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1041
|
1041
|
|
|
1042
|
1042
|
if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1043
|
1043
|
{ |
|
@@ -1067,7 +1067,7 @@ discard block |
|
|
block discarded – undo |
|
1067
|
1067
|
* @return Array the airline country list |
|
1068
|
1068
|
* |
|
1069
|
1069
|
*/ |
|
1070
|
|
- public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
|
1070
|
+ public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1071
|
1071
|
{ |
|
1072
|
1072
|
global $globalDBdriver; |
|
1073
|
1073
|
/* |
|
@@ -1096,7 +1096,7 @@ discard block |
|
|
block discarded – undo |
|
1096
|
1096
|
$flight_array = array(); |
|
1097
|
1097
|
$temp_array = array(); |
|
1098
|
1098
|
|
|
1099
|
|
- while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
|
1099
|
+ while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1100
|
1100
|
{ |
|
1101
|
1101
|
$temp_array['flight_count'] = $row['nb']; |
|
1102
|
1102
|
$temp_array['flight_country'] = $row['name']; |
|
@@ -1113,7 +1113,7 @@ discard block |
|
|
block discarded – undo |
|
1113
|
1113
|
* @return Array the airline country list |
|
1114
|
1114
|
* |
|
1115
|
1115
|
*/ |
|
1116
|
|
- public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
|
1116
|
+ public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1117
|
1117
|
{ |
|
1118
|
1118
|
global $globalDBdriver; |
|
1119
|
1119
|
/* |
|
@@ -1142,7 +1142,7 @@ discard block |
|
|
block discarded – undo |
|
1142
|
1142
|
$flight_array = array(); |
|
1143
|
1143
|
$temp_array = array(); |
|
1144
|
1144
|
|
|
1145
|
|
- while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
|
1145
|
+ while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1146
|
1146
|
{ |
|
1147
|
1147
|
$temp_array['airline_icao'] = $row['airline_icao']; |
|
1148
|
1148
|
$temp_array['flight_count'] = $row['nb']; |
|
@@ -1160,14 +1160,14 @@ discard block |
|
|
block discarded – undo |
|
1160
|
1160
|
* @return Array the spotter information |
|
1161
|
1161
|
* |
|
1162
|
1162
|
*/ |
|
1163
|
|
- public function getDateArchiveTrackerDataById($id,$date) |
|
|
1163
|
+ public function getDateArchiveTrackerDataById($id, $date) |
|
1164
|
1164
|
{ |
|
1165
|
1165
|
$Tracker = new Tracker($this->db); |
|
1166
|
1166
|
date_default_timezone_set('UTC'); |
|
1167
|
1167
|
$id = filter_var($id, FILTER_SANITIZE_STRING); |
|
1168
|
|
- $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'; |
|
1169
|
|
- $date = date('c',$date); |
|
1170
|
|
- $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
|
1168
|
+ $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'; |
|
|
1169
|
+ $date = date('c', $date); |
|
|
1170
|
+ $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1171
|
1171
|
return $spotter_array; |
|
1172
|
1172
|
} |
|
1173
|
1173
|
|
|
@@ -1177,14 +1177,14 @@ discard block |
|
|
block discarded – undo |
|
1177
|
1177
|
* @return Array the spotter information |
|
1178
|
1178
|
* |
|
1179
|
1179
|
*/ |
|
1180
|
|
- public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
|
1180
|
+ public function getDateArchiveTrackerDataByIdent($ident, $date) |
|
1181
|
1181
|
{ |
|
1182
|
1182
|
$Tracker = new Tracker($this->db); |
|
1183
|
1183
|
date_default_timezone_set('UTC'); |
|
1184
|
1184
|
$ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1185
|
|
- $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'; |
|
1186
|
|
- $date = date('c',$date); |
|
1187
|
|
- $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
|
1185
|
+ $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'; |
|
|
1186
|
+ $date = date('c', $date); |
|
|
1187
|
+ $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1188
|
1188
|
return $spotter_array; |
|
1189
|
1189
|
} |
|
1190
|
1190
|
|
|
@@ -1194,7 +1194,7 @@ discard block |
|
|
block discarded – undo |
|
1194
|
1194
|
* @return Array the spotter information |
|
1195
|
1195
|
* |
|
1196
|
1196
|
*/ |
|
1197
|
|
- public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
|
1197
|
+ public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1198
|
1198
|
{ |
|
1199
|
1199
|
global $global_query; |
|
1200
|
1200
|
$Tracker = new Tracker(); |
|
@@ -1202,7 +1202,7 @@ discard block |
|
|
block discarded – undo |
|
1202
|
1202
|
$query_values = array(); |
|
1203
|
1203
|
$limit_query = ''; |
|
1204
|
1204
|
$additional_query = ''; |
|
1205
|
|
- $filter_query = $this->getFilter($filters,true,true); |
|
|
1205
|
+ $filter_query = $this->getFilter($filters, true, true); |
|
1206
|
1206
|
|
|
1207
|
1207
|
if ($airport != "") |
|
1208
|
1208
|
{ |
|
@@ -1219,8 +1219,8 @@ discard block |
|
|
block discarded – undo |
|
1219
|
1219
|
{ |
|
1220
|
1220
|
$limit_array = explode(",", $limit); |
|
1221
|
1221
|
|
|
1222
|
|
- $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1223
|
|
- $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
|
1222
|
+ $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
|
1223
|
+ $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1224
|
1224
|
|
|
1225
|
1225
|
if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1226
|
1226
|
{ |