Completed
Push — master ( e71877...1def10 )
by Yannick
34:58
created
require/class.SpotterLive.php 1 patch
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -17,62 +17,62 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30 30
 		if (isset($filter[0]['source'])) {
31
-			$filters = array_merge($filters,$filter);
31
+			$filters = array_merge($filters, $filter);
32 32
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
34 34
 		$filter_query_join = '';
35 35
 		$filter_query_where = '';
36
-		foreach($filters as $flt) {
36
+		foreach ($filters as $flt) {
37 37
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
38 38
 				if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') {
39 39
 					if (isset($flt['source'])) {
40
-						$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
+						$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";
41 41
 					} else {
42
-						$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
+						$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";
43 43
 					}
44 44
 				}
45 45
 			}
46 46
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
47 47
 				if (isset($flt['source'])) {
48
-					$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
+					$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";
49 49
 				} else {
50
-					$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
+					$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";
51 51
 				}
52 52
 			}
53 53
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
54 54
 				if (isset($flt['source'])) {
55
-					$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
+					$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";
56 56
 				} else {
57
-					$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
+					$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";
58 58
 				}
59 59
 			}
60 60
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
61 61
 				if (isset($flt['source'])) {
62
-					$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
+					$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";
63 63
 				} else {
64
-					$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
+					$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";
65 65
 				}
66 66
 			}
67 67
 			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']))) {
68 68
 				if (isset($flt['source'])) {
69
-					$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
+					$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";
70 70
 				}
71 71
 			}
72 72
 		}
73 73
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
74 74
 			if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') {
75
-				$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
+				$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";
76 76
 			}
77 77
 		}
78 78
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 			$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 ";
83 83
 		}
84 84
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
85
-			$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
+			$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";
86 86
 		}
87 87
 		if (isset($filter['source']) && !empty($filter['source'])) {
88 88
 			if (count($filter['source']) == 1) {
89 89
 				$filter_query_where .= " AND format_source = '".$filter['source'][0]."'";
90 90
 			} else {
91
-				$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
91
+				$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
92 92
 			}
93 93
 		}
94 94
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
122 122
 				}
123 123
 			}
124
-			$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";
124
+			$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";
125 125
 		}
126 126
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
127
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
127
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
128 128
 		}
129 129
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
130 130
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
131 131
 		if ($filter_query_where != '') {
132
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
132
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
133 133
 		}
134 134
 		$filter_query = $filter_query_join.$filter_query_where;
135 135
 		return $filter_query;
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 		if ($limit != '')
153 153
 		{
154 154
 			$limit_array = explode(',', $limit);
155
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
156
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
155
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
156
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
157 157
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
158 158
 			{
159 159
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		} else {
178 178
 			$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;
179 179
 		}
180
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
180
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
181 181
 
182 182
 		return $spotter_array;
183 183
 	}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	{
193 193
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
194 194
 		date_default_timezone_set('UTC');
195
-		$filter_query = $this->getFilter($filter,true,true);
195
+		$filter_query = $this->getFilter($filter, true, true);
196 196
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
197 197
 		if ($globalDBdriver == 'mysql') {
198 198
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		try {
216 216
 			$sth = $this->db->prepare($query);
217 217
 			$sth->execute();
218
-		} catch(PDOException $e) {
218
+		} catch (PDOException $e) {
219 219
 			echo $e->getMessage();
220 220
 			die;
221 221
 		}
@@ -229,20 +229,20 @@  discard block
 block discarded – undo
229 229
 	* @return Array the spotter information
230 230
 	*
231 231
 	*/
232
-	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '')
232
+	public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false, $id = '')
233 233
 	{
234 234
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
235 235
 		date_default_timezone_set('UTC');
236 236
 		$usecoord = false;
237 237
 		if (is_array($coord) && !empty($coord)) {
238
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
239
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
240
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
241
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
238
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
239
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
240
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
241
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
242 242
 			$usecoord = true;
243 243
 		}
244
-		$id = filter_var($id,FILTER_SANITIZE_STRING);
245
-		$filter_query = $this->getFilter($filter,true,true);
244
+		$id = filter_var($id, FILTER_SANITIZE_STRING);
245
+		$filter_query = $this->getFilter($filter, true, true);
246 246
 
247 247
 		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
248 248
 		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
255 255
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
256 256
 				*/
257
-				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
257
+				$query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
258 258
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
259 259
 				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
260 260
 				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 				ORDER BY flightaware_id, date";
269 269
 				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
270 270
 			} else {
271
-				$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 
271
+				$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 
272 272
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date ";
273 273
 				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
274 274
 				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
285 285
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
286 286
                                */
287
-				$query  = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
287
+				$query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
288 288
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
289 289
 				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
290 290
 				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		try {
312 312
 			$sth = $this->db->prepare($query);
313 313
 			$sth->execute($query_values);
314
-		} catch(PDOException $e) {
314
+		} catch (PDOException $e) {
315 315
 			echo $e->getMessage();
316 316
 			die;
317 317
 		}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	public function getLiveSpotterCount($filter = array())
329 329
 	{
330 330
 		global $globalDBdriver, $globalLiveInterval;
331
-		$filter_query = $this->getFilter($filter,true,true);
331
+		$filter_query = $this->getFilter($filter, true, true);
332 332
 
333 333
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
334 334
 		if ($globalDBdriver == 'mysql') {
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 		try {
342 342
 			$sth = $this->db->prepare($query);
343 343
 			$sth->execute();
344
-		} catch(PDOException $e) {
344
+		} catch (PDOException $e) {
345 345
 			echo $e->getMessage();
346 346
 			die;
347 347
 		}
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 		$filter_query = $this->getFilter($filter);
365 365
 
366 366
 		if (is_array($coord)) {
367
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
368
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
369
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
370
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
367
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
368
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
369
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
370
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
371 371
 		} else return array();
372 372
 		if ($globalDBdriver == 'mysql') {
373 373
 			$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;
@@ -390,23 +390,23 @@  discard block
 block discarded – undo
390 390
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
391 391
 		$Spotter = new Spotter($this->db);
392 392
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
393
-		$filter_query = $this->getFilter($filter,true,true);
393
+		$filter_query = $this->getFilter($filter, true, true);
394 394
 
395 395
 		if (is_array($coord)) {
396
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
397
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
398
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
399
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
396
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
397
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
398
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
399
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
400 400
 		} else return array();
401 401
 		if ($globalDBdriver == 'mysql') {
402 402
 			if (isset($globalArchive) && $globalArchive === TRUE) {
403
-				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
403
+				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
404 404
 				FROM spotter_live 
405 405
 				'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date 
406 406
 				AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
407 407
 				AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC';
408 408
 			} else {
409
-				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
409
+				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
410 410
 				FROM spotter_live 
411 411
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
412 412
 				    FROM spotter_live l 
@@ -418,14 +418,14 @@  discard block
 block discarded – undo
418 418
 			}
419 419
 		} else {
420 420
 			if (isset($globalArchive) && $globalArchive === TRUE) {
421
-				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
421
+				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
422 422
 				FROM spotter_live 
423 423
 				".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
424 424
 				AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
425 425
 				AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
426 426
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC";
427 427
 			} else {
428
-				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
428
+				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
429 429
 				FROM spotter_live 
430 430
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
431 431
 				    FROM spotter_live l 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 		try {
441 441
 			$sth = $this->db->prepare($query);
442 442
 			$sth->execute();
443
-		} catch(PDOException $e) {
443
+		} catch (PDOException $e) {
444 444
 			echo $e->getMessage();
445 445
 			die;
446 446
 		}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 if ($interval == '1m')
490 490
                 {
491 491
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
492
-                } else if ($interval == '15m'){
492
+                } else if ($interval == '15m') {
493 493
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
494 494
                 } 
495 495
             }
@@ -497,14 +497,14 @@  discard block
 block discarded – undo
497 497
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
498 498
         }
499 499
 
500
-                $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 
500
+                $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 
501 501
                    WHERE spotter_live.latitude <> '' 
502 502
                                    AND spotter_live.longitude <> '' 
503 503
                    ".$additional_query."
504 504
                    HAVING distance < :radius  
505 505
                                    ORDER BY distance";
506 506
 
507
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
507
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
508 508
 
509 509
                 return $spotter_array;
510 510
         }
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 		date_default_timezone_set('UTC');
523 523
 
524 524
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
525
-                $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';
525
+                $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';
526 526
 
527
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
527
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
528 528
 
529 529
 		return $spotter_array;
530 530
 	}
@@ -535,16 +535,16 @@  discard block
 block discarded – undo
535 535
 	* @return Array the spotter information
536 536
 	*
537 537
 	*/
538
-	public function getDateLiveSpotterDataByIdent($ident,$date)
538
+	public function getDateLiveSpotterDataByIdent($ident, $date)
539 539
 	{
540 540
 		$Spotter = new Spotter($this->db);
541 541
 		date_default_timezone_set('UTC');
542 542
 
543 543
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
544
-                $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';
544
+                $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';
545 545
 
546
-                $date = date('c',$date);
547
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
546
+                $date = date('c', $date);
547
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
548 548
 
549 549
 		return $spotter_array;
550 550
 	}
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
 		$Spotter = new Spotter($this->db);
561 561
 		date_default_timezone_set('UTC');
562 562
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
563
-		$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';
564
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
563
+		$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';
564
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
565 565
 		return $spotter_array;
566 566
 	}
567 567
 
@@ -571,15 +571,15 @@  discard block
 block discarded – undo
571 571
 	* @return Array the spotter information
572 572
 	*
573 573
 	*/
574
-	public function getDateLiveSpotterDataById($id,$date)
574
+	public function getDateLiveSpotterDataById($id, $date)
575 575
 	{
576 576
 		$Spotter = new Spotter($this->db);
577 577
 		date_default_timezone_set('UTC');
578 578
 
579 579
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
580
-		$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';
581
-		$date = date('c',$date);
582
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
580
+		$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';
581
+		$date = date('c', $date);
582
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
583 583
 		return $spotter_array;
584 584
 	}
585 585
 
@@ -595,13 +595,13 @@  discard block
 block discarded – undo
595 595
 		date_default_timezone_set('UTC');
596 596
 
597 597
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
598
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
598
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
599 599
 
600 600
     		try {
601 601
 			
602 602
 			$sth = $this->db->prepare($query);
603 603
 			$sth->execute(array(':ident' => $ident));
604
-		} catch(PDOException $e) {
604
+		} catch (PDOException $e) {
605 605
 			echo $e->getMessage();
606 606
 			die;
607 607
 		}
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 	* @return Array the spotter information
617 617
 	*
618 618
 	*/
619
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
619
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
620 620
 	{
621 621
 		global $globalDBdriver, $globalLiveInterval;
622 622
 		date_default_timezone_set('UTC');
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 		try {
636 636
 			$sth = $this->db->prepare($query);
637 637
 			$sth->execute(array(':id' => $id));
638
-		} catch(PDOException $e) {
638
+		} catch (PDOException $e) {
639 639
 			echo $e->getMessage();
640 640
 			die;
641 641
 		}
@@ -653,12 +653,12 @@  discard block
 block discarded – undo
653 653
 	{
654 654
 		date_default_timezone_set('UTC');
655 655
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
656
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
656
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
657 657
     		try {
658 658
 			
659 659
 			$sth = $this->db->prepare($query);
660 660
 			$sth->execute(array(':ident' => $ident));
661
-		} catch(PDOException $e) {
661
+		} catch (PDOException $e) {
662 662
 			echo $e->getMessage();
663 663
 			die;
664 664
 		}
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 			
689 689
 			$sth = $this->db->prepare($query);
690 690
 			$sth->execute();
691
-		} catch(PDOException $e) {
691
+		} catch (PDOException $e) {
692 692
 			return "error";
693 693
 		}
694 694
 
@@ -711,14 +711,14 @@  discard block
 block discarded – undo
711 711
 				
712 712
 				$sth = $this->db->prepare($query);
713 713
 				$sth->execute();
714
-			} catch(PDOException $e) {
714
+			} catch (PDOException $e) {
715 715
 				return "error";
716 716
 			}
717 717
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
718 718
                         $i = 0;
719
-                        $j =0;
719
+                        $j = 0;
720 720
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
721
-			foreach($all as $row)
721
+			foreach ($all as $row)
722 722
 			{
723 723
 				$i++;
724 724
 				$j++;
@@ -726,9 +726,9 @@  discard block
 block discarded – undo
726 726
 					if ($globalDebug) echo ".";
727 727
 				    	try {
728 728
 						
729
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
729
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
730 730
 						$sth->execute();
731
-					} catch(PDOException $e) {
731
+					} catch (PDOException $e) {
732 732
 						return "error";
733 733
 					}
734 734
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -739,9 +739,9 @@  discard block
 block discarded – undo
739 739
 			if ($i > 0) {
740 740
     				try {
741 741
 					
742
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
742
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
743 743
 					$sth->execute();
744
-				} catch(PDOException $e) {
744
+				} catch (PDOException $e) {
745 745
 					return "error";
746 746
 				}
747 747
 			}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 				
755 755
 				$sth = $this->db->prepare($query);
756 756
 				$sth->execute();
757
-			} catch(PDOException $e) {
757
+			} catch (PDOException $e) {
758 758
 				return "error";
759 759
 			}
760 760
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -802,13 +802,13 @@  discard block
 block discarded – undo
802 802
 	public function deleteLiveSpotterDataByIdent($ident)
803 803
 	{
804 804
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
805
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
805
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
806 806
         
807 807
     		try {
808 808
 			
809 809
 			$sth = $this->db->prepare($query);
810 810
 			$sth->execute(array(':ident' => $ident));
811
-		} catch(PDOException $e) {
811
+		} catch (PDOException $e) {
812 812
 			return "error";
813 813
 		}
814 814
 
@@ -824,13 +824,13 @@  discard block
 block discarded – undo
824 824
 	public function deleteLiveSpotterDataById($id)
825 825
 	{
826 826
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
827
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
827
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
828 828
         
829 829
     		try {
830 830
 			
831 831
 			$sth = $this->db->prepare($query);
832 832
 			$sth->execute(array(':id' => $id));
833
-		} catch(PDOException $e) {
833
+		} catch (PDOException $e) {
834 834
 			return "error";
835 835
 		}
836 836
 
@@ -848,13 +848,13 @@  discard block
 block discarded – undo
848 848
 	{
849 849
 		global $globalDBdriver, $globalTimezone;
850 850
 		if ($globalDBdriver == 'mysql') {
851
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
851
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
852 852
 				WHERE spotter_live.ident = :ident 
853 853
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
854 854
 				AND spotter_live.date < UTC_TIMESTAMP()';
855 855
 			$query_data = array(':ident' => $ident);
856 856
 		} else {
857
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
857
+			$query = "SELECT spotter_live.ident FROM spotter_live 
858 858
 				WHERE spotter_live.ident = :ident 
859 859
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
860 860
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
 		
864 864
 		$sth = $this->db->prepare($query);
865 865
 		$sth->execute($query_data);
866
-		$ident_result='';
867
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
866
+		$ident_result = '';
867
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
868 868
 		{
869 869
 			$ident_result = $row['ident'];
870 870
 		}
@@ -881,13 +881,13 @@  discard block
 block discarded – undo
881 881
 	{
882 882
 		global $globalDBdriver, $globalTimezone;
883 883
 		if ($globalDBdriver == 'mysql') {
884
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
884
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
885 885
 				WHERE spotter_live.ident = :ident 
886 886
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
887 887
 //				AND spotter_live.date < UTC_TIMESTAMP()";
888 888
 			$query_data = array(':ident' => $ident);
889 889
 		} else {
890
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
890
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
891 891
 				WHERE spotter_live.ident = :ident 
892 892
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'";
893 893
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -896,8 +896,8 @@  discard block
 block discarded – undo
896 896
 		
897 897
 		$sth = $this->db->prepare($query);
898 898
 		$sth->execute($query_data);
899
-		$ident_result='';
900
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
899
+		$ident_result = '';
900
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
901 901
 		{
902 902
 			$ident_result = $row['flightaware_id'];
903 903
 		}
@@ -914,13 +914,13 @@  discard block
 block discarded – undo
914 914
 	{
915 915
 		global $globalDBdriver, $globalTimezone;
916 916
 		if ($globalDBdriver == 'mysql') {
917
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
917
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
918 918
 				WHERE spotter_live.flightaware_id = :id 
919 919
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
920 920
 //				AND spotter_live.date < UTC_TIMESTAMP()";
921 921
 			$query_data = array(':id' => $id);
922 922
 		} else {
923
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
923
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
924 924
 				WHERE spotter_live.flightaware_id = :id 
925 925
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
926 926
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
 		
930 930
 		$sth = $this->db->prepare($query);
931 931
 		$sth->execute($query_data);
932
-		$ident_result='';
933
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
932
+		$ident_result = '';
933
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
934 934
 		{
935 935
 			$ident_result = $row['flightaware_id'];
936 936
 		}
@@ -947,13 +947,13 @@  discard block
 block discarded – undo
947 947
 	{
948 948
 		global $globalDBdriver, $globalTimezone;
949 949
 		if ($globalDBdriver == 'mysql') {
950
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
950
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
951 951
 				WHERE spotter_live.ModeS = :modes 
952 952
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
953 953
 //				AND spotter_live.date < UTC_TIMESTAMP()";
954 954
 			$query_data = array(':modes' => $modes);
955 955
 		} else {
956
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
956
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
957 957
 				WHERE spotter_live.ModeS = :modes 
958 958
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'";
959 959
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 		
963 963
 		$sth = $this->db->prepare($query);
964 964
 		$sth->execute($query_data);
965
-		$ident_result='';
966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
965
+		$ident_result = '';
966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
967 967
 		{
968 968
 			//$ident_result = $row['spotter_live_id'];
969 969
 			$ident_result = $row['flightaware_id'];
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
 				return array();
989 989
 			} else {
990 990
 				$q_array = explode(" ", $q);
991
-				foreach ($q_array as $q_item){
992
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
991
+				foreach ($q_array as $q_item) {
992
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
993 993
 					$additional_query .= " AND (";
994 994
 					$additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR ";
995 995
 					$additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR ";
@@ -1004,11 +1004,11 @@  discard block
 block discarded – undo
1004 1004
 			}
1005 1005
 		}
1006 1006
 		if ($globalDBdriver == 'mysql') {
1007
-			$query  = "SELECT spotter_live.* FROM spotter_live 
1007
+			$query = "SELECT spotter_live.* FROM spotter_live 
1008 1008
 			    WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
1009 1009
 			    AND spotter_live.date < UTC_TIMESTAMP()";
1010 1010
 		} else {
1011
-			$query  = "SELECT spotter_live.* FROM spotter_live 
1011
+			$query = "SELECT spotter_live.* FROM spotter_live 
1012 1012
 			    WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
1013 1013
 			    AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
1014 1014
 		}
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 	* @return String success or false
1029 1029
 	*
1030 1030
 	*/
1031
-	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 = '')
1031
+	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 = '')
1032 1032
 	{
1033 1033
 		global $globalURL, $globalArchive, $globalDebug;
1034 1034
 		$Common = new Common();
@@ -1128,27 +1128,27 @@  discard block
 block discarded – undo
1128 1128
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
1129 1129
 
1130 1130
         
1131
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
1132
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1133
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
1134
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1135
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1136
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1137
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1138
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
1139
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1140
-		$altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1141
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
1142
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1143
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
1144
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
1145
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
1146
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
1147
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
1148
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
1149
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
1150
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
1151
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
1131
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
1132
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1133
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
1134
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1135
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1136
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1137
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1138
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
1139
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1140
+		$altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1141
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
1142
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1143
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
1144
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
1145
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
1146
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
1147
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
1148
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
1149
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
1150
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
1151
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
1152 1152
 
1153 1153
 		$airline_name = '';
1154 1154
 		$airline_icao = '';
@@ -1170,10 +1170,10 @@  discard block
 block discarded – undo
1170 1170
 		$arrival_airport_country = '';
1171 1171
 		
1172 1172
             	
1173
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1174
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1175
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1176
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1173
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
1174
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
1175
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1176
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1177 1177
 		
1178 1178
 		$query = '';
1179 1179
 		if ($globalArchive) {
@@ -1184,19 +1184,19 @@  discard block
 block discarded – undo
1184 1184
 		$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, real_altitude) 
1185 1185
 		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, :real_altitude)';
1186 1186
 
1187
-		$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,':real_altitude' => $altitude_real);
1187
+		$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, ':real_altitude' => $altitude_real);
1188 1188
 		try {
1189 1189
 			
1190 1190
 			$sth = $this->db->prepare($query);
1191 1191
 			$sth->execute($query_values);
1192 1192
 			$sth->closeCursor();
1193
-		} catch(PDOException $e) {
1193
+		} catch (PDOException $e) {
1194 1194
 			return "error : ".$e->getMessage();
1195 1195
 		}
1196 1196
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1197 1197
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1198 1198
 		    $SpotterArchive = new SpotterArchive($this->db);
1199
-		    $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, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1199
+		    $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, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
1200 1200
 		    if ($globalDebug) echo $result.')';
1201 1201
 		} elseif ($globalDebug && $putinarchive !== true) {
1202 1202
 			echo '(Not adding to archive)';
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 	public function getOrderBy()
1211 1211
 	{
1212
-		$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"));
1212
+		$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"));
1213 1213
 		return $orderby;
1214 1214
 	}
1215 1215
 
Please login to merge, or discard this patch.