|
@@ -16,62 +16,62 @@ discard block |
|
|
block discarded – undo |
|
16
|
16
|
* @param Array $filter the filter |
|
17
|
17
|
* @return Array the SQL part |
|
18
|
18
|
*/ |
|
19
|
|
- public function getFilter($filter = array(),$where = false,$and = false) { |
|
|
19
|
+ public function getFilter($filter = array(), $where = false, $and = false) { |
|
20
|
20
|
global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
|
21
|
21
|
$filters = array(); |
|
22
|
22
|
if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
|
23
|
23
|
if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
|
24
|
24
|
$filters = $globalStatsFilters[$globalFilterName]; |
|
25
|
25
|
} else { |
|
26
|
|
- $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
|
26
|
+ $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
27
|
27
|
} |
|
28
|
28
|
} |
|
29
|
29
|
if (isset($filter[0]['source'])) { |
|
30
|
|
- $filters = array_merge($filters,$filter); |
|
|
30
|
+ $filters = array_merge($filters, $filter); |
|
31
|
31
|
} |
|
32
|
|
- if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
|
32
|
+ if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
33
|
33
|
$filter_query_join = ''; |
|
34
|
34
|
$filter_query_where = ''; |
|
35
|
|
- foreach($filters as $flt) { |
|
|
35
|
+ foreach ($filters as $flt) { |
|
36
|
36
|
if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
|
37
|
37
|
if ($flt['airlines'][0] != '') { |
|
38
|
38
|
if (isset($flt['source'])) { |
|
39
|
|
- $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
|
39
|
+ $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
40
|
40
|
} else { |
|
41
|
|
- $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
|
41
|
+ $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
42
|
42
|
} |
|
43
|
43
|
} |
|
44
|
44
|
} |
|
45
|
45
|
if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
|
46
|
46
|
if (isset($flt['source'])) { |
|
47
|
|
- $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
|
47
|
+ $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
48
|
48
|
} else { |
|
49
|
|
- $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
|
49
|
+ $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
50
|
50
|
} |
|
51
|
51
|
} |
|
52
|
52
|
if (isset($flt['idents']) && !empty($flt['idents'])) { |
|
53
|
53
|
if (isset($flt['source'])) { |
|
54
|
|
- $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
|
54
|
+ $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
55
|
55
|
} else { |
|
56
|
|
- $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
|
56
|
+ $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
57
|
57
|
} |
|
58
|
58
|
} |
|
59
|
59
|
if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
|
60
|
60
|
if (isset($flt['source'])) { |
|
61
|
|
- $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
|
61
|
+ $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
62
|
62
|
} else { |
|
63
|
|
- $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
|
63
|
+ $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
64
|
64
|
} |
|
65
|
65
|
} |
|
66
|
66
|
if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
|
67
|
67
|
if (isset($flt['source'])) { |
|
68
|
|
- $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
|
68
|
+ $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
69
|
69
|
} |
|
70
|
70
|
} |
|
71
|
71
|
} |
|
72
|
72
|
if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
73
|
73
|
if ($filter['airlines'][0] != '') { |
|
74
|
|
- $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
|
74
|
+ $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
75
|
75
|
} |
|
76
|
76
|
} |
|
77
|
77
|
if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
|
@@ -81,10 +81,10 @@ discard block |
|
|
block discarded – undo |
|
81
|
81
|
$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
|
82
|
82
|
} |
|
83
|
83
|
if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
|
84
|
|
- $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
|
84
|
+ $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
85
|
85
|
} |
|
86
|
86
|
if (isset($filter['source']) && !empty($filter['source'])) { |
|
87
|
|
- $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
|
87
|
+ $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
88
|
88
|
} |
|
89
|
89
|
if (isset($filter['ident']) && !empty($filter['ident'])) { |
|
90
|
90
|
$filter_query_where .= " AND ident = '".$filter['ident']."'"; |
|
@@ -113,15 +113,15 @@ discard block |
|
|
block discarded – undo |
|
113
|
113
|
$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
|
114
|
114
|
} |
|
115
|
115
|
} |
|
116
|
|
- $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
|
116
|
+ $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
117
|
117
|
} |
|
118
|
118
|
if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
119
|
|
- $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
|
119
|
+ $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
120
|
120
|
} |
|
121
|
121
|
if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
122
|
122
|
elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
123
|
123
|
if ($filter_query_where != '') { |
|
124
|
|
- $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
|
124
|
+ $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
125
|
125
|
} |
|
126
|
126
|
$filter_query = $filter_query_join.$filter_query_where; |
|
127
|
127
|
return $filter_query; |
|
@@ -144,8 +144,8 @@ discard block |
|
|
block discarded – undo |
|
144
|
144
|
if ($limit != '') |
|
145
|
145
|
{ |
|
146
|
146
|
$limit_array = explode(',', $limit); |
|
147
|
|
- $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
148
|
|
- $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
|
147
|
+ $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
|
148
|
+ $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
149
|
149
|
if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
150
|
150
|
{ |
|
151
|
151
|
$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
|
@@ -168,7 +168,7 @@ discard block |
|
|
block discarded – undo |
|
168
|
168
|
} else { |
|
169
|
169
|
$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
|
170
|
170
|
} |
|
171
|
|
- $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
|
171
|
+ $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
172
|
172
|
|
|
173
|
173
|
return $spotter_array; |
|
174
|
174
|
} |
|
@@ -183,7 +183,7 @@ discard block |
|
|
block discarded – undo |
|
183
|
183
|
{ |
|
184
|
184
|
global $globalDBdriver, $globalLiveInterval, $globalArchive; |
|
185
|
185
|
date_default_timezone_set('UTC'); |
|
186
|
|
- $filter_query = $this->getFilter($filter,true,true); |
|
|
186
|
+ $filter_query = $this->getFilter($filter, true, true); |
|
187
|
187
|
if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
188
|
188
|
if ($globalDBdriver == 'mysql') { |
|
189
|
189
|
if (isset($globalArchive) && $globalArchive === TRUE) { |
|
@@ -206,7 +206,7 @@ discard block |
|
|
block discarded – undo |
|
206
|
206
|
try { |
|
207
|
207
|
$sth = $this->db->prepare($query); |
|
208
|
208
|
$sth->execute(); |
|
209
|
|
- } catch(PDOException $e) { |
|
|
209
|
+ } catch (PDOException $e) { |
|
210
|
210
|
echo $e->getMessage(); |
|
211
|
211
|
die; |
|
212
|
212
|
} |
|
@@ -225,7 +225,7 @@ discard block |
|
|
block discarded – undo |
|
225
|
225
|
global $globalDBdriver, $globalLiveInterval; |
|
226
|
226
|
date_default_timezone_set('UTC'); |
|
227
|
227
|
|
|
228
|
|
- $filter_query = $this->getFilter($filter,true,true); |
|
|
228
|
+ $filter_query = $this->getFilter($filter, true, true); |
|
229
|
229
|
|
|
230
|
230
|
if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
231
|
231
|
if ($globalDBdriver == 'mysql') { |
|
@@ -234,7 +234,7 @@ discard block |
|
|
block discarded – undo |
|
234
|
234
|
FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
|
235
|
235
|
ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
|
236
|
236
|
*/ |
|
237
|
|
- $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
|
237
|
+ $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
238
|
238
|
FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
|
239
|
239
|
ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
|
240
|
240
|
} else { |
|
@@ -243,7 +243,7 @@ discard block |
|
|
block discarded – undo |
|
243
|
243
|
FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
|
244
|
244
|
ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
|
245
|
245
|
*/ |
|
246
|
|
- $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
|
246
|
+ $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
247
|
247
|
FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
|
248
|
248
|
ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
|
249
|
249
|
// echo $query; |
|
@@ -252,7 +252,7 @@ discard block |
|
|
block discarded – undo |
|
252
|
252
|
try { |
|
253
|
253
|
$sth = $this->db->prepare($query); |
|
254
|
254
|
$sth->execute(); |
|
255
|
|
- } catch(PDOException $e) { |
|
|
255
|
+ } catch (PDOException $e) { |
|
256
|
256
|
echo $e->getMessage(); |
|
257
|
257
|
die; |
|
258
|
258
|
} |
|
@@ -269,7 +269,7 @@ discard block |
|
|
block discarded – undo |
|
269
|
269
|
public function getLiveSpotterCount($filter = array()) |
|
270
|
270
|
{ |
|
271
|
271
|
global $globalDBdriver, $globalLiveInterval; |
|
272
|
|
- $filter_query = $this->getFilter($filter,true,true); |
|
|
272
|
+ $filter_query = $this->getFilter($filter, true, true); |
|
273
|
273
|
|
|
274
|
274
|
if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
275
|
275
|
if ($globalDBdriver == 'mysql') { |
|
@@ -282,7 +282,7 @@ discard block |
|
|
block discarded – undo |
|
282
|
282
|
try { |
|
283
|
283
|
$sth = $this->db->prepare($query); |
|
284
|
284
|
$sth->execute(); |
|
285
|
|
- } catch(PDOException $e) { |
|
|
285
|
+ } catch (PDOException $e) { |
|
286
|
286
|
echo $e->getMessage(); |
|
287
|
287
|
die; |
|
288
|
288
|
} |
|
@@ -305,10 +305,10 @@ discard block |
|
|
block discarded – undo |
|
305
|
305
|
$filter_query = $this->getFilter($filter); |
|
306
|
306
|
|
|
307
|
307
|
if (is_array($coord)) { |
|
308
|
|
- $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
309
|
|
- $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
310
|
|
- $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
311
|
|
- $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
|
308
|
+ $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
|
309
|
+ $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
|
310
|
+ $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
|
311
|
+ $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
312
|
312
|
} else return array(); |
|
313
|
313
|
if ($globalDBdriver == 'mysql') { |
|
314
|
314
|
$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
|
@@ -331,23 +331,23 @@ discard block |
|
|
block discarded – undo |
|
331
|
331
|
global $globalDBdriver, $globalLiveInterval, $globalArchive; |
|
332
|
332
|
$Spotter = new Spotter($this->db); |
|
333
|
333
|
if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
334
|
|
- $filter_query = $this->getFilter($filter,true,true); |
|
|
334
|
+ $filter_query = $this->getFilter($filter, true, true); |
|
335
|
335
|
|
|
336
|
336
|
if (is_array($coord)) { |
|
337
|
|
- $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
338
|
|
- $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
339
|
|
- $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
340
|
|
- $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
|
337
|
+ $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
|
338
|
+ $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
|
339
|
+ $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
|
340
|
+ $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
341
|
341
|
} else return array(); |
|
342
|
342
|
if ($globalDBdriver == 'mysql') { |
|
343
|
343
|
if (isset($globalArchive) && $globalArchive === TRUE) { |
|
344
|
|
- $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
|
344
|
+ $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
345
|
345
|
FROM spotter_live |
|
346
|
346
|
'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
|
347
|
347
|
AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
|
348
|
348
|
AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0'; |
|
349
|
349
|
} else { |
|
350
|
|
- $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
|
350
|
+ $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
351
|
351
|
FROM spotter_live |
|
352
|
352
|
INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
|
353
|
353
|
FROM spotter_live l |
|
@@ -359,14 +359,14 @@ discard block |
|
|
block discarded – undo |
|
359
|
359
|
} |
|
360
|
360
|
} else { |
|
361
|
361
|
if (isset($globalArchive) && $globalArchive === TRUE) { |
|
362
|
|
- $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
|
362
|
+ $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
363
|
363
|
FROM spotter_live |
|
364
|
364
|
".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
|
365
|
365
|
AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
|
366
|
366
|
AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
|
367
|
367
|
AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
|
368
|
368
|
} else { |
|
369
|
|
- $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
|
369
|
+ $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
370
|
370
|
FROM spotter_live |
|
371
|
371
|
INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
|
372
|
372
|
FROM spotter_live l |
|
@@ -381,7 +381,7 @@ discard block |
|
|
block discarded – undo |
|
381
|
381
|
try { |
|
382
|
382
|
$sth = $this->db->prepare($query); |
|
383
|
383
|
$sth->execute(); |
|
384
|
|
- } catch(PDOException $e) { |
|
|
384
|
+ } catch (PDOException $e) { |
|
385
|
385
|
echo $e->getMessage(); |
|
386
|
386
|
die; |
|
387
|
387
|
} |
|
@@ -430,7 +430,7 @@ discard block |
|
|
block discarded – undo |
|
430
|
430
|
if ($interval == '1m') |
|
431
|
431
|
{ |
|
432
|
432
|
$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
433
|
|
- } else if ($interval == '15m'){ |
|
|
433
|
+ } else if ($interval == '15m') { |
|
434
|
434
|
$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
435
|
435
|
} |
|
436
|
436
|
} |
|
@@ -438,14 +438,14 @@ discard block |
|
|
block discarded – undo |
|
438
|
438
|
$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
439
|
439
|
} |
|
440
|
440
|
|
|
441
|
|
- $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
|
441
|
+ $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
442
|
442
|
WHERE spotter_live.latitude <> '' |
|
443
|
443
|
AND spotter_live.longitude <> '' |
|
444
|
444
|
".$additional_query." |
|
445
|
445
|
HAVING distance < :radius |
|
446
|
446
|
ORDER BY distance"; |
|
447
|
447
|
|
|
448
|
|
- $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
|
448
|
+ $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
449
|
449
|
|
|
450
|
450
|
return $spotter_array; |
|
451
|
451
|
} |
|
@@ -463,9 +463,9 @@ discard block |
|
|
block discarded – undo |
|
463
|
463
|
date_default_timezone_set('UTC'); |
|
464
|
464
|
|
|
465
|
465
|
$ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
466
|
|
- $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
|
466
|
+ $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
467
|
467
|
|
|
468
|
|
- $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
|
468
|
+ $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
469
|
469
|
|
|
470
|
470
|
return $spotter_array; |
|
471
|
471
|
} |
|
@@ -476,16 +476,16 @@ discard block |
|
|
block discarded – undo |
|
476
|
476
|
* @return Array the spotter information |
|
477
|
477
|
* |
|
478
|
478
|
*/ |
|
479
|
|
- public function getDateLiveSpotterDataByIdent($ident,$date) |
|
|
479
|
+ public function getDateLiveSpotterDataByIdent($ident, $date) |
|
480
|
480
|
{ |
|
481
|
481
|
$Spotter = new Spotter($this->db); |
|
482
|
482
|
date_default_timezone_set('UTC'); |
|
483
|
483
|
|
|
484
|
484
|
$ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
485
|
|
- $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
|
485
|
+ $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
486
|
486
|
|
|
487
|
|
- $date = date('c',$date); |
|
488
|
|
- $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
|
487
|
+ $date = date('c', $date); |
|
|
488
|
+ $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
489
|
489
|
|
|
490
|
490
|
return $spotter_array; |
|
491
|
491
|
} |
|
@@ -502,9 +502,9 @@ discard block |
|
|
block discarded – undo |
|
502
|
502
|
date_default_timezone_set('UTC'); |
|
503
|
503
|
|
|
504
|
504
|
$id = filter_var($id, FILTER_SANITIZE_STRING); |
|
505
|
|
- $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
|
505
|
+ $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
506
|
506
|
|
|
507
|
|
- $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
|
507
|
+ $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
508
|
508
|
|
|
509
|
509
|
return $spotter_array; |
|
510
|
510
|
} |
|
@@ -515,15 +515,15 @@ discard block |
|
|
block discarded – undo |
|
515
|
515
|
* @return Array the spotter information |
|
516
|
516
|
* |
|
517
|
517
|
*/ |
|
518
|
|
- public function getDateLiveSpotterDataById($id,$date) |
|
|
518
|
+ public function getDateLiveSpotterDataById($id, $date) |
|
519
|
519
|
{ |
|
520
|
520
|
$Spotter = new Spotter($this->db); |
|
521
|
521
|
date_default_timezone_set('UTC'); |
|
522
|
522
|
|
|
523
|
523
|
$id = filter_var($id, FILTER_SANITIZE_STRING); |
|
524
|
|
- $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
525
|
|
- $date = date('c',$date); |
|
526
|
|
- $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
|
524
|
+ $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
|
525
|
+ $date = date('c', $date); |
|
|
526
|
+ $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
527
|
527
|
|
|
528
|
528
|
return $spotter_array; |
|
529
|
529
|
} |
|
@@ -540,13 +540,13 @@ discard block |
|
|
block discarded – undo |
|
540
|
540
|
date_default_timezone_set('UTC'); |
|
541
|
541
|
|
|
542
|
542
|
$ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
543
|
|
- $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
|
543
|
+ $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
544
|
544
|
|
|
545
|
545
|
try { |
|
546
|
546
|
|
|
547
|
547
|
$sth = $this->db->prepare($query); |
|
548
|
548
|
$sth->execute(array(':ident' => $ident)); |
|
549
|
|
- } catch(PDOException $e) { |
|
|
549
|
+ } catch (PDOException $e) { |
|
550
|
550
|
echo $e->getMessage(); |
|
551
|
551
|
die; |
|
552
|
552
|
} |
|
@@ -561,7 +561,7 @@ discard block |
|
|
block discarded – undo |
|
561
|
561
|
* @return Array the spotter information |
|
562
|
562
|
* |
|
563
|
563
|
*/ |
|
564
|
|
- public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
|
564
|
+ public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
565
|
565
|
{ |
|
566
|
566
|
global $globalDBdriver, $globalLiveInterval; |
|
567
|
567
|
date_default_timezone_set('UTC'); |
|
@@ -580,7 +580,7 @@ discard block |
|
|
block discarded – undo |
|
580
|
580
|
try { |
|
581
|
581
|
$sth = $this->db->prepare($query); |
|
582
|
582
|
$sth->execute(array(':id' => $id)); |
|
583
|
|
- } catch(PDOException $e) { |
|
|
583
|
+ } catch (PDOException $e) { |
|
584
|
584
|
echo $e->getMessage(); |
|
585
|
585
|
die; |
|
586
|
586
|
} |
|
@@ -598,12 +598,12 @@ discard block |
|
|
block discarded – undo |
|
598
|
598
|
{ |
|
599
|
599
|
date_default_timezone_set('UTC'); |
|
600
|
600
|
$ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
601
|
|
- $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
|
601
|
+ $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
602
|
602
|
try { |
|
603
|
603
|
|
|
604
|
604
|
$sth = $this->db->prepare($query); |
|
605
|
605
|
$sth->execute(array(':ident' => $ident)); |
|
606
|
|
- } catch(PDOException $e) { |
|
|
606
|
+ } catch (PDOException $e) { |
|
607
|
607
|
echo $e->getMessage(); |
|
608
|
608
|
die; |
|
609
|
609
|
} |
|
@@ -633,7 +633,7 @@ discard block |
|
|
block discarded – undo |
|
633
|
633
|
|
|
634
|
634
|
$sth = $this->db->prepare($query); |
|
635
|
635
|
$sth->execute(); |
|
636
|
|
- } catch(PDOException $e) { |
|
|
636
|
+ } catch (PDOException $e) { |
|
637
|
637
|
return "error"; |
|
638
|
638
|
} |
|
639
|
639
|
|
|
@@ -656,14 +656,14 @@ discard block |
|
|
block discarded – undo |
|
656
|
656
|
|
|
657
|
657
|
$sth = $this->db->prepare($query); |
|
658
|
658
|
$sth->execute(); |
|
659
|
|
- } catch(PDOException $e) { |
|
|
659
|
+ } catch (PDOException $e) { |
|
660
|
660
|
return "error"; |
|
661
|
661
|
} |
|
662
|
662
|
$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
663
|
663
|
$i = 0; |
|
664
|
|
- $j =0; |
|
|
664
|
+ $j = 0; |
|
665
|
665
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
666
|
|
- foreach($all as $row) |
|
|
666
|
+ foreach ($all as $row) |
|
667
|
667
|
{ |
|
668
|
668
|
$i++; |
|
669
|
669
|
$j++; |
|
@@ -671,9 +671,9 @@ discard block |
|
|
block discarded – undo |
|
671
|
671
|
if ($globalDebug) echo "."; |
|
672
|
672
|
try { |
|
673
|
673
|
|
|
674
|
|
- $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
|
674
|
+ $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
675
|
675
|
$sth->execute(); |
|
676
|
|
- } catch(PDOException $e) { |
|
|
676
|
+ } catch (PDOException $e) { |
|
677
|
677
|
return "error"; |
|
678
|
678
|
} |
|
679
|
679
|
$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
@@ -684,9 +684,9 @@ discard block |
|
|
block discarded – undo |
|
684
|
684
|
if ($i > 0) { |
|
685
|
685
|
try { |
|
686
|
686
|
|
|
687
|
|
- $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
|
687
|
+ $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
688
|
688
|
$sth->execute(); |
|
689
|
|
- } catch(PDOException $e) { |
|
|
689
|
+ } catch (PDOException $e) { |
|
690
|
690
|
return "error"; |
|
691
|
691
|
} |
|
692
|
692
|
} |
|
@@ -699,7 +699,7 @@ discard block |
|
|
block discarded – undo |
|
699
|
699
|
|
|
700
|
700
|
$sth = $this->db->prepare($query); |
|
701
|
701
|
$sth->execute(); |
|
702
|
|
- } catch(PDOException $e) { |
|
|
702
|
+ } catch (PDOException $e) { |
|
703
|
703
|
return "error"; |
|
704
|
704
|
} |
|
705
|
705
|
/* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
|
@@ -747,13 +747,13 @@ discard block |
|
|
block discarded – undo |
|
747
|
747
|
public function deleteLiveSpotterDataByIdent($ident) |
|
748
|
748
|
{ |
|
749
|
749
|
$ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
750
|
|
- $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
|
750
|
+ $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
751
|
751
|
|
|
752
|
752
|
try { |
|
753
|
753
|
|
|
754
|
754
|
$sth = $this->db->prepare($query); |
|
755
|
755
|
$sth->execute(array(':ident' => $ident)); |
|
756
|
|
- } catch(PDOException $e) { |
|
|
756
|
+ } catch (PDOException $e) { |
|
757
|
757
|
return "error"; |
|
758
|
758
|
} |
|
759
|
759
|
|
|
@@ -769,13 +769,13 @@ discard block |
|
|
block discarded – undo |
|
769
|
769
|
public function deleteLiveSpotterDataById($id) |
|
770
|
770
|
{ |
|
771
|
771
|
$id = filter_var($id, FILTER_SANITIZE_STRING); |
|
772
|
|
- $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
|
772
|
+ $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
773
|
773
|
|
|
774
|
774
|
try { |
|
775
|
775
|
|
|
776
|
776
|
$sth = $this->db->prepare($query); |
|
777
|
777
|
$sth->execute(array(':id' => $id)); |
|
778
|
|
- } catch(PDOException $e) { |
|
|
778
|
+ } catch (PDOException $e) { |
|
779
|
779
|
return "error"; |
|
780
|
780
|
} |
|
781
|
781
|
|
|
@@ -793,13 +793,13 @@ discard block |
|
|
block discarded – undo |
|
793
|
793
|
{ |
|
794
|
794
|
global $globalDBdriver, $globalTimezone; |
|
795
|
795
|
if ($globalDBdriver == 'mysql') { |
|
796
|
|
- $query = 'SELECT spotter_live.ident FROM spotter_live |
|
|
796
|
+ $query = 'SELECT spotter_live.ident FROM spotter_live |
|
797
|
797
|
WHERE spotter_live.ident = :ident |
|
798
|
798
|
AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
|
799
|
799
|
AND spotter_live.date < UTC_TIMESTAMP()'; |
|
800
|
800
|
$query_data = array(':ident' => $ident); |
|
801
|
801
|
} else { |
|
802
|
|
- $query = "SELECT spotter_live.ident FROM spotter_live |
|
|
802
|
+ $query = "SELECT spotter_live.ident FROM spotter_live |
|
803
|
803
|
WHERE spotter_live.ident = :ident |
|
804
|
804
|
AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
|
805
|
805
|
AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
|
@@ -808,8 +808,8 @@ discard block |
|
|
block discarded – undo |
|
808
|
808
|
|
|
809
|
809
|
$sth = $this->db->prepare($query); |
|
810
|
810
|
$sth->execute($query_data); |
|
811
|
|
- $ident_result=''; |
|
812
|
|
- while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
|
811
|
+ $ident_result = ''; |
|
|
812
|
+ while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
813
|
813
|
{ |
|
814
|
814
|
$ident_result = $row['ident']; |
|
815
|
815
|
} |
|
@@ -826,13 +826,13 @@ discard block |
|
|
block discarded – undo |
|
826
|
826
|
{ |
|
827
|
827
|
global $globalDBdriver, $globalTimezone; |
|
828
|
828
|
if ($globalDBdriver == 'mysql') { |
|
829
|
|
- $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
|
829
|
+ $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
830
|
830
|
WHERE spotter_live.ident = :ident |
|
831
|
831
|
AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
|
832
|
832
|
// AND spotter_live.date < UTC_TIMESTAMP()"; |
|
833
|
833
|
$query_data = array(':ident' => $ident); |
|
834
|
834
|
} else { |
|
835
|
|
- $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
|
835
|
+ $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
836
|
836
|
WHERE spotter_live.ident = :ident |
|
837
|
837
|
AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
|
838
|
838
|
// AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
|
@@ -841,8 +841,8 @@ discard block |
|
|
block discarded – undo |
|
841
|
841
|
|
|
842
|
842
|
$sth = $this->db->prepare($query); |
|
843
|
843
|
$sth->execute($query_data); |
|
844
|
|
- $ident_result=''; |
|
845
|
|
- while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
|
844
|
+ $ident_result = ''; |
|
|
845
|
+ while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
846
|
846
|
{ |
|
847
|
847
|
$ident_result = $row['flightaware_id']; |
|
848
|
848
|
} |
|
@@ -859,13 +859,13 @@ discard block |
|
|
block discarded – undo |
|
859
|
859
|
{ |
|
860
|
860
|
global $globalDBdriver, $globalTimezone; |
|
861
|
861
|
if ($globalDBdriver == 'mysql') { |
|
862
|
|
- $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
|
862
|
+ $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
863
|
863
|
WHERE spotter_live.flightaware_id = :id |
|
864
|
864
|
AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
|
865
|
865
|
// AND spotter_live.date < UTC_TIMESTAMP()"; |
|
866
|
866
|
$query_data = array(':id' => $id); |
|
867
|
867
|
} else { |
|
868
|
|
- $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
|
868
|
+ $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
869
|
869
|
WHERE spotter_live.flightaware_id = :id |
|
870
|
870
|
AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
|
871
|
871
|
// AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
|
@@ -874,8 +874,8 @@ discard block |
|
|
block discarded – undo |
|
874
|
874
|
|
|
875
|
875
|
$sth = $this->db->prepare($query); |
|
876
|
876
|
$sth->execute($query_data); |
|
877
|
|
- $ident_result=''; |
|
878
|
|
- while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
|
877
|
+ $ident_result = ''; |
|
|
878
|
+ while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
879
|
879
|
{ |
|
880
|
880
|
$ident_result = $row['flightaware_id']; |
|
881
|
881
|
} |
|
@@ -892,13 +892,13 @@ discard block |
|
|
block discarded – undo |
|
892
|
892
|
{ |
|
893
|
893
|
global $globalDBdriver, $globalTimezone; |
|
894
|
894
|
if ($globalDBdriver == 'mysql') { |
|
895
|
|
- $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
|
895
|
+ $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
896
|
896
|
WHERE spotter_live.ModeS = :modes |
|
897
|
897
|
AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
|
898
|
898
|
// AND spotter_live.date < UTC_TIMESTAMP()"; |
|
899
|
899
|
$query_data = array(':modes' => $modes); |
|
900
|
900
|
} else { |
|
901
|
|
- $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
|
901
|
+ $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
902
|
902
|
WHERE spotter_live.ModeS = :modes |
|
903
|
903
|
AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
|
904
|
904
|
// // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
|
@@ -907,8 +907,8 @@ discard block |
|
|
block discarded – undo |
|
907
|
907
|
|
|
908
|
908
|
$sth = $this->db->prepare($query); |
|
909
|
909
|
$sth->execute($query_data); |
|
910
|
|
- $ident_result=''; |
|
911
|
|
- while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
|
910
|
+ $ident_result = ''; |
|
|
911
|
+ while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
912
|
912
|
{ |
|
913
|
913
|
//$ident_result = $row['spotter_live_id']; |
|
914
|
914
|
$ident_result = $row['flightaware_id']; |
|
@@ -927,7 +927,7 @@ discard block |
|
|
block discarded – undo |
|
927
|
927
|
* @return String success or false |
|
928
|
928
|
* |
|
929
|
929
|
*/ |
|
930
|
|
- public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
|
930
|
+ public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
931
|
931
|
{ |
|
932
|
932
|
global $globalURL, $globalArchive, $globalDebug; |
|
933
|
933
|
$Common = new Common(); |
|
@@ -1020,26 +1020,26 @@ discard block |
|
|
block discarded – undo |
|
1020
|
1020
|
if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
1021
|
1021
|
|
|
1022
|
1022
|
|
|
1023
|
|
- $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
1024
|
|
- $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1025
|
|
- $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
1026
|
|
- $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1027
|
|
- $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1028
|
|
- $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1029
|
|
- $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1030
|
|
- $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
1031
|
|
- $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1032
|
|
- $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1033
|
|
- $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1034
|
|
- $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
1035
|
|
- $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
1036
|
|
- $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
1037
|
|
- $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
1038
|
|
- $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
1039
|
|
- $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1040
|
|
- $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
1041
|
|
- $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
1042
|
|
- $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
|
1023
|
+ $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
|
1024
|
+ $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
|
1025
|
+ $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
|
1026
|
+ $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
|
1027
|
+ $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
|
1028
|
+ $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
|
1029
|
+ $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
|
1030
|
+ $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
|
1031
|
+ $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
|
1032
|
+ $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
|
1033
|
+ $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
|
1034
|
+ $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
|
1035
|
+ $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
|
1036
|
+ $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
|
1037
|
+ $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
|
1038
|
+ $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
|
1039
|
+ $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
|
1040
|
+ $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
|
1041
|
+ $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
|
1042
|
+ $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
1043
|
1043
|
|
|
1044
|
1044
|
$airline_name = ''; |
|
1045
|
1045
|
$airline_icao = ''; |
|
@@ -1061,10 +1061,10 @@ discard block |
|
|
block discarded – undo |
|
1061
|
1061
|
$arrival_airport_country = ''; |
|
1062
|
1062
|
|
|
1063
|
1063
|
|
|
1064
|
|
- if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1065
|
|
- if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1066
|
|
- if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1067
|
|
- if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
|
1064
|
+ if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
|
1065
|
+ if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
|
1066
|
+ if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
|
1067
|
+ if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1068
|
1068
|
|
|
1069
|
1069
|
$query = ''; |
|
1070
|
1070
|
if ($globalArchive) { |
|
@@ -1075,19 +1075,19 @@ discard block |
|
|
block discarded – undo |
|
1075
|
1075
|
$query .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
1076
|
1076
|
VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
|
1077
|
1077
|
|
|
1078
|
|
- $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
|
1078
|
+ $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
1079
|
1079
|
try { |
|
1080
|
1080
|
|
|
1081
|
1081
|
$sth = $this->db->prepare($query); |
|
1082
|
1082
|
$sth->execute($query_values); |
|
1083
|
1083
|
$sth->closeCursor(); |
|
1084
|
|
- } catch(PDOException $e) { |
|
|
1084
|
+ } catch (PDOException $e) { |
|
1085
|
1085
|
return "error : ".$e->getMessage(); |
|
1086
|
1086
|
} |
|
1087
|
1087
|
if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
|
1088
|
1088
|
if ($globalDebug) echo '(Add to SBS archive : '; |
|
1089
|
1089
|
$SpotterArchive = new SpotterArchive($this->db); |
|
1090
|
|
- $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
|
1090
|
+ $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
1091
|
1091
|
if ($globalDebug) echo $result.')'; |
|
1092
|
1092
|
} |
|
1093
|
1093
|
return "success"; |
|
@@ -1096,7 +1096,7 @@ discard block |
|
|
block discarded – undo |
|
1096
|
1096
|
|
|
1097
|
1097
|
public function getOrderBy() |
|
1098
|
1098
|
{ |
|
1099
|
|
- $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
|
1099
|
+ $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1100
|
1100
|
return $orderby; |
|
1101
|
1101
|
} |
|
1102
|
1102
|
|